Class FilesystemHandle
java.lang.Object
org.eclipse.ease.modules.platform.resources.FilesystemHandle
- All Implemented Interfaces:
Closeable,AutoCloseable,IFileHandle
- Direct Known Subclasses:
ResourceHandle
public class FilesystemHandle extends Object implements IFileHandle
-
Field Summary
Fields inherited from interface org.eclipse.ease.modules.platform.resources.IFileHandle
APPEND, READ, WRITE -
Constructor Summary
Constructors Constructor Description FilesystemHandle(File file, int mode) -
Method Summary
Modifier and Type Method Description voidclose()Close a file instance.booleancreateFile(boolean createHierarchy)Create a file.booleanexists()Check if a physical file exists.ObjectgetFile()Get the base file object.intgetMode()Get the mode (READ/WRITE/APPEND) this handle is operating for.PathgetPath()Returns the java.io.File Path to the underlying file.Stringread(int characters)Read characters from a file.StringreadLine()Read a line of data from a file.voidsetMode(int mode)voidwrite(byte[] data)Write data to a file.voidwrite(String data)Write data to a file.
-
Constructor Details
-
FilesystemHandle
-
-
Method Details
-
getMode
public int getMode()Description copied from interface:IFileHandleGet the mode (READ/WRITE/APPEND) this handle is operating for.- Specified by:
getModein interfaceIFileHandle- Returns:
- file mode
-
read
Description copied from interface:IFileHandleRead characters from a file.- Specified by:
readin interfaceIFileHandle- Parameters:
characters- amount of characters to read- Returns:
- data read from file
- Throws:
IOException- on access errors
-
readLine
Description copied from interface:IFileHandleRead a line of data from a file. Reads until a line feed is detected.- Specified by:
readLinein interfaceIFileHandle- Returns:
- single line of text
- Throws:
IOException- on access errors
-
getPath
Description copied from interface:IFileHandleReturns the java.io.File Path to the underlying file.- Specified by:
getPathin interfaceIFileHandle- Returns:
- Path of the file
-
write
Description copied from interface:IFileHandleWrite data to a file. Uses platform default encoding to write strings to the file.- Specified by:
writein interfaceIFileHandle- Parameters:
data- data to write- Throws:
IOException- on write errors
-
write
Description copied from interface:IFileHandleWrite data to a file.- Specified by:
writein interfaceIFileHandle- Parameters:
data- data to write- Throws:
IOException- on write errors
-
exists
public boolean exists()Description copied from interface:IFileHandleCheck if a physical file exists.- Specified by:
existsin interfaceIFileHandle- Returns:
truewhen file exists
-
createFile
Description copied from interface:IFileHandleCreate a file.- Specified by:
createFilein interfaceIFileHandle- Parameters:
createHierarchy- create parent folders if they do not exist- Returns:
trueon success- Throws:
IOException
-
setMode
public void setMode(int mode) -
close
public void close()Description copied from interface:IFileHandleClose a file instance.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceIFileHandle
-
getFile
Description copied from interface:IFileHandleGet the base file object. Returns anIFileor aFileinstance.- Specified by:
getFilein interfaceIFileHandle- Returns:
- base file object
-