public interface RecordSerializer<T extends IOReadableWritable>
Modifier and Type | Interface and Description |
---|---|
static class |
RecordSerializer.SerializationResult |
Modifier and Type | Method and Description |
---|---|
RecordSerializer.SerializationResult |
addRecord(T record)
Starts serializing and copying the given record to the target buffer
(if available).
|
void |
clear()
Resets the target buffer to null and resets internal state set
up for the record to serialize.
|
void |
clearCurrentBuffer()
Resets the target buffer to null.
|
Buffer |
getCurrentBuffer()
Retrieves the current target buffer and sets its size to the actual
number of written bytes.
|
boolean |
hasData()
Determines whether data is left, either in the current target buffer or
in any internal state set up for the record to serialize.
|
void |
instantiateMetrics(TaskIOMetricGroup metrics)
Instantiates all metrics.
|
RecordSerializer.SerializationResult |
setNextBuffer(Buffer buffer)
Sets a (next) target buffer to use and continues writing remaining data
to it until it is full.
|
RecordSerializer.SerializationResult addRecord(T record) throws IOException
record
- the record to serializeIOException
RecordSerializer.SerializationResult setNextBuffer(Buffer buffer) throws IOException
buffer
- the new target buffer to useIOException
Buffer getCurrentBuffer()
setNextBuffer(Buffer)
).void clearCurrentBuffer()
NOTE: After calling this method, a new target
buffer is required to continue writing (see
setNextBuffer(Buffer)
).
void clear()
NOTE: After calling this method, a new record
and a new target buffer is required to start writing again
(see setNextBuffer(Buffer)
). If you want to continue
with the current record, use clearCurrentBuffer()
instead.
boolean hasData()
void instantiateMetrics(TaskIOMetricGroup metrics)
metrics
- metric groupCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.