Class BufferOverReadableChannel.Channel<A>
java.lang.Object
org.aksw.commons.util.closeable.AutoCloseableBase
org.aksw.commons.util.closeable.AutoCloseableWithLeakDetectionBase
org.aksw.commons.io.shared.ChannelBase
org.aksw.commons.io.buffer.array.BufferOverReadableChannel.Channel<A>
- All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, Channel, HasArrayOps<A>, HasPosition, ReadableChannel<A>, ReadableSource<A>, SeekableReadableChannel<A>
- Enclosing class:
BufferOverReadableChannel<A>
public static class BufferOverReadableChannel.Channel<A>
extends ChannelBase
implements SeekableReadableChannel<A>
- Author:
- raven
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BufferOverReadableChannel<A> protected BufferOverReadableChannel.BucketPointerprotected longprotected longFields inherited from class AutoCloseableWithLeakDetectionBase
instantiationStackTraceFields inherited from class AutoCloseableBase
closeStackTrace, enableCloseStackTrace, isClosed -
Constructor Summary
ConstructorsConstructorDescriptionChannel(BufferOverReadableChannel<A> owner, boolean enableInitializationStackTrace, long pos, BufferOverReadableChannel.BucketPointer pointer, long requestedPos) -
Method Summary
Methods inherited from class ChannelBase
isOpenMethods inherited from class AutoCloseableWithLeakDetectionBase
finalize, getInstantiationStackTraceMethods inherited from class AutoCloseableBase
close, closeActual, ensureOpen, throwClosedExceptionMethods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReadableSource
readRaw
-
Field Details
-
owner
-
pointer
-
pos
protected long pos -
requestedPos
protected long requestedPos
-
-
Constructor Details
-
Channel
public Channel(BufferOverReadableChannel<A> owner, boolean enableInitializationStackTrace, long pos, BufferOverReadableChannel.BucketPointer pointer, long requestedPos)
-
-
Method Details
-
getOwner
-
getArrayOps
- Specified by:
getArrayOpsin interfaceHasArrayOps<A>
-
read
Description copied from interface:ReadableSourceRead method following the usual InputStream protocol.- Specified by:
readin interfaceReadableSource<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
-
position
public long position()- Specified by:
positionin interfaceHasPosition
-
position
public void position(long pos) - Specified by:
positionin interfaceHasPosition
-
cloneObject
Description copied from interface:SeekableReadableChannelOptional operation. Open a new channel to the underlying source at the same position as this channel. The returned channel is an independent entity and needs to be closed separatedly. Opening a channel this way may be faster than opening a new channel at the source because information about this channel may be re-used (e.g. held pages and pointers into internal data structures)- Specified by:
cloneObjectin interfaceSeekableReadableChannel<A>
-