public class CollectionReader<T> extends DataReader<T>
DataReader implementation that can be used to
serve items from a Collection (or Iterator).
Note that implementation of estimateSizeInBytes(T) is
naive and returns 1 for all items; it must be redefined if
memory limits are to be enforced, or alternatively
Sorter should be configured with maximum number of
items to use as memory limit.| Constructor and Description |
|---|
CollectionReader(Collection<T> items) |
CollectionReader(Iterator<T> items) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method for closing the reader.
|
int |
estimateSizeInBytes(T item)
Method that should estimate memory usage of given item, for purpose
of limiting amount of data kept in memory during pre-sorting phase.
|
T |
readNext()
Method for reading the next data item; will return
null to indicate end of input, otherwise return a non-null
item.
|
public CollectionReader(Collection<T> items)
public T readNext()
DataReaderreadNext in class DataReader<T>public int estimateSizeInBytes(T item)
DataReaderestimateSizeInBytes in class DataReader<T>public void close()
throws IOException
DataReaderclose in class DataReader<T>IOExceptionCopyright © 2012-2014 FasterXML. All Rights Reserved.