Class ResourceHandle

java.lang.Object
org.eclipse.ease.modules.platform.resources.FilesystemHandle
org.eclipse.ease.modules.platform.resources.ResourceHandle
All Implemented Interfaces:
Closeable, AutoCloseable, IFileHandle

public class ResourceHandle
extends FilesystemHandle
  • Constructor Details

    • ResourceHandle

      public ResourceHandle​(org.eclipse.core.resources.IFile file, int mode)
  • Method Details

    • 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
      Overrides:
      write in class FilesystemHandle
      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
      Overrides:
      write in class FilesystemHandle
      Parameters:
      data - data to write
      Throws:
      IOException - on write 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
      Overrides:
      getPath in class FilesystemHandle
      Returns:
      Path of the file
    • exists

      public boolean exists()
      Description copied from interface: IFileHandle
      Check if a physical file exists.
      Specified by:
      exists in interface IFileHandle
      Overrides:
      exists in class FilesystemHandle
      Returns:
      true when file exists
    • createFile

      public boolean createFile​(boolean createHierarchy) throws IOException
      Description copied from interface: IFileHandle
      Create a file.
      Specified by:
      createFile in interface IFileHandle
      Overrides:
      createFile in class FilesystemHandle
      Parameters:
      createHierarchy - create parent folders if they do not exist
      Returns:
      true on success
      Throws:
      IOException
    • createFolder

      public static boolean createFolder​(org.eclipse.core.resources.IContainer container) throws IOException
      Create a new container on the workbench.
      Parameters:
      container - container to create
      Returns:
      true on success
      Throws:
      org.eclipse.core.runtime.CoreException - thrown when folder cannot be created
      IOException
    • 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
      Overrides:
      getFile in class FilesystemHandle
      Returns:
      base file object