Module methanol

Interface AsyncDecoder

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface AsyncDecoder
    extends java.lang.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  AsyncDecoder.ByteSink
      A sink of bytes for writing the decompressed stream as ByteBuffer chunks.
      static interface  AsyncDecoder.ByteSource
      A source of bytes for reading the compressed stream as ByteBuffer chunks.
    • Method Detail

      • encoding

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

        void decode​(AsyncDecoder.ByteSource source,
                    AsyncDecoder.ByteSink sink)
             throws java.io.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:
        java.io.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 java.lang.AutoCloseable