public interface FileRegion extends ReferenceCounted
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.
Modifier and Type | Method and Description |
---|---|
long |
count()
Returns the number of bytes to transfer.
|
long |
position()
Returns the offset in the file where the transfer began.
|
FileRegion |
retain()
Increases the reference count by
1 . |
FileRegion |
retain(int increment)
Increases the reference count by the specified
increment . |
FileRegion |
touch()
Records the current access location of this object for debugging purposes.
|
FileRegion |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
long |
transfered()
Deprecated.
Use
transferred() instead. |
long |
transferred()
Returns the bytes which was transfered already.
|
long |
transferTo(WritableByteChannel target,
long position)
Transfers the content of this file region to the specified channel.
|
refCnt, release, release
long position()
@Deprecated long transfered()
transferred()
instead.long transferred()
long count()
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 position()
th byte and
count()
- 1 will make the last
byte of the region transferred.IOException
FileRegion retain()
ReferenceCounted
1
.retain
in interface ReferenceCounted
FileRegion retain(int increment)
ReferenceCounted
increment
.retain
in interface ReferenceCounted
FileRegion touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ReferenceCounted
FileRegion touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
in interface ReferenceCounted
Copyright © 2008–2017 The Netty Project. All rights reserved.