Class DeflateCompressor

java.lang.Object
org.opensearch.common.compress.DeflateCompressor
All Implemented Interfaces:
org.opensearch.core.compress.Compressor

public class DeflateCompressor extends Object implements org.opensearch.core.compress.Compressor
Compressor implementation based on the DEFLATE compression algorithm.
Opensearch.api:
- registered name requires BWC support
Opensearch.experimental:
- class methods might change
  • Field Details

    • NAME

      @PublicApi(since="2.10.0") public static String NAME
      The name to register the compressor by
      Opensearch.api:
      - requires BWC support
  • Constructor Details

    • DeflateCompressor

      public DeflateCompressor()
  • Method Details

    • isCompressed

      public boolean isCompressed(org.opensearch.core.common.bytes.BytesReference bytes)
      Specified by:
      isCompressed in interface org.opensearch.core.compress.Compressor
    • headerLength

      public int headerLength()
      Specified by:
      headerLength in interface org.opensearch.core.compress.Compressor
    • threadLocalInputStream

      public InputStream threadLocalInputStream(InputStream in) throws IOException
      Specified by:
      threadLocalInputStream in interface org.opensearch.core.compress.Compressor
      Throws:
      IOException
    • inputStream

      public static InputStream inputStream(InputStream in, boolean threadLocal) throws IOException
      Creates a new input stream that decompresses the contents read from the provided input stream. Closing the returned stream will close the provided input stream. Optionally uses thread-local, pooled resources to save off-heap allocations if the stream is guaranteed to not escape the current thread.
      Parameters:
      in - input stream to wrap
      threadLocal - whether this stream will only be used on the current thread or not
      Returns:
      decompressing stream
      Throws:
      IOException
    • threadLocalOutputStream

      public OutputStream threadLocalOutputStream(OutputStream out) throws IOException
      Specified by:
      threadLocalOutputStream in interface org.opensearch.core.compress.Compressor
      Throws:
      IOException
    • uncompress

      public org.opensearch.core.common.bytes.BytesReference uncompress(org.opensearch.core.common.bytes.BytesReference bytesReference) throws IOException
      Specified by:
      uncompress in interface org.opensearch.core.compress.Compressor
      Throws:
      IOException
    • compress

      public org.opensearch.core.common.bytes.BytesReference compress(org.opensearch.core.common.bytes.BytesReference bytesReference) throws IOException
      Specified by:
      compress in interface org.opensearch.core.compress.Compressor
      Throws:
      IOException