Class BufferOverInputStream.ByteArrayChannel
java.lang.Object
org.aksw.commons.io.hadoop.binseach.bz2.ReadableByteChannelBase
org.aksw.commons.io.hadoop.binseach.bz2.BufferOverInputStream.ByteArrayChannel
- All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, ReadableByteChannel, SeekableByteChannel, WritableByteChannel, Seekable
- Enclosing class:
BufferOverInputStream
public class BufferOverInputStream.ByteArrayChannel
extends ReadableByteChannelBase
implements SeekableByteChannel, Seekable
- Author:
- raven
-
Field Summary
FieldsFields inherited from class ReadableByteChannelBase
isOpen, maxReadSize -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintcheckNext(int len, boolean changePos) intcheckPrev(int len, boolean changePos) The method assumes that the current position is in the valid rangeclone()byteget()longgetPos()booleanbooleanlongloadAll()Loads all data into the buffer and returns the total sizelongposition()position(long pos) Setting a position outside of the size of the entity is valid will will cause a read to immediately return an EOF SeeReadableByteChannelvoidposToEnd()Set the position to the end of the stream immediately loads all data.voidintreadActual(ByteBuffer dst) readString(int len) voidsetPos(long pos) longsize()First checks whether there is at least one more byte available and afterwards returns the currently known sizetruncate(long size) intwrite(ByteBuffer src) Methods inherited from class ReadableByteChannelBase
close, isOpen, isUnderlyingEntityKnownToBeClosed, readMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Seekable
binarySearch, cloneObject, close, compareToPrefix, deltaPos, get, nextPos, peekNextBytes, posToNext, posToNext, posToPrev, prevPos, readMethods inherited from interface SeekableByteChannel
read
-
Field Details
-
pos
protected long pos -
pointer
-
-
Constructor Details
-
ByteArrayChannel
-
-
Method Details
-
position
Setting a position outside of the size of the entity is valid will will cause a read to immediately return an EOF SeeReadableByteChannel- Specified by:
positionin interfaceSeekableByteChannel- Parameters:
pos-- Returns:
-
position
public long position()- Specified by:
positionin interfaceSeekableByteChannel
-
readActual
- Specified by:
readActualin classReadableByteChannelBase- Throws:
IOException
-
write
- Specified by:
writein interfaceSeekableByteChannel- Specified by:
writein interfaceWritableByteChannel- Throws:
IOException
-
size
First checks whether there is at least one more byte available and afterwards returns the currently known size- Specified by:
sizein interfaceSeekable- Specified by:
sizein interfaceSeekableByteChannel- Throws:
IOException
-
loadAll
Loads all data into the buffer and returns the total size- Throws:
IOException
-
truncate
- Specified by:
truncatein interfaceSeekableByteChannel- Throws:
IOException
-
clone
-
getPos
- Specified by:
getPosin interfaceSeekable- Throws:
IOException
-
setPos
- Specified by:
setPosin interfaceSeekable- Throws:
IOException
-
posToStart
- Specified by:
posToStartin interfaceSeekable- Throws:
IOException
-
posToEnd
Set the position to the end of the stream immediately loads all data.- Specified by:
posToEndin interfaceSeekable- Throws:
IOException
-
isPosBeforeStart
- Specified by:
isPosBeforeStartin interfaceSeekable- Throws:
IOException
-
isPosAfterEnd
- Specified by:
isPosAfterEndin interfaceSeekable- Throws:
IOException
-
readString
- Specified by:
readStringin interfaceSeekable- Throws:
IOException
-
checkNext
- Specified by:
checkNextin interfaceSeekable- Throws:
IOException
-
get
- Specified by:
getin interfaceSeekable- Throws:
IOException
-
checkPrev
The method assumes that the current position is in the valid range- Specified by:
checkPrevin interfaceSeekable- Throws:
IOException
-