@PublicEvolving public class CollectionInputFormat<T> extends GenericInputFormat<T> implements NonParallelInput
partitionNumber
Constructor and Description |
---|
CollectionInputFormat(Collection<T> dataSet,
TypeSerializer<T> serializer) |
Modifier and Type | Method and Description |
---|---|
static <X> void |
checkCollection(Collection<X> elements,
Class<X> viewedAs) |
T |
nextRecord(T record)
Reads the next record from the input.
|
void |
open(GenericInputSplit split)
Opens a parallel instance of the input format to work on a split.
|
boolean |
reachedEnd()
Method used to check if the end of the input is reached.
|
String |
toString() |
close, configure, createInputSplits, getInputSplitAssigner, getStatistics
closeInputFormat, getRuntimeContext, openInputFormat, setRuntimeContext
public CollectionInputFormat(Collection<T> dataSet, TypeSerializer<T> serializer)
public boolean reachedEnd() throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
reachedEnd
in interface InputFormat<T,GenericInputSplit>
IOException
- Thrown, if an I/O error occurred.public void open(GenericInputSplit split) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be configured.
open
in interface InputFormat<T,GenericInputSplit>
open
in class GenericInputFormat<T>
split
- The split to be opened.IOException
- Thrown, if the spit could not be opened due to an I/O problem.public T nextRecord(T record) throws IOException
InputFormat
When this method is called, the input format it guaranteed to be opened.
nextRecord
in interface InputFormat<T,GenericInputSplit>
record
- Object that may be reused.IOException
- Thrown, if an I/O error occurred.public static <X> void checkCollection(Collection<X> elements, Class<X> viewedAs)
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.