use of org.apache.flink.runtime.io.network.api.serialization.RecordDeserializer in project flink by apache.
the class StreamMockEnvironment method addBufferToOutputList.
/**
* Adds the object behind the given <tt>buffer</tt> to the <tt>outputList</tt>.
*
* @param recordDeserializer de-serializer to use for the buffer
* @param delegate de-serialization delegate to use for non-event buffers
* @param buffer the buffer to add
* @param outputList the output list to add the object to
* @param <T> type of the objects behind the non-event buffers
*
* @throws java.io.IOException
*/
private <T> void addBufferToOutputList(RecordDeserializer<DeserializationDelegate<T>> recordDeserializer, NonReusingDeserializationDelegate<T> delegate, Buffer buffer, final Queue<Object> outputList) throws java.io.IOException {
if (buffer.isBuffer()) {
recordDeserializer.setNextBuffer(buffer);
while (recordDeserializer.hasUnfinishedData()) {
RecordDeserializer.DeserializationResult result = recordDeserializer.getNextRecord(delegate);
if (result.isFullRecord()) {
outputList.add(delegate.getInstance());
}
if (result == RecordDeserializer.DeserializationResult.LAST_RECORD_FROM_BUFFER || result == RecordDeserializer.DeserializationResult.PARTIAL_RECORD) {
break;
}
}
} else {
// is event
AbstractEvent event = EventSerializer.fromBuffer(buffer, getClass().getClassLoader());
outputList.add(event);
}
}
Aggregations