Class ReadableChannelWithBlockAdvertisement
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.input.ReadableChannelBase<byte[]>
org.aksw.commons.io.hadoop.ReadableChannelWithBlockAdvertisement
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, HasArrayOps<byte[]>, ReadableChannel<byte[]>, ReadableSource<byte[]>
This variant assumes that the underlying encoded stream runs in BLOCK_MODE.
Reads are expected to:
- stop after yielding the first byte of a block (that byte is returned) and
- these reads always return 1 (never anything greater)
- the position indicating the block id is updated after that read.
ReadableChannelWithBlockAdvertisementBuffered also assumes that every read stops after
yielding the first byte of a block, however the read length may be greater than 1.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected longprotected InputStreamprotected intprotected booleanprotected byteprotected longprotected org.apache.hadoop.fs.Seekableprotected longFields inherited from class org.aksw.commons.util.closeable.AutoCloseableWithLeakDetectionBase
instantiationStackTraceFields inherited from class org.aksw.commons.util.closeable.AutoCloseableBase
closeStackTrace, enableCloseStackTrace, isClosed -
Constructor Summary
ConstructorsConstructorDescriptionReadableChannelWithBlockAdvertisement(InputStream decodedIn) ReadableChannelWithBlockAdvertisement(InputStream decodedIn, int endOfBlockMarker) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDiscard bytes from this channel until a -2 read result is encountered.ArrayOps<byte[]> longlongprotected intonBlockEnd(ByteBuffer dst, long oldPos, long newPos) longposition()intread(byte[] array, int position, int length) Methods inherited from class ChannelBase
isOpenMethods inherited from class org.aksw.commons.util.closeable.AutoCloseableWithLeakDetectionBase
finalize, getInstantiationStackTraceMethods inherited from class org.aksw.commons.util.closeable.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
-
decodedIn
-
seekable
protected org.apache.hadoop.fs.Seekable seekable -
startPos
protected long startPos -
currentPos
protected long currentPos -
pendingByte
protected byte pendingByte -
hasPendingByte
protected boolean hasPendingByte -
endOfBlockMarker
protected int endOfBlockMarker -
readCount
protected long readCount
-
-
Constructor Details
-
ReadableChannelWithBlockAdvertisement
- Throws:
IOException
-
ReadableChannelWithBlockAdvertisement
public ReadableChannelWithBlockAdvertisement(InputStream decodedIn, int endOfBlockMarker) throws IOException - Throws:
IOException
-
-
Method Details
-
position
- Throws:
IOException
-
getStartPos
public long getStartPos() -
getCurrentPos
public long getCurrentPos() -
read
- Throws:
IOException
-
onBlockEnd
-
getArrayOps
-
adjustToNextBlock
Discard bytes from this channel until a -2 read result is encountered.- Throws:
IOException
-