Package com.aspose.zip
Class FastLZOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- com.aspose.zip.FastLZOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class FastLZOutputStream extends OutputStream
A stream wrapper that compresses data with FastLZ. Implements decorator pattern.
-
-
Constructor Summary
Constructors Constructor Description FastLZOutputStream(OutputStream stream, int compressionLevel)Initializes a new instance of theFastLZStreamclass prepared for compression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.voidflush()Clears all buffers for this stream and causes any buffered data to be written to the underlying device.voidwrite(byte[] buffer, int offset, int count)Writes a sequence of bytes to the compressing stream and advances the current position within this stream by the number of bytes written.voidwrite(int b)Writes the specified byte to this output stream.-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
FastLZOutputStream
public FastLZOutputStream(OutputStream stream, int compressionLevel)
Initializes a new instance of the
FastLZStreamclass prepared for compression.- Parameters:
stream- the stream for saving compressed datacompressionLevel- use 1 for faster compression, use 2 for better compression ratio- Throws:
com.aspose.ms.System.ArgumentNullException-streamis null.com.aspose.ms.System.ArgumentException-streamdoes not support writing.com.aspose.ms.System.ArgumentOutOfRangeException-compressionLevelis more than 2 or less than 1.
-
-
Method Detail
-
write
public void write(int b)
Writes the specified byte to this output stream. The general contract forwriteis that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argumentb. The 24 high-order bits ofbare ignored.- Specified by:
writein classOutputStream- Parameters:
b- thebyte
-
write
public void write(byte[] buffer, int offset, int count)Writes a sequence of bytes to the compressing stream and advances the current position within this stream by the number of bytes written.
- Overrides:
writein classOutputStream- Parameters:
buffer- an array of bytes. This method copies count bytes from buffer to the current streamoffset- the zero-based byte offset in buffer at which to begin copying bytes to the current streamcount- the number of bytes to be written to the current stream
-
flush
public void flush()
Clears all buffers for this stream and causes any buffered data to be written to the underlying device.
- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream
-
close
public void close()
Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
-