Class FilesystemHandle
java.lang.Object
org.eclipse.ease.modules.platform.resources.FilesystemHandle
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IFileHandle
- Direct Known Subclasses:
ResourceHandle
-
Field Summary
Fields inherited from interface org.eclipse.ease.modules.platform.resources.IFileHandle
APPEND, READ, WRITE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close a file instance.boolean
createFile
(boolean createHierarchy) Create a file.boolean
exists()
Check if a physical file exists.getFile()
Get the base file object.int
getMode()
Get the mode (READ/WRITE/APPEND) this handle is operating for.getPath()
Returns the java.io.File Path to the underlying file.read
(int characters) Read characters from a file.readLine()
Read a line of data from a file.void
setMode
(int mode) void
write
(byte[] data) Write data to a file.void
Write data to a file.
-
Constructor Details
-
FilesystemHandle
-
-
Method Details
-
getMode
public int getMode()Description copied from interface:IFileHandle
Get the mode (READ/WRITE/APPEND) this handle is operating for.- Specified by:
getMode
in interfaceIFileHandle
- Returns:
- file mode
-
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:
IOException
-
setMode
public void setMode(int mode) -
close
public void close()Description copied from interface:IFileHandle
Close a file instance.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- 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
-