Class InflaterSource

java.lang.Object
org.miaixz.bus.core.io.source.InflaterSource
All Implemented Interfaces:
Closeable, AutoCloseable, Source

public final class InflaterSource extends Object implements Source
A source that uses DEFLATE to decompress data read from another source.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Summary

    Constructors
    Constructor
    Description
    InflaterSource(Source source, Inflater inflater)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    关闭此源并释放此源持有的资源.
    long
    read(Buffer sink, long byteCount)
    从中删除至少1个字节,最多为byteCount字节, 并将它们 附加到sink。返回读取的字节数,如果该源已耗尽,则返回-1
    boolean
    Refills the inflater with compressed data if it needs input.
    返回此源的超时时间.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InflaterSource

      public InflaterSource(Source source, Inflater inflater)
  • Method Details

    • read

      public long read(Buffer sink, long byteCount) throws IOException
      Description copied from interface: Source
      从中删除至少1个字节,最多为byteCount字节, 并将它们 附加到sink。返回读取的字节数,如果该源已耗尽,则返回-1
      Specified by:
      read in interface Source
      Parameters:
      sink - 缓冲
      byteCount - 长度大小
      Returns:
      the long
      Throws:
      IOException - IOException IOException.
    • refill

      public boolean refill() throws IOException
      Refills the inflater with compressed data if it needs input. (And only if it needs input). Returns true if the inflater required input but the source was exhausted.
      Throws:
      IOException
    • timeout

      public Timeout timeout()
      Description copied from interface: Source
      返回此源的超时时间.
      Specified by:
      timeout in interface Source
      Returns:
      超时时间
    • close

      public void close() throws IOException
      Description copied from interface: Source
      关闭此源并释放此源持有的资源. 读取闭源是一个错误。多次关闭源是安全的.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Source
      Throws:
      IOException - IOException IOException.