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
IFileHandleread in interface IFileHandlecharacters - amount of characters to readIOException - on access errorspublic String readLine() throws IOException
IFileHandlereadLine in interface IFileHandleIOException - on access errorspublic boolean write(String data)
IFileHandlewrite in interface IFileHandledata - data to writetrue on successpublic boolean exists()
IFileHandleexists in interface IFileHandletrue when file existspublic boolean createFile(boolean createHierarchy)
throws Exception
IFileHandlecreateFile in interface IFileHandlecreateHierarchy - create parent folders if they do not existtrue on successException - on creation errorspublic void setMode(int mode)
public void close()
IFileHandleclose in interface IFileHandlepublic Object getFile()
IFileHandlegetFile in interface IFileHandle