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
- Author:
- Phillip Webb
-
Method Summary
Modifier and TypeMethodDescriptiondefault InputStream
Return thisDataBlock
as anInputStream
.int
read
(ByteBuffer dst, long pos) Read a sequence of bytes from this channel into the given buffer, starting at the given block position.default void
readFully
(ByteBuffer dst, long pos) Fully read a sequence of bytes from this channel into the given buffer, starting at the given block position and fillingremaining
bytes in the buffer.long
size()
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
-1
if 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 fillingremaining
bytes 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 thisDataBlock
as anInputStream
.- Returns:
- an
InputStream
to read the data block content - Throws:
IOException
- on IO error
-