Class FilesystemHandle
java.lang.Object
org.eclipse.ease.modules.platform.FilesystemHandle
- All Implemented Interfaces:
IFileHandle
- Direct Known Subclasses:
ResourceHandle
public class FilesystemHandle extends Object implements IFileHandle
-
Field Summary
Fields inherited from interface org.eclipse.ease.modules.platform.IFileHandle
APPEND, READ, WRITE
-
Constructor Summary
Constructors Constructor Description FilesystemHandle(File file, int mode)
-
Method Summary
Modifier and Type Method 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.Path
getPath()
Returns the java.io.File Path to the underlying fileString
read(int characters)
Read characters from a file.String
readLine()
Read a line of data from a file.void
setMode(int mode)
void
write(byte[] data)
Write data to a file.void
write(String data)
Write data to a file.
-
Constructor Details
-
FilesystemHandle
-
-
Method Details
-
read
Description copied from interface:IFileHandle
Read characters from a file.- Specified by:
read
in interfaceIFileHandle
- Parameters:
characters
- amount of characters to read- Returns:
- data read from file
- Throws:
IOException
- on access errors
-
readLine
Description copied from interface:IFileHandle
Read a line of data from a file. Reads until a line feed is detected.- Specified by:
readLine
in interfaceIFileHandle
- Returns:
- single line of text
- Throws:
IOException
- on access errors
-
getPath
Description copied from interface:IFileHandle
Returns the java.io.File Path to the underlying file- Specified by:
getPath
in interfaceIFileHandle
- Returns:
- Path of the file
-
write
Description copied from interface:IFileHandle
Write data to a file. Uses platform default encoding to write strings to the file.- Specified by:
write
in interfaceIFileHandle
- Parameters:
data
- data to write- Throws:
IOException
- on write errors
-
write
Description copied from interface:IFileHandle
Write data to a file.- Specified by:
write
in interfaceIFileHandle
- Parameters:
data
- data to write- Throws:
IOException
- on write errors
-
exists
public boolean exists()Description copied from interface:IFileHandle
Check if a physical file exists.- Specified by:
exists
in interfaceIFileHandle
- Returns:
true
when file exists
-
createFile
Description copied from interface:IFileHandle
Create a file.- Specified by:
createFile
in interfaceIFileHandle
- Parameters:
createHierarchy
- create parent folders if they do not exist- Returns:
true
on success- Throws:
Exception
- on creation errors
-
setMode
public void setMode(int mode) -
close
public void close()Description copied from interface:IFileHandle
Close a file instance.- Specified by:
close
in interfaceIFileHandle
-
getFile
Description copied from interface:IFileHandle
Get the base file object. Returns anIFile
or aFile
instance.- Specified by:
getFile
in interfaceIFileHandle
- Returns:
- base file object
-