Class FramedLZ4CompressorInputStream

    • Constructor Summary

      Constructors 
      Constructor Description
      FramedLZ4CompressorInputStream​(java.io.InputStream in)
      Creates a new input stream that decompresses streams compressed using the LZ4 frame format and stops after decompressing the first frame.
      FramedLZ4CompressorInputStream​(java.io.InputStream in, boolean decompressConcatenated)
      Creates a new input stream that decompresses streams compressed using the LZ4 frame format.
    • Constructor Detail

      • FramedLZ4CompressorInputStream

        public FramedLZ4CompressorInputStream​(java.io.InputStream in)
                                       throws java.io.IOException
        Creates a new input stream that decompresses streams compressed using the LZ4 frame format and stops after decompressing the first frame.
        Parameters:
        in - the InputStream from which to read the compressed data
        Throws:
        java.io.IOException - if reading fails
      • FramedLZ4CompressorInputStream

        public FramedLZ4CompressorInputStream​(java.io.InputStream in,
                                              boolean decompressConcatenated)
                                       throws java.io.IOException
        Creates a new input stream that decompresses streams compressed using the LZ4 frame format.
        Parameters:
        in - the InputStream from which to read the compressed data
        decompressConcatenated - if true, decompress until the end of the input; if false, stop after the first LZ4 frame and leave the input position to point to the next byte after the frame stream
        Throws:
        java.io.IOException - if reading fails
    • Method Detail

      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Overrides:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • getCompressedCount

        public long getCompressedCount()
        Specified by:
        getCompressedCount in interface InputStreamStatistics
        Returns:
        the amount of raw or compressed bytes read by the stream
        Since:
        1.17
      • matches

        public static boolean matches​(byte[] signature,
                                      int length)
        Checks if the signature matches what is expected for a .lz4 file.

        .lz4 files start with a four byte signature.

        Parameters:
        signature - the bytes to check
        length - the number of bytes to check
        Returns:
        true if this is a .sz stream, false otherwise