Package org.eclipse.ease.modules.platform

# Class ResourceHandle

java.lang.Object
org.eclipse.ease.modules.platform.FilesystemHandle
org.eclipse.ease.modules.platform.ResourceHandle

All Implemented Interfaces:
  `IFileHandle`

    public class ResourceHandle
    extends FilesystemHandle

## Field Summary

### Fields inherited from interface org.eclipse.ease.modules.platform.IFileHandle

`APPEND, READ, WRITE`

## Constructor Summary

Constructors
Constructor | Description
--- | ---
`ResourceHandle​(org.eclipse.core.resources.IFile file, int mode)` |

## Method Summary

Modifier and Type | Method | Description
--- | --- | ---
`boolean` | `createFile​(boolean createHierarchy)` | Create a file.
`static boolean` | `createFolder​(org.eclipse.core.resources.IContainer container)` | Create a new container on the workbench.
`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 file
`void` | `write​(byte[] data)` | Write data to a file.
`void` | `write​(String data)` | Write data to a file.

### Methods inherited from class org.eclipse.ease.modules.platform.FilesystemHandle

`close, read, readLine, setMode`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 org.eclipse.core.runtime.CoreException
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:
  `org.eclipse.core.runtime.CoreException`

### createFolder

public static boolean createFolder​(org.eclipse.core.resources.IContainer container) throws org.eclipse.core.runtime.CoreException
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

### 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