org.apache.mina.core.file

## Class DefaultFileRegion

- java.lang.Object
- - org.apache.mina.core.file.DefaultFileRegion

- All Implemented Interfaces:
    FileRegion
  Direct Known Subclasses:
    FilenameFileRegion

      public class DefaultFileRegion
      extends Object
      implements FileRegion

  TODO Add documentation
  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultFileRegion(FileChannel channel)`
    `DefaultFileRegion(FileChannel channel, long position, long remainingBytes)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FileChannel` | `getFileChannel()` The open `FileChannel`from which data will be read to send to remote host.``
    `String` | `getFilename()` Provides an absolute filename for the underlying FileChannel.
    `long` | `getPosition()` The current file position from which data will be read.
    `long` | `getRemainingBytes()` The number of bytes remaining to be written from the file to the remote host.
    `long` | `getWrittenBytes()` The total number of bytes already written.
    `void` | `update(long value)` Updates the current file position based on the specified amount.

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

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

- - ### Constructor Detail

    - #### DefaultFileRegion

          public DefaultFileRegion(FileChannel channel)
                            throws IOException

      Throws:
        `IOException`

    - #### DefaultFileRegion

          public DefaultFileRegion(FileChannel channel,
                           long position,
                           long remainingBytes)

  - ### Method Detail

    - #### getWrittenBytes

          public long getWrittenBytes()

      Description copied from interface: `FileRegion`
      The total number of bytes already written.
      Specified by:
        `getWrittenBytes` in interface `FileRegion`
      Returns:
        The total number of bytes already written.

    - #### getRemainingBytes

          public long getRemainingBytes()

      Description copied from interface: `FileRegion`
      The number of bytes remaining to be written from the file to the remote host.
      Specified by:
        `getRemainingBytes` in interface `FileRegion`
      Returns:
        The number of bytes remaining to be written.

    - #### getFileChannel

          public FileChannel getFileChannel()

      Description copied from interface: `FileRegion`
      The open `FileChannel`from which data will be read to send to remote host.``
      Specified by:
        `getFileChannel` in interface `FileRegion`
      Returns:
        An open `FileChannel`.``

    - #### getPosition

          public long getPosition()

      Description copied from interface: `FileRegion`
      The current file position from which data will be read.
      Specified by:
        `getPosition` in interface `FileRegion`
      Returns:
        The current file position.

    - #### update

          public void update(long value)

      Description copied from interface: `FileRegion`
      Updates the current file position based on the specified amount. This increases the value returned by `FileRegion.getPosition()` and `getWrittenBytes` by the given amount and decreases the value returned by `#getCount()` by the given `amount`.
      Specified by:
        `update` in interface `FileRegion`
      Parameters:
        `value` - The new value for the file position.

    - #### getFilename

          public String getFilename()

      Description copied from interface: `FileRegion`
      Provides an absolute filename for the underlying FileChannel.
      Specified by:
        `getFilename` in interface `FileRegion`
      Returns:
        the absolute filename, or `null` if the FileRegion does not know the filename

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.