接口 DataBlock

所有已知子接口:
CloseableDataBlock

public interface DataBlock
Provides read access to a block of data contained somewhere in a zip file.
从以下版本开始:
3.2.0
作者:
Phillip Webb
  • 方法概要

    修饰符和类型
    方法
    说明
    default InputStream
    Return this DataBlock as an InputStream.
    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 filling remaining bytes in the buffer.
    long
    Return the size of this block.
  • 方法详细资料

    • size

      long size() throws IOException
      Return the size of this block.
      返回:
      the block size
      抛出:
      IOException - on I/O error
    • read

      int read(ByteBuffer dst, long pos) throws IOException
      Read a sequence of bytes from this channel into the given buffer, starting at the given block position.
      参数:
      dst - the buffer into which bytes are to be transferred
      pos - the position within the block at which the transfer is to begin
      返回:
      the number of bytes read, possibly zero, or -1 if the given position is greater than or equal to the block size
      抛出:
      IOException - on I/O error
      另请参阅:
    • readFully

      default void readFully(ByteBuffer dst, long pos) throws IOException
      Fully read a sequence of bytes from this channel into the given buffer, starting at the given block position and filling remaining bytes in the buffer.
      参数:
      dst - the buffer into which bytes are to be transferred
      pos - the position within the block at which the transfer is to begin
      抛出:
      EOFException - if an attempt is made to read past the end of the block
      IOException - on I/O error
    • asInputStream

      default InputStream asInputStream() throws IOException
      Return this DataBlock as an InputStream.
      返回:
      an InputStream to read the data block content
      抛出:
      IOException - on IO error