Class BlockSourceChannel
java.lang.Object
org.aksw.commons.io.hadoop.binseach.v2.BlockSourceChannel
- All Implemented Interfaces:
Closeable, AutoCloseable, Cloneable, Channel, HasArrayOps<byte[]>, HasPosition, ReadableChannel<byte[]>, ReadableSource<byte[]>, SeekableReadableChannel<byte[]>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final org.apache.hadoop.io.compress.SplittableCompressionCodecprotected ReadableChannelWithBlockAdvertisementThe current non-seekable channel.protected longThe decoded channel is recreated on every first read after callingposition(long).protected org.apache.hadoop.io.compress.SplitCompressionInputStreamprotected final SeekableReadableChannel<byte[]> protected ByteBufferprotected intThe starting block id will be set after reading the first byte from the stream after its creation or setting the position. -
Constructor Summary
ConstructorsConstructorDescriptionBlockSourceChannel(SeekableReadableChannel<byte[]> seekable, org.apache.hadoop.io.compress.SplittableCompressionCodec codec, boolean blockMode) -
Method Summary
Modifier and TypeMethodDescriptionbooleanSeekableReadableChannel<byte[]> voidclose()protected voidvoidArrayOps<byte[]> longintlongbooleanisOpen()longposition()/ if (startingBlockId == -1) { / startingBlockId = nextNextBlockId; // This may already be the next block / currentBlockId = nextNextBlockId; / nextBlockId = nextNextBlockId; / } else { / currentBlockId = nextNextBlockId; / nextBlockId = nextNextBlockId; / }voidposition(long newPosition) intread(byte[] array, int position, int length) protected voidMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ReadableSource
readRaw
-
Field Details
-
codec
protected final org.apache.hadoop.io.compress.SplittableCompressionCodec codec -
encodedChannel
-
decodedChannelStart
protected long decodedChannelStartThe decoded channel is recreated on every first read after callingposition(long). -
decodedChannel
The current non-seekable channel. -
positionInBlock
protected int positionInBlockThe starting block id will be set after reading the first byte from the stream after its creation or setting the position. -
pendingRead
-
decodedIn
protected org.apache.hadoop.io.compress.SplitCompressionInputStream decodedIn -
blockMode
protected boolean blockMode
-
-
Constructor Details
-
BlockSourceChannel
public BlockSourceChannel(SeekableReadableChannel<byte[]> seekable, org.apache.hadoop.io.compress.SplittableCompressionCodec codec, boolean blockMode)
-
-
Method Details
-
ensureDecodedChannel
- Throws:
IOException
-
resetTracker
protected void resetTracker() -
getStartingBlockId
- Throws:
IOException
-
getCurrentBlockId
- Throws:
IOException
-
getPositionInBlock
public int getPositionInBlock() -
adjustToNextBlock
- Throws:
IOException
-
closeDecodedChannel
- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Throws:
IOException
-
isOpen
-
read
- Specified by:
readin interfaceReadableSource<byte[]>- Throws:
IOException
-
position
/ if (startingBlockId == -1) { / startingBlockId = nextNextBlockId; // This may already be the next block / currentBlockId = nextNextBlockId; / nextBlockId = nextNextBlockId; / } else { / currentBlockId = nextNextBlockId; / nextBlockId = nextNextBlockId; / }- Specified by:
positionin interfaceHasPosition- Throws:
IOException
-
position
- Specified by:
positionin interfaceHasPosition- Throws:
IOException
-
getArrayOps
- Specified by:
getArrayOpsin interfaceHasArrayOps<byte[]>
-
cloneObject
- Specified by:
cloneObjectin interfaceSeekableReadableChannel<byte[]>
-