org.apache.mina.core.file
Class DefaultFileRegion

java.lang.Object
  extended by org.apache.mina.core.file.DefaultFileRegion
All Implemented Interfaces:
FileRegion

public class DefaultFileRegion
extends Object
implements FileRegion

TODO Add documentation

Version:
$Rev$, $Date$
Author:
The Apache MINA Project (dev@mina.apache.org)

Constructor Summary
DefaultFileRegion(FileChannel channel)
           
DefaultFileRegion(FileChannel channel, long position, long remainingBytes)
           
 
Method Summary
 FileChannel getFileChannel()
          The open FileChannel from which data will be read to send to remote host.
 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.


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