Module methanol

Interface AsyncDecoder

All Superinterfaces:
AutoCloseable

public interface AsyncDecoder extends AutoCloseable
An object that decompresses ByteBuffer chunks of a compressed stream in a non-blocking manner. An AsyncDecoder is used with a AsyncBodyDecoder to craft an implementation of the BodyDecoder interface.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    A sink of bytes for writing the decompressed stream as ByteBuffer chunks.
    static interface 
    A source of bytes for reading the compressed stream as ByteBuffer chunks.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Releases any resources associated with the decoder.
    void
    Processes whatever data available from the given source, writing decompressed bytes to the given sink.
    Returns this decoder's encoding.
  • Method Details

    • encoding

      String encoding()
      Returns this decoder's encoding.
    • decode

      void decode(AsyncDecoder.ByteSource source, AsyncDecoder.ByteSink sink) throws IOException
      Processes whatever data available from the given source, writing decompressed bytes to the given sink.
      Parameters:
      source - the source of compressed bytes
      sink - the sink of decompressed bytes
      Throws:
      IOException - if an error occurs while decoding
    • close

      void close()
      Releases any resources associated with the decoder. Must be idempotent and thread safe.
      Specified by:
      close in interface AutoCloseable