public class FilesystemHandle extends Object implements IFileHandle
APPEND, READ, WRITE
Constructor and Description |
---|
FilesystemHandle(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.
|
Object |
getFile()
Get the base file object.
|
String |
read(int characters)
Read characters from a file.
|
String |
readLine()
Read a line of data from a file.
|
void |
setMode(int mode) |
boolean |
write(String data)
Write data to a file
|
public FilesystemHandle(File file, int mode)
public String read(int characters) throws IOException
IFileHandle
read
in interface IFileHandle
characters
- amount of characters to readIOException
- on access errorspublic String readLine() throws IOException
IFileHandle
readLine
in interface IFileHandle
IOException
- on access errorspublic boolean write(String data)
IFileHandle
write
in interface IFileHandle
data
- data to writetrue
on successpublic boolean exists()
IFileHandle
exists
in interface IFileHandle
true
when file existspublic boolean createFile(boolean createHierarchy) throws Exception
IFileHandle
createFile
in interface IFileHandle
createHierarchy
- create parent folders if they do not existtrue
on successException
- on creation errorspublic void setMode(int mode)
public void close()
IFileHandle
close
in interface IFileHandle
public Object getFile()
IFileHandle
getFile
in interface IFileHandle