接口 PeekableItemReader<T>
- 所有超级接口:
ItemReader<T>
- 所有已知实现类:
SingleItemPeekableItemReader
public interface PeekableItemReader<T> extends ItemReader<T>
A specialisation of
ItemReader
that allows the user to look ahead into the stream of items. This is useful, for instance, when reading flat file data that contains record separator lines which are actually part of the next record.The detailed contract for
peek()
has to be defined by the implementation because there is no general way to define it in a concurrent environment. The definition of "the next read()" operation is tenuous if multiple clients are reading concurrently, and the ability to peek implies that some state is likely to be stored, so implementations ofPeekableItemReader
may well be restricted to single threaded use.- 作者:
- Dave Syer, Mahmoud Ben Hassine
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 T
peek()
Get the next item that would be returned byItemReader.read()
, without affecting the result ofItemReader.read()
.从接口继承的方法 org.springframework.batch.item.ItemReader
read
方法详细资料
peek
@Nullable T peek() throws java.lang.Exception, UnexpectedInputException, ParseException
Get the next item that would be returned byItemReader.read()
, without affecting the result ofItemReader.read()
.- 返回:
- the next item or
null
if the data source is exhausted - 抛出:
java.lang.Exception
- if there is a problemUnexpectedInputException
ParseException