org.eclipse.ease.modules.platform

## Class FilesystemHandle

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

All Implemented Interfaces:
  IFileHandle

Direct Known Subclasses:
  ResourceHandle

    public class FilesystemHandle
    extends java.lang.Object
    implements IFileHandle

### Field Summary

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

`APPEND, READ, WRITE`

### Constructor Summary

Constructors
Constructor and Description
`FilesystemHandle(java.io.File file, int mode)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `close()` Close a file instance.
`boolean` `createFile(boolean createHierarchy)` Create a file.
`boolean` `exists()` Check if a physical file exists.
`java.lang.Object` `getFile()` Get the base file object.
`java.nio.file.Path` `getPath()` Returns the java.io.File Path to the underlying file
`java.lang.String` `read(int characters)` Read characters from a file.
`java.lang.String` `readLine()` Read a line of data from a file.
`void` `setMode(int mode)`
`void` `write(byte[] data)` Write data to a file.
`void` `write(java.lang.String data)` Write data to a file.

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

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

### Constructor Detail

#### FilesystemHandle

    public FilesystemHandle(java.io.File file,
                            int mode)

### Method Detail

#### read

    public java.lang.String read(int characters)
                          throws java.io.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:
  `java.io.IOException` - on access errors

#### readLine

    public java.lang.String readLine()
                              throws java.io.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:
  `java.io.IOException` - on access errors

#### getPath

    public java.nio.file.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(java.lang.String data)
               throws java.io.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:
  `java.io.IOException` - on write errors

#### write

    public void write(byte[] data)
               throws java.io.IOException

Description copied from interface: `IFileHandle`
Write data to a file.

Specified by:
  `write` in interface `IFileHandle`
Parameters:
  `data` - data to write
Throws:
  `java.io.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 java.lang.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:
  `java.lang.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 java.lang.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