public class DefaultFileRegion extends Object implements FileRegion
| Constructor and Description |
|---|
DefaultFileRegion(FileChannel channel)
Creates a new DefaultFileRegion instance
|
DefaultFileRegion(FileChannel channel,
long position,
long remainingBytes)
Creates a new DefaultFileRegion instance
|
| 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.
|
public DefaultFileRegion(FileChannel channel) throws IOException
channel - The channel mapped over the fileIOException - If we had an IO errorpublic DefaultFileRegion(FileChannel channel, long position, long remainingBytes)
channel - The channel mapped over the fileposition - The position in teh fileremainingBytes - The remaining bytespublic long getWrittenBytes()
getWrittenBytes in interface FileRegionpublic long getRemainingBytes()
getRemainingBytes in interface FileRegionpublic FileChannel getFileChannel()
FileChannel from which data will be read to send to
remote host.getFileChannel in interface FileRegionFileChannel.public long getPosition()
getPosition in interface FileRegionpublic void update(long value)
FileRegion.getPosition() and
FileRegion.getWrittenBytes() by the given amount and decreases the value
returned by FileRegion.getRemainingBytes() by the given amount.update in interface FileRegionvalue - The new value for the file position.public String getFilename()
getFilename in interface FileRegionnull if the FileRegion
does not know the filenameCopyright © 2004–2024 Apache MINA Project. All rights reserved.