Package net.sansa_stack.nio.util
Class ReadableByteChannelWithConditionalBound<T extends ReadableByteChannel>
- java.lang.Object
-
- net.sansa_stack.nio.util.ReadableByteChannelDecoratorBase<T>
-
- net.sansa_stack.nio.util.ReadableByteChannelWithConditionalBound<T>
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Channel
,ReadableByteChannel
,ReadableByteChannelDecorator
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 immediately returns -1 (eof). Used to prevent reading across hadoop split boundaries
-
-
Field Summary
Fields Modifier and Type Field Description protected long
bytesRead
protected boolean
isInEofState
protected Predicate<? super ReadableByteChannelWithConditionalBound<T>>
testForEof
-
Fields inherited from class net.sansa_stack.nio.util.ReadableByteChannelDecoratorBase
delegate
-
-
Constructor Summary
Constructors Constructor Description ReadableByteChannelWithConditionalBound(T delegate, Predicate<? super ReadableByteChannelWithConditionalBound<T>> testForEof)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getBytesRead()
int
read(ByteBuffer byteBuffer)
-
Methods inherited from class net.sansa_stack.nio.util.ReadableByteChannelDecoratorBase
getDelegate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sansa_stack.nio.util.ReadableByteChannelDecorator
close, isOpen
-
-
-
-
Field Detail
-
testForEof
protected Predicate<? super ReadableByteChannelWithConditionalBound<T extends ReadableByteChannel>> testForEof
-
isInEofState
protected boolean isInEofState
-
bytesRead
protected long bytesRead
-
-
Constructor Detail
-
ReadableByteChannelWithConditionalBound
public ReadableByteChannelWithConditionalBound(T delegate, Predicate<? super ReadableByteChannelWithConditionalBound<T>> testForEof)
-
-
Method Detail
-
read
public int read(ByteBuffer byteBuffer) throws IOException
- Throws:
IOException
-
getBytesRead
public long getBytesRead()
-
-