Class BinaryOffheapInputStream
- java.lang.Object
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractStream
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
-
- org.apache.ignite.internal.binary.streams.BinaryOffheapInputStream
-
- All Implemented Interfaces:
BinaryPositionReadable,BinaryInputStream,BinaryStream
public class BinaryOffheapInputStream extends BinaryAbstractInputStream
Binary off-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 BinaryOffheapInputStream(long ptr, int cap)Constructor.BinaryOffheapInputStream(long ptr, int cap, boolean forceHeap)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]array()byte[]arrayCopy()intcapacity()protected voidcopyAndShift(Object target, long off, int len)Copy data to target object shift position afterwards.booleanhasArray()longoffheapPointer()longrawOffheapPointer()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.-
Methods inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
ensureEnoughData, position, 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
-
-
-
-
Constructor Detail
-
BinaryOffheapInputStream
public BinaryOffheapInputStream(long ptr, int cap)Constructor.- Parameters:
ptr- Pointer.cap- Capacity.
-
BinaryOffheapInputStream
public BinaryOffheapInputStream(long ptr, int cap, boolean forceHeap)Constructor.- Parameters:
ptr- Pointer.cap- Capacity.forceHeap- IftruemethodoffheapPointer()returns 0 and unmarshalling will create heap-based objects.
-
-
Method Detail
-
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.
-
offheapPointer
public long offheapPointer()
- Specified by:
offheapPointerin interfaceBinaryStream- Overrides:
offheapPointerin classBinaryAbstractInputStream- Returns:
- Offheap pointer if stream is offheap based and "forceHeap" flag is not set; otherwise
0.
-
rawOffheapPointer
public long rawOffheapPointer()
- Specified by:
rawOffheapPointerin interfaceBinaryStream- Overrides:
rawOffheapPointerin classBinaryAbstractInputStream- Returns:
- Offheap pointer if stream is offheap based; otherwise
0.
-
-