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
  • Constructor Details

    • FilesystemHandle

      public FilesystemHandle​(File file, int mode)
  • Method Details

    • read

      public String read​(int characters) throws IOException
      Description copied from interface: IFileHandle
      Read characters from a file.
      Specified by:
      read in interface IFileHandle
      Parameters:
      characters - amount of characters to read
      Returns:
      data read from file
      Throws:
      IOException - on access errors
    • readLine

      public String readLine() throws IOException
      Description copied from interface: IFileHandle
      Read a line of data from a file. Reads until a line feed is detected.
      Specified by:
      readLine in interface IFileHandle
      Returns:
      single line of text
      Throws:
      IOException - on access errors
    • getPath

      public Path getPath()
      Description copied from interface: IFileHandle
      Returns the java.io.File Path to the underlying file
      Specified by:
      getPath in interface IFileHandle
      Returns:
      Path of the file
    • write

      public void write​(String data) throws IOException
      Description copied from interface: IFileHandle
      Write data to a file. Uses platform default encoding to write strings to the file.
      Specified by:
      write in interface IFileHandle
      Parameters:
      data - data to write
      Throws:
      IOException - on write errors
    • write

      public void write​(byte[] data) throws IOException
      Description copied from interface: IFileHandle
      Write data to a file.
      Specified by:
      write in interface IFileHandle
      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 interface IFileHandle
      Returns:
      true when file exists
    • createFile

      public boolean createFile​(boolean createHierarchy) throws Exception
      Description copied from interface: IFileHandle
      Create a file.
      Specified by:
      createFile in interface IFileHandle
      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 interface IFileHandle
    • getFile

      public Object getFile()
      Description copied from interface: IFileHandle
      Get the base file object. Returns an IFile or a File instance.
      Specified by:
      getFile in interface IFileHandle
      Returns:
      base file object