|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface FileRegion
A region of a file that is sent via a Channel
which supports
zero-copy file transfer.
FileChannel.transferTo(long, long, WritableByteChannel)
has at least
four known bugs in the old versions of Sun JDK and perhaps its derived ones.
Please upgrade your JDK to 1.6.0_18 or later version if you are going to use
zero-copy file transfer.
FileRegion
might fail or yield worse
performance. For example, sending a large file doesn't work well in Windows.
FileRegion
.
Attempting to write a FileRegion
to non-NIO Channel
will trigger
a ClassCastException
or a similar exception.
Method Summary | |
---|---|
long |
getCount()
Returns the number of bytes to transfer. |
long |
getPosition()
Returns the offset in the file where the transfer began. |
long |
transferTo(WritableByteChannel target,
long position)
Transfers the content of this file region to the specified channel. |
Methods inherited from interface org.jboss.netty.util.ExternalResourceReleasable |
---|
releaseExternalResources |
Method Detail |
---|
long getPosition()
long getCount()
long transferTo(WritableByteChannel target, long position) throws IOException
target
- the destination of the transferposition
- the relative offset of the file where the transfer
begins from. For example, 0 will make the
transfer start from getPosition()
th byte and
getCount()
- 1 will make the last
byte of the region transferred.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |