Package org.apache.hadoop.io.compress
Class CompressorStream
java.lang.Object
java.io.OutputStream
org.apache.hadoop.io.compress.CompressionOutputStream
org.apache.hadoop.io.compress.CompressorStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,org.apache.hadoop.fs.statistics.IOStatisticsSource
- Direct Known Subclasses:
BlockCompressorStream
-
Field Summary
FieldsFields inherited from class org.apache.hadoop.io.compress.CompressionOutputStream
out -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAllow derived classes to directly set the underlying stream.CompressorStream(OutputStream out, Compressor compressor) CompressorStream(OutputStream out, Compressor compressor, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidcompress()voidfinish()Finishes writing compressed data to the output stream without closing the underlying stream.voidReset the compression to the initial state.voidwrite(byte[] b, int off, int len) Write compressed bytes to the stream.voidwrite(int b) Methods inherited from class org.apache.hadoop.io.compress.CompressionOutputStream
flush, getIOStatisticsMethods inherited from class java.io.OutputStream
nullOutputStream, write
-
Field Details
-
compressor
-
buffer
protected byte[] buffer -
closed
protected boolean closed
-
-
Constructor Details
-
CompressorStream
-
CompressorStream
-
CompressorStream
Allow derived classes to directly set the underlying stream.- Parameters:
out- Underlying output stream.
-
-
Method Details
-
write
Description copied from class:CompressionOutputStreamWrite compressed bytes to the stream. Made abstract to prevent leakage to underlying stream.- Specified by:
writein classCompressionOutputStream- Throws:
IOException
-
compress
- Throws:
IOException
-
finish
Description copied from class:CompressionOutputStreamFinishes writing compressed data to the output stream without closing the underlying stream.- Specified by:
finishin classCompressionOutputStream- Throws:
IOException- raised on errors performing I/O.
-
resetState
Description copied from class:CompressionOutputStreamReset the compression to the initial state. Does not reset the underlying stream.- Specified by:
resetStatein classCompressionOutputStream- Throws:
IOException- raised on errors performing I/O.
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classCompressionOutputStream- Throws:
IOException
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-