public class FileManager
extends java.lang.Object
DawnParser. Each file is
designed by a given ID.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NEW_LINE
Default line separator (system's one) used by the file manager.
|
| Constructor and Description |
|---|
FileManager() |
| Modifier and Type | Method and Description |
|---|---|
static void |
closeFile(java.lang.String ID,
Function function,
DawnParser parser)
Closes a given file.
|
static boolean |
isFileAvailable(java.lang.String ID,
DawnParser parser)
Checks if a given file is still available or not.
|
static void |
openFileForInput(java.lang.String ID,
java.lang.String file,
Function function,
DawnParser parser)
Opens a file for input (i.e to read from it).
|
static void |
openFileForOutput(java.lang.String ID,
java.lang.String file,
Function function,
DawnParser parser)
Opens a file for output (i.e to write into it).
|
static java.lang.String |
read(boolean line,
java.lang.String ID,
Function function,
DawnParser parser)
Reads from a file according to the
line parameter.. |
static java.lang.String |
read(java.lang.String ID,
Function function,
DawnParser parser)
Reads a character from a given file.
|
static java.lang.String |
readLine(java.lang.String ID,
Function function,
DawnParser parser)
Reads a line from a given file.
|
static void |
write(boolean isLine,
java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
Writes a line into a given file.
|
static void |
write(java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
Writes a line into a given file (does not add a return char).
|
static void |
writeLine(java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
Writes a line into a given file (write the text then adds a return char).
|
public static final java.lang.String NEW_LINE
public static void openFileForInput(java.lang.String ID,
java.lang.String file,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDfile - The path, relative or absolute, to the file to be openedfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static void openFileForOutput(java.lang.String ID,
java.lang.String file,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDfile - The path, relative or absolute, to the file to be opened/createdfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static java.lang.String readLine(java.lang.String ID,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static java.lang.String read(java.lang.String ID,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static java.lang.String read(boolean line,
java.lang.String ID,
Function function,
DawnParser parser)
throws DawnRuntimeException
line parameter..line - If true, a whole line is read. Otherwise, only a char is read.ID - The file internal IDfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static void writeLine(java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDline - The line to be writtenfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static void write(java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDline - The line to be writtenfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static void write(boolean isLine,
java.lang.String ID,
java.lang.String line,
Function function,
DawnParser parser)
throws DawnRuntimeException
isLine parameter.isLine - If true, the NEW_LINE value is added to the lineID - The file internal IDline - The line to be writtenfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static void closeFile(java.lang.String ID,
Function function,
DawnParser parser)
throws DawnRuntimeException
ID - The file internal IDfunction - The Function which is opening the fileparser - The DawnParser which is executing the above functionDawnRuntimeExceptionpublic static boolean isFileAvailable(java.lang.String ID,
DawnParser parser)
ID - The file internal IDparser - The DawnParser which is executing the above functionCopyright ? 2002 Romain Guy.