Package org.aksw.commons.io.util.channel
Class ReadableByteChannelWithConditionalBound<T extends ReadableByteChannel>
java.lang.Object
org.aksw.commons.io.util.channel.ReadableByteChannelDecoratorBase<T>
org.aksw.commons.io.util.channel.ReadableByteChannelWithConditionalBound<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,ReadableByteChannel,ReadableByteChannelDecorator<T>
public class ReadableByteChannelWithConditionalBound<T extends ReadableByteChannel>
extends ReadableByteChannelDecoratorBase<T>
Readable byte channel wrapper that before every read checks for an
end-of-file (eof) condition.
Once true, any subsequent read immediatly returns -1 (eof).
Used to prevent reading across hadoop split boundaries
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected booleanprotected ThrowingPredicate<? super ReadableByteChannelWithConditionalBound<T>>Fields inherited from class org.aksw.commons.io.util.channel.ReadableByteChannelDecoratorBase
delegate -
Constructor Summary
ConstructorsConstructorDescriptionReadableByteChannelWithConditionalBound(T delegate, ThrowingPredicate<? super ReadableByteChannelWithConditionalBound<T>> testForEof) -
Method Summary
Methods inherited from class org.aksw.commons.io.util.channel.ReadableByteChannelDecoratorBase
getDelegateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.io.util.channel.ReadableByteChannelDecorator
close, isOpen
-
Field Details
-
testForEof
protected ThrowingPredicate<? super ReadableByteChannelWithConditionalBound<T extends ReadableByteChannel>> testForEof -
isInEofState
protected boolean isInEofState -
bytesRead
protected long bytesRead
-
-
Constructor Details
-
ReadableByteChannelWithConditionalBound
public ReadableByteChannelWithConditionalBound(T delegate, ThrowingPredicate<? super ReadableByteChannelWithConditionalBound<T>> testForEof)
-
-
Method Details
-
read
- Throws:
IOException
-
getBytesRead
public long getBytesRead()
-