public interface FileRegion
extends io.netty.util.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() |
FileRegion |
retain(int increment) |
FileRegion |
touch() |
FileRegion |
touch(Object hint) |
long |
transfered()
Deprecated.
Use
transferred() instead. |
long |
transferred()
Returns the bytes which was transferred already.
|
long |
transferTo(WritableByteChannel target,
long position)
Transfers the content of this file region to the specified channel.
|
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.IOExceptionFileRegion retain()
retain in interface io.netty.util.ReferenceCountedFileRegion retain(int increment)
retain in interface io.netty.util.ReferenceCountedFileRegion touch()
touch in interface io.netty.util.ReferenceCountedFileRegion touch(Object hint)
touch in interface io.netty.util.ReferenceCountedCopyright © 2008–2025 The Netty Project. All rights reserved.