Class NoCompressionBulkWriter<T>
- java.lang.Object
-
- org.apache.flink.formats.compress.writers.NoCompressionBulkWriter<T>
-
- Type Parameters:
T
- The type of element to write.
- All Implemented Interfaces:
BulkWriter<T>
public class NoCompressionBulkWriter<T> extends Object implements BulkWriter<T>
ABulkWriter
implementation that does not compress data. This is essentially a no-op writer for use withCompressWriterFactory
for the case that no compression codec is specified.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.api.common.serialization.BulkWriter
BulkWriter.Factory<T>
-
-
Constructor Summary
Constructors Constructor Description NoCompressionBulkWriter(FSDataOutputStream outputStream, Extractor<T> extractor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addElement(T element)
Adds an element to the encoder.void
finish()
Finishes the writing.void
flush()
Flushes all intermediate buffered data to the output stream.
-
-
-
Constructor Detail
-
NoCompressionBulkWriter
public NoCompressionBulkWriter(FSDataOutputStream outputStream, Extractor<T> extractor)
-
-
Method Detail
-
addElement
public void addElement(T element) throws IOException
Description copied from interface:BulkWriter
Adds an element to the encoder. The encoder may temporarily buffer the element, or immediately write it to the stream.It may be that adding this element fills up an internal buffer and causes the encoding and flushing of a batch of internally buffered elements.
- Specified by:
addElement
in interfaceBulkWriter<T>
- Parameters:
element
- The element to add.- Throws:
IOException
- Thrown, if the element cannot be added to the encoder, or if the output stream throws an exception.
-
flush
public void flush() throws IOException
Description copied from interface:BulkWriter
Flushes all intermediate buffered data to the output stream. It is expected that flushing often may reduce the efficiency of the encoding.- Specified by:
flush
in interfaceBulkWriter<T>
- Throws:
IOException
- Thrown if the encoder cannot be flushed, or if the output stream throws an exception.
-
finish
public void finish() throws IOException
Description copied from interface:BulkWriter
Finishes the writing. This must flush all internal buffer, finish encoding, and write footers.The writer is not expected to handle any more records via
BulkWriter.addElement(Object)
after this method is called.Important: This method MUST NOT close the stream that the writer writes to. Closing the stream is expected to happen through the invoker of this method afterwards.
- Specified by:
finish
in interfaceBulkWriter<T>
- Throws:
IOException
- Thrown if the finalization fails.
-
-