Class LZMAOutputStream

    • Constructor Detail

      • LZMAOutputStream

        public LZMAOutputStream​(OutputStream out,
                                LZMA2Options options,
                                long inputSize)
                         throws IOException
        Creates a new compressor for the legacy .lzma file format.

        If the uncompressed size of the input data is known, it will be stored in the .lzma header and no end of stream marker will be used. Otherwise the header will indicate unknown uncompressed size and the end of stream marker will be used.

        Note that a preset dictionary cannot be used in .lzma files but it can be used for raw LZMA streams.

        Parameters:
        out - output stream to which the compressed data will be written
        options - LZMA compression options; the same class is used here as is for LZMA2
        inputSize - uncompressed size of the data to be compressed; use -1 when unknown
        Throws:
        IOException - may be thrown from out
      • LZMAOutputStream

        public LZMAOutputStream​(OutputStream out,
                                LZMA2Options options,
                                long inputSize,
                                ArrayCache arrayCache)
                         throws IOException
        Creates a new compressor for the legacy .lzma file format.

        This is identical to LZMAOutputStream(OutputStream, LZMA2Options, long) except that this also takes the arrayCache argument.

        Parameters:
        out - output stream to which the compressed data will be written
        options - LZMA compression options; the same class is used here as is for LZMA2
        inputSize - uncompressed size of the data to be compressed; use -1 when unknown
        arrayCache - cache to be used for allocating large arrays
        Throws:
        IOException - may be thrown from out
        Since:
        1.7
      • LZMAOutputStream

        public LZMAOutputStream​(OutputStream out,
                                LZMA2Options options,
                                boolean useEndMarker)
                         throws IOException
        Creates a new compressor for raw LZMA (also known as LZMA1) stream.

        Raw LZMA streams can be encoded with or without end of stream marker. When decompressing the stream, one must know if the end marker was used and tell it to the decompressor. If the end marker wasn't used, the decompressor will also need to know the uncompressed size.

        Parameters:
        out - output stream to which the compressed data will be written
        options - LZMA compression options; the same class is used here as is for LZMA2
        useEndMarker - if end of stream marker should be written
        Throws:
        IOException - may be thrown from out
      • LZMAOutputStream

        public LZMAOutputStream​(OutputStream out,
                                LZMA2Options options,
                                boolean useEndMarker,
                                ArrayCache arrayCache)
                         throws IOException
        Creates a new compressor for raw LZMA (also known as LZMA1) stream.

        This is identical to LZMAOutputStream(OutputStream, LZMA2Options, boolean) except that this also takes the arrayCache argument.

        Parameters:
        out - output stream to which the compressed data will be written
        options - LZMA compression options; the same class is used here as is for LZMA2
        useEndMarker - if end of stream marker should be written
        arrayCache - cache to be used for allocating large arrays
        Throws:
        IOException - may be thrown from out
        Since:
        1.7
    • Method Detail

      • getProps

        public int getProps()
        Returns the LZMA lc/lp/pb properties encoded into a single byte. This might be useful when handling file formats other than .lzma that use the same encoding for the LZMA properties as .lzma does.
      • getUncompressedSize

        public long getUncompressedSize()
        Gets the amount of uncompressed data written to the stream. This is useful when creating raw LZMA streams without the end of stream marker.