T
- The type of the elements encoded through this encoder.@PublicEvolving public interface BulkWriter<T>
Examples for bulk encoding are most compressed formats, including formats like Parquet and ORC which encode batches of records into blocks of column vectors.
The bulk encoder may be stateful and is bound to a single stream during its lifetime.
Modifier and Type | Interface and Description |
---|---|
static interface |
BulkWriter.Factory<T>
A factory that creates a
BulkWriter . |
Modifier and Type | Method and 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.
|
void addElement(T element) throws IOException
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.
element
- The element to add.IOException
- Thrown, if the element cannot be added to the encoder, or if the output
stream throws an exception.void flush() throws IOException
IOException
- Thrown if the encoder cannot be flushed, or if the output stream throws
an exception.void finish() throws IOException
The writer is not expected to handle any more records via 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.
IOException
- Thrown if the finalization fails.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.