Class BinaryAbstractInputStream
- java.lang.Object
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractStream
-
- org.apache.ignite.internal.binary.streams.BinaryAbstractInputStream
-
- All Implemented Interfaces:
BinaryPositionReadable,BinaryInputStream,BinaryStream
- Direct Known Subclasses:
BinaryHeapInputStream,BinaryOffheapInputStream
public abstract class BinaryAbstractInputStream extends BinaryAbstractStream implements BinaryInputStream
Binary abstract input stream.
-
-
Field Summary
Fields Modifier and Type Field Description protected intlenLength of data inside array.-
Fields inherited from class org.apache.ignite.internal.binary.streams.BinaryAbstractStream
BYTE_ONE, BYTE_ZERO, pos
-
-
Constructor Summary
Constructors Constructor Description BinaryAbstractInputStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidcopyAndShift(Object target, long off, int len)Copy data to target object shift position afterwards.protected voidensureEnoughData(int cnt)Ensure that there is enough data.longoffheapPointer()voidposition(int pos)longrawOffheapPointer()intread(byte[] arr, int off, int len)Readscntof bytes into byte array.booleanreadBoolean()Read boolean value.boolean[]readBooleanArray(int cnt)Read boolean array.bytereadByte()Read byte value.protected abstract bytereadByteAndShift()Read next byte from the stream and perform shift.byte[]readByteArray(int cnt)Read byte array.bytereadBytePositioned(int pos)Read byte at the given position.protected abstract bytereadBytePositioned0(int pos)Internal routine for positioned byte value read.charreadChar()Read char value.char[]readCharArray(int cnt)Read char array.protected abstract charreadCharFast()Read char value (fast path).doublereadDouble()Read double value.double[]readDoubleArray(int cnt)Read double array.floatreadFloat()Read float value.float[]readFloatArray(int cnt)Read float array.intreadInt()Read int value.int[]readIntArray(int cnt)Read int array.protected abstract intreadIntFast()Read int value (fast path).intreadIntPositioned(int pos)Read integer at the given position.protected abstract intreadIntPositioned0(int pos)Internal routine for positioned int value read.longreadLong()Read long value.long[]readLongArray(int cnt)Read long array.protected abstract longreadLongFast()Read long value (fast path).shortreadShort()Read short value.short[]readShortArray(int cnt)Read short array.protected abstract shortreadShortFast()Read short value (fast path).shortreadShortPositioned(int pos)Read short at the given position.protected abstract shortreadShortPositioned0(int pos)Internal routine for positioned short value read.-
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.BinaryInputStream
remaining
-
-
-
-
Method Detail
-
readByte
public byte readByte()
Read byte value.- Specified by:
readBytein interfaceBinaryInputStream- Returns:
- Byte value.
-
readByteArray
public byte[] readByteArray(int cnt)
Read byte array.- Specified by:
readByteArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Byte array.
-
readBoolean
public boolean readBoolean()
Read boolean value.- Specified by:
readBooleanin interfaceBinaryInputStream- Returns:
- Boolean value.
-
readBooleanArray
public boolean[] readBooleanArray(int cnt)
Read boolean array.- Specified by:
readBooleanArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Boolean array.
-
readShort
public short readShort()
Read short value.- Specified by:
readShortin interfaceBinaryInputStream- Returns:
- Short value.
-
readShortArray
public short[] readShortArray(int cnt)
Read short array.- Specified by:
readShortArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Short array.
-
readChar
public char readChar()
Read char value.- Specified by:
readCharin interfaceBinaryInputStream- Returns:
- Char value.
-
readCharArray
public char[] readCharArray(int cnt)
Read char array.- Specified by:
readCharArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Char array.
-
readInt
public int readInt()
Read int value.- Specified by:
readIntin interfaceBinaryInputStream- Returns:
- Int value.
-
readIntArray
public int[] readIntArray(int cnt)
Read int array.- Specified by:
readIntArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Int array.
-
readBytePositioned
public byte readBytePositioned(int pos)
Read byte at the given position.- Specified by:
readBytePositionedin interfaceBinaryPositionReadable- Parameters:
pos- Position.- Returns:
- Value.
-
readShortPositioned
public short readShortPositioned(int pos)
Read short at the given position.- Specified by:
readShortPositionedin interfaceBinaryPositionReadable- Parameters:
pos- Position.- Returns:
- Value.
-
readIntPositioned
public int readIntPositioned(int pos)
Read integer at the given position.- Specified by:
readIntPositionedin interfaceBinaryPositionReadable- Parameters:
pos- Position.- Returns:
- Value.
-
readFloat
public float readFloat()
Read float value.- Specified by:
readFloatin interfaceBinaryInputStream- Returns:
- Float value.
-
readFloatArray
public float[] readFloatArray(int cnt)
Read float array.- Specified by:
readFloatArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Float array.
-
readLong
public long readLong()
Read long value.- Specified by:
readLongin interfaceBinaryInputStream- Returns:
- Long value.
-
readLongArray
public long[] readLongArray(int cnt)
Read long array.- Specified by:
readLongArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Long array.
-
readDouble
public double readDouble()
Read double value.- Specified by:
readDoublein interfaceBinaryInputStream- Returns:
- Double value.
-
readDoubleArray
public double[] readDoubleArray(int cnt)
Read double array.- Specified by:
readDoubleArrayin interfaceBinaryInputStream- Parameters:
cnt- Expected item count.- Returns:
- Double array.
-
read
public int read(byte[] arr, int off, int len)Readscntof bytes into byte array.- Specified by:
readin interfaceBinaryInputStream- Parameters:
arr- Expected item count.off- offsetlen- number of bytes to read.- Returns:
- actual length read.
-
position
public void position(int pos)
- Specified by:
positionin interfaceBinaryStream- Parameters:
pos- Position.
-
offheapPointer
public long offheapPointer()
- Specified by:
offheapPointerin interfaceBinaryStream- Returns:
- Offheap pointer if stream is offheap based and "forceHeap" flag is not set; otherwise
0.
-
rawOffheapPointer
public long rawOffheapPointer()
- Specified by:
rawOffheapPointerin interfaceBinaryStream- Returns:
- Offheap pointer if stream is offheap based; otherwise
0.
-
ensureEnoughData
protected void ensureEnoughData(int cnt)
Ensure that there is enough data.- Parameters:
cnt- Length.
-
readByteAndShift
protected abstract byte readByteAndShift()
Read next byte from the stream and perform shift.- Returns:
- Next byte.
-
copyAndShift
protected abstract void copyAndShift(Object target, long off, int len)
Copy data to target object shift position afterwards.- Parameters:
target- Target.off- Offset.len- Length.
-
readShortFast
protected abstract short readShortFast()
Read short value (fast path).- Returns:
- Short value.
-
readCharFast
protected abstract char readCharFast()
Read char value (fast path).- Returns:
- Char value.
-
readIntFast
protected abstract int readIntFast()
Read int value (fast path).- Returns:
- Int value.
-
readLongFast
protected abstract long readLongFast()
Read long value (fast path).- Returns:
- Long value.
-
readBytePositioned0
protected abstract byte readBytePositioned0(int pos)
Internal routine for positioned byte value read.- Parameters:
pos- Position.- Returns:
- Int value.
-
readShortPositioned0
protected abstract short readShortPositioned0(int pos)
Internal routine for positioned short value read.- Parameters:
pos- Position.- Returns:
- Int value.
-
readIntPositioned0
protected abstract int readIntPositioned0(int pos)
Internal routine for positioned int value read.- Parameters:
pos- Position.- Returns:
- Int value.
-
-