public class FileManager
extends java.lang.Object
| Constructor and Description |
|---|
FileManager() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
existsFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
Checks if a file related to a page exists on the given root directory.
|
static java.io.File |
getFile(java.io.File root,
java.lang.String language,
int pageID)
Creates the abstract path for a given page considering its ID and
language
The path will be constructed as follows:
root/language/index/filename.txt where index is the
result of dividing pageID by and
filename is formed by concatenating the pageID and
language, separated by dots. |
static java.io.File |
getFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
Creates the abstract path for a given page considering its ID, language
and the type of preprocess.
|
static java.util.Set<java.lang.String> |
getFilenames(java.io.File directory,
java.lang.String language,
boolean recursive)
Retrieve the name of the preprocessed files in a language from the given
directory.
|
static java.lang.String |
loadFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
Loads the file related to the given parameters in text format.
|
static void |
main(java.lang.String[] args)
Example to get files with filename filter
|
static java.io.File |
savePage(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID,
java.lang.StringBuffer text)
Saves the text contained in the buffer in the correct file considering
the page ID, language and type of preprocess.
|
public static java.io.File getFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
The path will be constructed as follows:
root/type/language/index/filename.txt where index is the
result of dividing pageID by and
filename is formed by concatenating the pageID and
language, separated by dots.
root - Root directory.type - Type of preprocesslanguage - Language of the pagepageID - Identifier of the pagepublic static java.io.File getFile(java.io.File root,
java.lang.String language,
int pageID)
The path will be constructed as follows:
root/language/index/filename.txt where index is the
result of dividing pageID by and
filename is formed by concatenating the pageID and
language, separated by dots.
root - Root directory.language - Language of the pagepageID - Identifier of the pagepublic static java.util.Set<java.lang.String> getFilenames(java.io.File directory,
java.lang.String language,
boolean recursive)
directory - Directory wherein are the fileslanguage - recursive - If true, it will search inside the sub-directories.
Otherwise, only the files in the given directory will be
retrieved.public static java.io.File savePage(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID,
java.lang.StringBuffer text)
throws java.io.IOException
root - Root directory.type - Type of preprocesslanguage - Language of the pagepageID - Identifier of the pagetext - Buffer which contains the text to write in the file.java.io.IOExceptionpublic static java.lang.String loadFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
throws java.io.IOException
root - Root directory.type - Type of preprocesslanguage - Language of the pagepageID - Identifier of the pagejava.io.IOExceptionpublic static boolean existsFile(java.io.File root,
TypePreprocess type,
java.lang.String language,
int pageID)
root - Root directory.type - Type of preprocesslanguage - Language of the pagepageID - Identifier of the pagetrue if the file exists.public static void main(java.lang.String[] args)
args -