ChunkedInput that fetches data from a file chunk by chunk.
If your operating system supports
zero-copy file transfer
such as sendfile(), you might want to use FileRegion instead.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final long | |
| private final RandomAccessFile | |
| private long | |
| private final long |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ChunkedFile(File file, int
the number of bytes to fetch on each
chunkSize)readChunk(ChannelHandlerContext) callCreates a new instance that fetches data from the specified file. |
| public | |
| public | ChunkedFile(RandomAccessFile file, int
the number of bytes to fetch on each
chunkSize)readChunk(ChannelHandlerContext) callCreates a new instance that fetches data from the specified file. |
| public | ChunkedFile(RandomAccessFile file, long
the offset of the file where the transfer begins offset, long the number of bytes to transfer length, int the number of bytes to fetch on each
chunkSize)readChunk(ChannelHandlerContext) callCreates a new instance that fetches data from the specified file. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements io. |
| public long | |
| public long | |
| public boolean | isEndOfInput()
Implements io. true if and only if there is no data left in the stream
and the stream has reached at its end.
|
| public long | |
| public long | progress()
Implements io. |
| public ByteBuf | readChunk(ChannelHandlerContext
The context which provides a ctx)ByteBufAllocator if buffer allocation is necessary.Implements io.
Deprecated
|
| public ByteBuf | readChunk(ByteBufAllocator
ByteBufAllocator if buffer allocation is necessary.Implements io. |
| public long |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| endOffset | back to summary |
|---|---|
| private final long endOffset | |
| file | back to summary |
|---|---|
| private final RandomAccessFile file | |
| offset | back to summary |
|---|---|
| private long offset | |
| startOffset | back to summary |
|---|---|
| private final long startOffset | |
| ChunkedFile | back to summary |
|---|---|
| public ChunkedFile(File file) throws IOException Creates a new instance that fetches data from the specified file. | |
| ChunkedFile | back to summary |
|---|---|
| public ChunkedFile(File file, int chunkSize) throws IOException Creates a new instance that fetches data from the specified file.
| |
| ChunkedFile | back to summary |
|---|---|
| public ChunkedFile(RandomAccessFile file) throws IOException Creates a new instance that fetches data from the specified file. | |
| ChunkedFile | back to summary |
|---|---|
| public ChunkedFile(RandomAccessFile file, int chunkSize) throws IOException Creates a new instance that fetches data from the specified file.
| |
| ChunkedFile | back to summary |
|---|---|
| public ChunkedFile(RandomAccessFile file, long offset, long length, int chunkSize) throws IOException Creates a new instance that fetches data from the specified file.
| |
| close | back to summary |
|---|---|
| public void close() throws Exception Implements io. Doc from io. Releases the resources associated with the input.
| |
| currentOffset | back to summary |
|---|---|
| public long currentOffset() Returns the offset in the file where the transfer is happening currently. | |
| endOffset | back to summary |
|---|---|
| public long endOffset() Returns the offset in the file where the transfer will end. | |
| isEndOfInput | back to summary |
|---|---|
| public boolean isEndOfInput() throws Exception Implements io. Doc from io. Return
| |
| length | back to summary |
|---|---|
| public long length() Implements io. Doc from io. Returns the length of the input.
| |
| progress | back to summary |
|---|---|
| public long progress() Implements io. Doc from io. Returns current transfer progress.
| |
| readChunk | back to summary |
|---|---|
| public ByteBuf readChunk(ChannelHandlerContext ctx) throws Exception Implements io. Deprecated
| |
| readChunk | back to summary |
|---|---|
| public ByteBuf readChunk(ByteBufAllocator allocator) throws Exception Implements io. Doc from io. Fetches a chunked data from the stream. Once this method returns the last chunk
and thus the stream has reached at its end, any subsequent
| |
| startOffset | back to summary |
|---|---|
| public long startOffset() Returns the offset in the file where the transfer began. | |