public class LZMAOutputStream extends FinishableOutputStream
Constructor and Description |
---|
LZMAOutputStream(java.io.OutputStream out,
LZMA2Options options,
boolean useEndMarker)
Creates a new compressor for raw LZMA (also known as LZMA1) stream.
|
LZMAOutputStream(java.io.OutputStream out,
LZMA2Options options,
boolean useEndMarker,
ArrayCache arrayCache)
Creates a new compressor for raw LZMA (also known as LZMA1) stream.
|
LZMAOutputStream(java.io.OutputStream out,
LZMA2Options options,
long inputSize)
Creates a new compressor for the legacy .lzma file format.
|
LZMAOutputStream(java.io.OutputStream out,
LZMA2Options options,
long inputSize,
ArrayCache arrayCache)
Creates a new compressor for the legacy .lzma file format.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Finishes the stream and closes the underlying OutputStream.
|
void |
finish()
Finishes the stream without closing the underlying OutputStream.
|
void |
flush()
Flushing isn't supported and will throw XZIOException.
|
int |
getProps()
Returns the LZMA lc/lp/pb properties encoded into a single byte.
|
long |
getUncompressedSize()
Gets the amount of uncompressed data written to the stream.
|
void |
write(byte[] buf,
int off,
int len) |
void |
write(int b) |
public LZMAOutputStream(java.io.OutputStream out, LZMA2Options options, long inputSize) throws java.io.IOException
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.
out
- output stream to which the compressed data
will be writtenoptions
- LZMA compression options; the same class
is used here as is for LZMA2inputSize
- uncompressed size of the data to be compressed;
use -1
when unknownjava.io.IOException
- may be thrown from out
public LZMAOutputStream(java.io.OutputStream out, LZMA2Options options, long inputSize, ArrayCache arrayCache) throws java.io.IOException
This is identical to
LZMAOutputStream(OutputStream, LZMA2Options, long)
except that this also takes the arrayCache
argument.
out
- output stream to which the compressed data
will be writtenoptions
- LZMA compression options; the same class
is used here as is for LZMA2inputSize
- uncompressed size of the data to be compressed;
use -1
when unknownarrayCache
- cache to be used for allocating large arraysjava.io.IOException
- may be thrown from out
public LZMAOutputStream(java.io.OutputStream out, LZMA2Options options, boolean useEndMarker) throws java.io.IOException
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.
out
- output stream to which the compressed data
will be writtenoptions
- LZMA compression options; the same class
is used here as is for LZMA2useEndMarker
- if end of stream marker should be writtenjava.io.IOException
- may be thrown from out
public LZMAOutputStream(java.io.OutputStream out, LZMA2Options options, boolean useEndMarker, ArrayCache arrayCache) throws java.io.IOException
This is identical to
LZMAOutputStream(OutputStream, LZMA2Options, boolean)
except that this also takes the arrayCache
argument.
out
- output stream to which the compressed data
will be writtenoptions
- LZMA compression options; the same class
is used here as is for LZMA2useEndMarker
- if end of stream marker should be writtenarrayCache
- cache to be used for allocating large arraysjava.io.IOException
- may be thrown from out
public int getProps()
public long getUncompressedSize()
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] buf, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void finish() throws java.io.IOException
finish
in class FinishableOutputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.OutputStream
java.io.IOException