org.eclipse.ease.modules.platform

## Interface IFileHandle

All Known Implementing Classes:
  FilesystemHandle, ResourceHandle

    public interface IFileHandle

Generic handle to an `IFile` or `File` instance.

### Field Summary

Fields
`static int` `APPEND` Open file in append mode.
`static int` `READ` Open file in read mode.
`static int` `WRITE` Open file in write mode.

### Method Summary

All Methods Instance Methods Abstract 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` `write(byte[] data)` Write data to a file.
`void` `write(java.lang.String data)` Write data to a file.

### Field Detail

#### READ

    static final int READ

Open file in read mode.

See Also:
  Constant Field Values

#### WRITE

    static final int WRITE

Open file in write mode.

See Also:
  Constant Field Values

#### APPEND

    static final int APPEND

Open file in append mode.

See Also:
  Constant Field Values

### Method Detail

#### read

    java.lang.String read(int characters)
                   throws java.io.IOException

Read characters from a file.

Parameters:
  `characters` - amount of characters to read
Returns:
  data read from file
Throws:
  `java.io.IOException` - on access errors

#### readLine

    java.lang.String readLine()
                       throws java.io.IOException

Read a line of data from a file. Reads until a line feed is detected.

Returns:
  single line of text
Throws:
  `java.io.IOException` - on access errors

#### getPath

    java.nio.file.Path getPath()
                        throws java.io.IOException

Returns the java.io.File Path to the underlying file

Returns:
  Path of the file
Throws:
  `java.io.IOException` - on access errors

#### write

    void write(java.lang.String data)
        throws java.io.IOException

Write data to a file. Uses platform default encoding to write strings to the file.

Parameters:
  `data` - data to write
Throws:
  `java.io.IOException` - on write errors

#### write

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

Write data to a file.

Parameters:
  `data` - data to write
Throws:
  `java.io.IOException` - on write errors

#### exists

    boolean exists()

Check if a physical file exists.

Returns:
  `true` when file exists

#### createFile

    boolean createFile(boolean createHierarchy)
                throws java.lang.Exception

Create a file.

Parameters:
  `createHierarchy` - create parent folders if they do not exist
Returns:
  `true` on success
Throws:
  `java.lang.Exception` - on creation errors

#### close

    void close()

Close a file instance.

#### getFile

    java.lang.Object getFile()

Get the base file object. Returns an `IFile` or a `File` instance.

Returns:
  base file object