|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.bluesock.bluemud.driver.FileManager
The FileManager is responsible for the management of all access to disk, including reading files, writing files, providing directory listings, etc. All disk access should go through this class. TODO: Add decent error handling. At the moment, this class just dumps a stack trace and returns failure.
Constructor Summary | |
FileManager()
|
Method Summary | |
(package private) static boolean |
createDirectory(java.lang.String dirname)
Creates a directory. |
(package private) static java.lang.String[] |
fstatFile(java.lang.String filename)
Returns an array of strings in this order: file name length (size) last modified Throws an IOException for almost any issues. |
(package private) static boolean |
isDirectory(java.lang.String dirname)
Allows you to discern if a certain path is a directory or not. |
(package private) static boolean |
isFile(java.lang.String filename)
Allows you to discern if a certain file is a file or not. |
(package private) static java.lang.String[] |
listDirectory(java.lang.String dirname)
Returns the directory contents as an array of Strings. |
(package private) static java.lang.String |
readFile(java.lang.String filename)
Read a file from disk and don't cache it. |
(package private) static java.lang.String |
readFile(java.lang.String filename,
boolean cachethis)
Read a file from disk. |
(package private) static boolean |
removeDirectory(java.lang.String dirname)
Removes a directory. |
(package private) static boolean |
removeFile(java.lang.String filename)
Removes a file. |
(package private) static boolean |
touchFile(java.lang.String filename)
Creates a new empty file with the specified path if that file doesn't already exist. |
(package private) static boolean |
writeFile(java.lang.String content,
java.lang.String filename)
Write a file to disk. |
(package private) static boolean |
writeFile(java.lang.String content,
java.lang.String filename,
boolean append)
Write a file to disk. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public FileManager()
Method Detail |
static boolean writeFile(java.lang.String content, java.lang.String filename)
content
- The content to write to a file.filename
- The name of the file to write to.static boolean writeFile(java.lang.String content, java.lang.String filename, boolean append)
content
- The content to write to a file.filename
- The name of the file to write to.append
- Whether to append to the end of the file or
just replace the file.static boolean touchFile(java.lang.String filename)
filename
- The path to the file to create.static java.lang.String readFile(java.lang.String filename)
filename
- The name of the file to read.static java.lang.String readFile(java.lang.String filename, boolean cachethis)
filename
- The name of the file to read.cachethis
- True if we want to cache the filestatic java.lang.String[] listDirectory(java.lang.String dirname) throws java.io.IOException
static java.lang.String[] fstatFile(java.lang.String filename) throws java.io.IOException
static boolean isDirectory(java.lang.String dirname) throws java.io.IOException
dirname
- name of the directory to query.static boolean isFile(java.lang.String filename) throws java.io.IOException
filename
- name of the file in question.static boolean removeDirectory(java.lang.String dirname) throws java.io.IOException
dirname
- name of the directory to remove.static boolean removeFile(java.lang.String filename) throws java.io.IOException
filename
- name of the file to re move.static boolean createDirectory(java.lang.String dirname) throws java.io.IOException
dirname
- name of the directory to create.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |