com.fasterxml.sort.DataReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-merge-sort Show documentation
Show all versions of java-merge-sort Show documentation
Basic configurable disk-backed N-way merge sort
package com.fasterxml.sort;
import java.io.IOException;
public abstract class DataReader
{
/**
* Method for reading the next data item; will return
* null to indicate end of input, otherwise return a non-null
* item.
*/
public abstract T readNext() throws IOException;
/**
* Method that should estimate memory usage of given item, for purpose
* of limiting amount of data kept in memory during pre-sorting phase.
*/
public abstract int estimateSizeInBytes(T item);
/**
* Method for closing the reader. Note that reader needs to ensure
* that it is ok to call close multiple times. Reader may also
* close underlying resources as soon as it has reached end of input.
*/
public abstract void close() throws IOException;
}