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 FileRegion
public long getRemainingBytes()
getRemainingBytes
in interface FileRegion
public FileChannel getFileChannel()
getFileChannel
in interface FileRegion
public long getPosition()
getPosition
in interface FileRegion
public 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 FileRegion
value
- The new value for the file position.public String getFilename()
getFilename
in interface FileRegion
Copyright © 2004–2021 Apache MINA Project. All rights reserved.