T - public class SpanningRecordSerializer<T extends IOReadableWritable> extends Object implements RecordSerializer<T>
setNextBuffer(Buffer).RecordSerializer.SerializationResult| Constructor and Description |
|---|
SpanningRecordSerializer() |
| Modifier and Type | Method and Description |
|---|---|
RecordSerializer.SerializationResult |
addRecord(T record)
Serializes the complete record to an intermediate data serialization
buffer and starts copying it 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.
|
public RecordSerializer.SerializationResult addRecord(T record) throws IOException
addRecord in interface RecordSerializer<T extends IOReadableWritable>record - the record to serializeIOExceptionpublic RecordSerializer.SerializationResult setNextBuffer(Buffer buffer) throws IOException
RecordSerializersetNextBuffer in interface RecordSerializer<T extends IOReadableWritable>buffer - the new target buffer to useIOExceptionpublic Buffer getCurrentBuffer()
RecordSerializerRecordSerializer.setNextBuffer(Buffer)).getCurrentBuffer in interface RecordSerializer<T extends IOReadableWritable>public void clearCurrentBuffer()
RecordSerializerNOTE: After calling this method, a new target
buffer is required to continue writing (see
RecordSerializer.setNextBuffer(Buffer)).
clearCurrentBuffer in interface RecordSerializer<T extends IOReadableWritable>public void clear()
RecordSerializerNOTE: After calling this method, a new record
and a new target buffer is required to start writing again
(see RecordSerializer.setNextBuffer(Buffer)). If you want to continue
with the current record, use RecordSerializer.clearCurrentBuffer() instead.
clear in interface RecordSerializer<T extends IOReadableWritable>public boolean hasData()
RecordSerializerhasData in interface RecordSerializer<T extends IOReadableWritable>public void instantiateMetrics(TaskIOMetricGroup metrics)
RecordSerializerinstantiateMetrics in interface RecordSerializer<T extends IOReadableWritable>metrics - metric groupCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.