Package org.aksw.commons.io.input
Class ReadableChannelWithConditionalBound<A,X extends ReadableChannel<A>>
java.lang.Object
org.aksw.commons.util.closeable.AutoCloseableWrapperBase<T>
org.aksw.commons.io.shared.ChannelDecoratorBase<X>
org.aksw.commons.io.input.ReadableChannelDecoratorBase<A,X>
org.aksw.commons.io.input.ReadableChannelWithCounter<A,X>
org.aksw.commons.io.input.ReadableChannelWithConditionalBound<A,X>
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,HasArrayOps<A>,ReadableChannel<A>,ReadableSource<A>
public class ReadableChannelWithConditionalBound<A,X extends ReadableChannel<A>>
extends ReadableChannelWithCounter<A,X>
Readable channel wrapper that before every read checks for an
end-of-file (eof) condition.
Once true, any subsequent read immediately returns -1 (eof).
Used to prevent reading across hadoop split boundaries
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Predicate<? super ReadableChannelWithConditionalBound<A,X>> Fields inherited from class org.aksw.commons.io.input.ReadableChannelWithCounter
countFields inherited from class org.aksw.commons.util.closeable.AutoCloseableWrapperBase
delegate -
Constructor Summary
ConstructorsConstructorDescriptionReadableChannelWithConditionalBound(X delegate, Predicate<? super ReadableChannelWithConditionalBound<A, X>> testForEof) -
Method Summary
Methods inherited from class org.aksw.commons.io.input.ReadableChannelWithCounter
getDelegate, getReadCountMethods inherited from class org.aksw.commons.io.input.ReadableChannelDecoratorBase
getArrayOpsMethods inherited from class org.aksw.commons.io.shared.ChannelDecoratorBase
close, isOpenMethods inherited from class org.aksw.commons.util.closeable.AutoCloseableWrapperBase
closeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.io.input.ReadableSource
readRaw
-
Field Details
-
testForEof
protected Predicate<? super ReadableChannelWithConditionalBound<A,X extends ReadableChannel<A>>> testForEof -
isInEofState
protected boolean isInEofState
-
-
Constructor Details
-
ReadableChannelWithConditionalBound
public ReadableChannelWithConditionalBound(X delegate, Predicate<? super ReadableChannelWithConditionalBound<A, X>> testForEof)
-
-
Method Details
-
read
Description copied from interface:ReadableSourceRead method following the usual InputStream protocol.- Specified by:
readin interfaceReadableSource<A>- Overrides:
readin classReadableChannelWithCounter<A,X extends ReadableChannel<A>> - Parameters:
array- The array into which to put the read dataposition- Offset into array where to start writinglength- Maximum number of items to read.- Returns:
- The number of items read. Return -1 if end of data was reached, and 0 iff length was 0.
- Throws:
IOException
-