Class BinaryHeapInputStream
- java.lang.Object
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractStream
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
-
- org.apache.ignite.internal.binary.streams.BinaryHeapInputStream
-
- All Implemented Interfaces:
BinaryPositionReadable,BinaryInputStream,BinaryStream
public final class BinaryHeapInputStream extends BinaryAbstractInputStream
Binary heap input stream.
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
len
-
Fields inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractStream
BYTE_ONE, BYTE_ZERO, pos
-
-
Constructor Summary
Constructors Constructor Description BinaryHeapInputStream(byte[] data)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]array()byte[]arrayCopy()intcapacity()BinaryHeapInputStreamcopy()protected voidcopyAndShift(Object target, long off, int len)Copy data to target object shift position afterwards.static BinaryHeapInputStreamcreate(byte[] data, int pos)Create stream with pointer set at the given position.booleanhasArray()protected bytereadByteAndShift()Read next byte from the stream and perform shift.protected bytereadBytePositioned0(int pos)Internal routine for positioned byte value read.protected charreadCharFast()Read char value (fast path).protected intreadIntFast()Read int value (fast path).protected intreadIntPositioned0(int pos)Internal routine for positioned int value read.protected longreadLongFast()Read long value (fast path).protected shortreadShortFast()Read short value (fast path).protected shortreadShortPositioned0(int pos)Internal routine for positioned short value read.intremaining()Gets amount of remaining data in bytes.byte[]resize(int len)Method called from JNI to resize stream.-
Methods inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
ensureEnoughData, offheapPointer, position, rawOffheapPointer, read, readBoolean, readBooleanArray, readByte, readByteArray, readBytePositioned, readChar, readCharArray, readDouble, readDoubleArray, readFloat, readFloatArray, readInt, readIntArray, readIntPositioned, readLong, readLongArray, readShort, readShortArray, readShortPositioned
-
Methods inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractStream
position, shift
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.binary.streams.BinaryStream
position
-
-
-
-
Method Detail
-
create
public static BinaryHeapInputStream create(byte[] data, int pos)
Create stream with pointer set at the given position.- Parameters:
data- Data.pos- Position.- Returns:
- Stream.
-
copy
public BinaryHeapInputStream copy()
- Returns:
- Copy of this stream.
-
resize
public byte[] resize(int len)
Method called from JNI to resize stream.- Parameters:
len- Required length.- Returns:
- Underlying byte array.
-
remaining
public int remaining()
Gets amount of remaining data in bytes.- Returns:
- Remaining data.
-
capacity
public int capacity()
- Returns:
- Total capacity.
-
array
public byte[] array()
- Returns:
- Underlying array.
-
arrayCopy
public byte[] arrayCopy()
- Returns:
- Copy of data in the stream.
-
hasArray
public boolean hasArray()
- Returns:
Trueis stream is array based.
-
readByteAndShift
protected byte readByteAndShift()
Read next byte from the stream and perform shift.- Specified by:
readByteAndShiftin classBinaryAbstractInputStream- Returns:
- Next byte.
-
copyAndShift
protected void copyAndShift(Object target, long off, int len)
Copy data to target object shift position afterwards.- Specified by:
copyAndShiftin classBinaryAbstractInputStream- Parameters:
target- Target.off- Offset.len- Length.
-
readShortFast
protected short readShortFast()
Read short value (fast path).- Specified by:
readShortFastin classBinaryAbstractInputStream- Returns:
- Short value.
-
readCharFast
protected char readCharFast()
Read char value (fast path).- Specified by:
readCharFastin classBinaryAbstractInputStream- Returns:
- Char value.
-
readIntFast
protected int readIntFast()
Read int value (fast path).- Specified by:
readIntFastin classBinaryAbstractInputStream- Returns:
- Int value.
-
readLongFast
protected long readLongFast()
Read long value (fast path).- Specified by:
readLongFastin classBinaryAbstractInputStream- Returns:
- Long value.
-
readBytePositioned0
protected byte readBytePositioned0(int pos)
Internal routine for positioned byte value read.- Specified by:
readBytePositioned0in classBinaryAbstractInputStream- Parameters:
pos- Position.- Returns:
- Int value.
-
readShortPositioned0
protected short readShortPositioned0(int pos)
Internal routine for positioned short value read.- Specified by:
readShortPositioned0in classBinaryAbstractInputStream- Parameters:
pos- Position.- Returns:
- Int value.
-
readIntPositioned0
protected int readIntPositioned0(int pos)
Internal routine for positioned int value read.- Specified by:
readIntPositioned0in classBinaryAbstractInputStream- Parameters:
pos- Position.- Returns:
- Int value.
-
-