Interface DataBlock
- All Known Subinterfaces:
CloseableDataBlock
public interface DataBlock
Provides read access to a block of data contained somewhere in a zip file.
- Since:
- 3.2.0
-
Method Summary
Modifier and TypeMethodDescriptiondefault InputStreamReturn thisDataBlockas anInputStream.intread(ByteBuffer dst, long pos) Read a sequence of bytes from this channel into the given buffer, starting at the given block position.default voidreadFully(ByteBuffer dst, long pos) Fully read a sequence of bytes from this channel into the given buffer, starting at the given block position and fillingremainingbytes in the buffer.longsize()Return the size of this block.
-
Method Details
-
size
Return the size of this block.- Returns:
- the block size
- Throws:
IOException- on I/O error
-
read
Read a sequence of bytes from this channel into the given buffer, starting at the given block position.- Parameters:
dst- the buffer into which bytes are to be transferredpos- the position within the block at which the transfer is to begin- Returns:
- the number of bytes read, possibly zero, or
-1if the given position is greater than or equal to the block size - Throws:
IOException- on I/O error- See Also:
-
readFully
Fully read a sequence of bytes from this channel into the given buffer, starting at the given block position and fillingremainingbytes in the buffer.- Parameters:
dst- the buffer into which bytes are to be transferredpos- the position within the block at which the transfer is to begin- Throws:
EOFException- if an attempt is made to read past the end of the blockIOException- on I/O error
-
asInputStream
Return thisDataBlockas anInputStream.- Returns:
- an
InputStreamto read the data block content - Throws:
IOException- on IO error
-