Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sun.squawk.platform.posix
Class GCFFileImpl

    java.lang.Object
      com.sun.squawk.platform.BaseGCFFile
          com.sun.squawk.platform.posix.GCFFileImpl

All Implemented Interfaces:
  GCFFile

    public class GCFFileImpl

extends BaseGCFFile

* Interface for POSIX peer of a file handle

Field Summary

Fields inherited from class com.sun.squawk.platform.BaseGCFFile
`INVALID_HANDLE, nativeFileName, readHandle, writeHandle`

Constructor Summary
`GCFFileImpl()`

Method Summary
`void` | `closeForRead()` Closes the file for reading.
`void` | `closeForWrite()` Closes the file for writing.
`void` | `create()` Create file corresponding to this file handler.
`void` | `delete()` Deletes the file or directory associated with this handler.
`boolean` | `exists()` Check is file or directory corresponding to this filehandler exists.
`long` | `fileSize()` Determines the size of a file on the file system.
`void` | `flush()` Flushes any output to the file.
`String` | `illegalFileNameChars()` Returns a string that contains all characters forbidden for the use on the given platform except "/" (forward slash) which is always considered illegal.
`boolean` | `isDirectory()` Check is file corresponding to this filehandler exists and is a directory.
`void` | `openForRead()` Opens the file for reading.
`void` | `openForWrite()` Opens the file for writing.
`void` | `positionForWrite(long offset)` Sets the next write location.
`int` | `read(byte[] b, int off, int len)` Reads data from the file to an array.
`int` | `write(byte[] b, int off, int len)` Write data from an array to the file.

Methods inherited from class com.sun.squawk.platform.BaseGCFFile
`close, closeForReadWrite, connect, getFileSeparator`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GCFFileImpl

    public GCFFileImpl()

Method Detail

### exists

    public boolean exists()

  Check is file or directory corresponding to this filehandler exists.

  Returns:
    `true` if the file/directory exists, `false` otherwise.

### isDirectory

    public boolean isDirectory()

  Check is file corresponding to this filehandler exists and is a directory.

  Returns:
    `true` if pathname is a directory

### delete

    public void delete()
                throws IOException

  Deletes the file or directory associated with this handler. The file or directory is deleted immediately on the actual file system upon invocation of this method. Previously open native file should be closed.The handler instance object remains connected and available for use.

  Throws:
    `IOException` - If the target is a directory and it is not empty, the connection target does not exist or is unaccessible, or an unspecified error occurs preventing deletion of the target.

### fileSize

    public long fileSize()
                  throws IOException

  Determines the size of a file on the file system. The size of a file always represents the number of bytes contained in the file; there is no pre-allocated but empty space in a file. Users should perform an explicit `flush()` on any open output streams to the file prior to invoking this method to ensure accurate results.

  Returns:
    The size in bytes of the selected file, or -1 if the file does not exist or is not accessible.
  Throws:
    `IOException` - if the method is invoked on a directory.

### illegalFileNameChars

    public String illegalFileNameChars()

  Returns a string that contains all characters forbidden for the use on the given platform except "/" (forward slash) which is always considered illegal. If there are no such characters an empty string is returned.

  Returns:
    string of illegal file name characters

### openForRead

    public void openForRead()
                     throws IOException

  Opens the file for reading.

  Throws:
    `IOException` - if any error occurs during input/output operations.

### closeForRead

    public void closeForRead()
                      throws IOException

  Closes the file for reading.

  Throws:
    `IOException` - if any error occurs during input/output operations.

### openForWrite

    public void openForWrite()
                      throws IOException

  Opens the file for writing.

  Throws:
    `IOException` - if any error occurs during input/output operations.

### closeForWrite

    public void closeForWrite()
                       throws IOException

  Closes the file for writing.

  Throws:
    `IOException` - if any error occurs during input/output operations.

### read

    public int read(byte[] b,
                    int off,
                    int len)
             throws IOException

  Reads data from the file to an array.

  Parameters:
    `b` - array for input data
    `off` - index in the input array
    `len` - length of data to read
  Returns:
    length of data really read
  Throws:
    `IOException` - if any error occurs.

### write

    public int write(byte[] b,
                     int off,
                     int len)
              throws IOException

  Write data from an array to the file.

  Parameters:
    `b` - array of output data
    `off` - index in the output array
    `len` - length of data to write
  Returns:
    length of data really written
  Throws:
    `IOException` - if any error occurs.

### positionForWrite

    public void positionForWrite(long offset)
                          throws IOException

  Sets the next write location.

  Parameters:
    `offset` - seek position for next write
  Throws:
    `IOException` - if any error occurs.

### flush

    public void flush()
               throws IOException

  Flushes any output to the file.

  Throws:
    `IOException` - if any error occurs.

### create

    public void create()
                throws IOException

  Description copied from interface: `GCFFile`
  Create file corresponding to this file handler. The file is created immediately on the actual file system upon invocation of this method. Files are created with zero length and data can be put into the file through write method after opening the file.This method does not create any directories specified in the file's path.

  Throws:
    `IOException` - if invoked on the existing file or unexpected error occurs.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"