Class BlockSourceChannel
java.lang.Object
org.aksw.commons.io.hadoop.binseach.v2.BlockSourceChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Cloneable,Channel,org.aksw.commons.io.buffer.array.HasArrayOps<byte[]>,org.aksw.commons.io.input.HasPosition,org.aksw.commons.io.input.ReadableChannel<byte[]>,org.aksw.commons.io.input.ReadableSource<byte[]>,org.aksw.commons.io.input.SeekableReadableChannel<byte[]>
public class BlockSourceChannel
extends Object
implements org.aksw.commons.io.input.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 org.aksw.commons.io.input.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(org.aksw.commons.io.input.SeekableReadableChannel<byte[]> seekable, org.apache.hadoop.io.compress.SplittableCompressionCodec codec, boolean blockMode) -
Method Summary
Modifier and TypeMethodDescriptionbooleanorg.aksw.commons.io.input.SeekableReadableChannel<byte[]>voidclose()protected voidvoidorg.aksw.commons.io.buffer.array.ArrayOps<byte[]>longintlongbooleanisOpen()longposition()voidposition(long newPosition) intread(byte[] array, int position, int length) protected voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.commons.io.input.ReadableSource
readRaw
-
Field Details
-
codec
protected final org.apache.hadoop.io.compress.SplittableCompressionCodec codec -
encodedChannel
protected final org.aksw.commons.io.input.SeekableReadableChannel<byte[]> 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(org.aksw.commons.io.input.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
public boolean isOpen() -
read
- Specified by:
readin interfaceorg.aksw.commons.io.input.ReadableSource<byte[]>- Throws:
IOException
-
position
- Specified by:
positionin interfaceorg.aksw.commons.io.input.HasPosition- Throws:
IOException
-
position
- Specified by:
positionin interfaceorg.aksw.commons.io.input.HasPosition- Throws:
IOException
-
getArrayOps
public org.aksw.commons.io.buffer.array.ArrayOps<byte[]> getArrayOps()- Specified by:
getArrayOpsin interfaceorg.aksw.commons.io.buffer.array.HasArrayOps<byte[]>
-
cloneObject
public org.aksw.commons.io.input.SeekableReadableChannel<byte[]> cloneObject()- Specified by:
cloneObjectin interfaceorg.aksw.commons.io.input.SeekableReadableChannel<byte[]>
-