Class ReuseBuffersLZ4BlockOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
org.elasticsearch.transport.ReuseBuffersLZ4BlockOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class ReuseBuffersLZ4BlockOutputStream extends FilterOutputStream
This file is forked from https://github.com/lz4/lz4-java. In particular it forks the following file net.jpountz.lz4.LZ4BlockOutputStream. It modifies the original lz4-java code to allow the reuse of local thread local byte arrays. This prevents the need to allocate two new byte arrays everytime a new stream is created. For the Elasticsearch use case, a single thread should fully compress the stream in one go to avoid memory corruption. Additionally, it does not checksum (or write a check) for the data compressed. We do not read the checksum when decompressing in Elasticsearch. Streaming LZ4 (not compatible with the LZ4 Frame format). This class compresses data into fixed-size blocks of compressed data. This class uses its own format and is not compatible with the LZ4 Frame format. For interoperability with other LZ4 tools, use LZ4FrameOutputStream, which is compatible with the LZ4 Frame format. This class remains for backward compatibility.
See Also:
  • LZ4BlockInputStream
  • LZ4FrameOutputStream