FileRegion implementation which transfer data from a FileChannel or File.
Be aware that the FileChannel will be automatically closed once refCnt() returns
0.
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final File | |
| private FileChannel | |
| private static final InternalLogger | |
| private final long | |
| private long |
| Access | Constructor and Description |
|---|---|
| public | DefaultFileRegion(FileChannel
the file, long FileChannel which should be transferredthe position from which the transfer should start position, long the number of bytes to transfer count)Create a new instance |
| public | DefaultFileRegion(File
the f, long File which should be transferredthe position from which the transfer should start position, long the number of bytes to transfer count)Create a new instance using the given |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| protected void | deallocate()
Implements abstract io. refCnt() is equals 0.
|
| public boolean | |
| public void | |
| public long | position()
Implements io. |
| public FileRegion | retain()
Overrides io. Implements io. 1.
|
| public FileRegion | retain(int increment)
Overrides io. Implements io. increment.
|
| public FileRegion | touch()
Overrides io. Implements io. |
| public FileRegion | touch(Object hint)
Implements io. |
| public long | transferred()
Implements io. |
| public long | transferTo(WritableByteChannel
the destination of the transfer target, long the relative offset of the file where the transfer
begins from. For example, 0 will make the
transfer start from position)position()th byte and
count() - 1 will make the last
byte of the region transferred.Implements io. |
| pack-priv static void |
| count | back to summary |
|---|---|
| private final long count | |
| f | back to summary |
|---|---|
| private final File f | |
| file | back to summary |
|---|---|
| private FileChannel file | |
| logger | back to summary |
|---|---|
| private static final InternalLogger logger | |
| position | back to summary |
|---|---|
| private final long position | |
| transferred | back to summary |
|---|---|
| private long transferred | |
| DefaultFileRegion | back to summary |
|---|---|
| public DefaultFileRegion(FileChannel file, long position, long count) Create a new instance
| |
| DefaultFileRegion | back to summary |
|---|---|
| public DefaultFileRegion(File f, long position, long count) Create a new instance using the given | |
| count | back to summary |
|---|---|
| public long count() Implements io. Doc from io. Returns the number of bytes to transfer.
| |
| deallocate | back to summary |
|---|---|
| protected void deallocate() Implements abstract io. Doc from io. Called once
| |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Returns | |
| open | back to summary |
|---|---|
| public void open() throws IOException Explicitly open the underlying file-descriptor if not done yet. | |
| position | back to summary |
|---|---|
| public long position() Implements io. Doc from io. Returns the offset in the file where the transfer began.
| |
| retain | back to summary |
|---|---|
| public FileRegion retain() Overrides io. Implements io. Doc from io. Increases the reference count by
| |
| retain | back to summary |
|---|---|
| public FileRegion retain(int increment) Overrides io. Implements io. Doc from io. Increases the reference count by the specified
| |
| touch | back to summary |
|---|---|
| public FileRegion touch() Overrides io. Implements io. Doc from io. Records the current access location of this object for debugging purposes.
If this object is determined to be leaked, the information recorded by this operation will be provided to you
via
| |
| touch | back to summary |
|---|---|
| public FileRegion touch(Object hint) Implements io. Doc from io. Records the current access location of this object with an additional arbitrary information for debugging
purposes. If this object is determined to be leaked, the information recorded by this operation will be
provided to you via
| |
| transferred | back to summary |
|---|---|
| public long transferred() Implements io. Doc from io. Returns the bytes which was transferred already.
| |
| transferTo | back to summary |
|---|---|
| public long transferTo(WritableByteChannel target, long position) throws IOException Implements io. Doc from io. Transfers the content of this file region to the specified channel.
| |
| validate | back to summary |
|---|---|
| pack-priv static void validate(DefaultFileRegion region, long position) throws IOException | |