public class FilesystemHandle extends java.lang.Object implements IFileHandle
APPEND, READ, WRITE| Constructor and Description |
|---|
FilesystemHandle(java.io.File file,
int mode) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close a file instance.
|
boolean |
createFile(boolean createHierarchy)
Create a file.
|
boolean |
exists()
Check if a physical file exists.
|
java.lang.Object |
getFile()
Get the base file object.
|
java.lang.String |
read(int characters)
Read characters from a file.
|
java.lang.String |
readLine()
Read a line of data from a file.
|
void |
setMode(int mode) |
boolean |
write(byte[] data)
Write data to a file.
|
boolean |
write(java.lang.String data)
Write data to a file.
|
public java.lang.String read(int characters)
throws java.io.IOException
IFileHandleread in interface IFileHandlecharacters - amount of characters to readjava.io.IOException - on access errorspublic java.lang.String readLine()
throws java.io.IOException
IFileHandlereadLine in interface IFileHandlejava.io.IOException - on access errorspublic boolean write(java.lang.String data)
IFileHandlewrite in interface IFileHandledata - data to writetrue on successpublic boolean write(byte[] data)
IFileHandlewrite in interface IFileHandledata - data to writetrue on successpublic boolean exists()
IFileHandleexists in interface IFileHandletrue when file existspublic boolean createFile(boolean createHierarchy)
throws java.lang.Exception
IFileHandlecreateFile in interface IFileHandlecreateHierarchy - create parent folders if they do not existtrue on successjava.lang.Exception - on creation errorspublic void setMode(int mode)
public void close()
IFileHandleclose in interface IFileHandlepublic java.lang.Object getFile()
IFileHandleIFile or a File instance.getFile in interface IFileHandle