org.apache.ignite.internal.binary.streams

## Class BinaryByteBufferInputStream

- java.lang.Object
- - org.apache.ignite.internal.binary.streams.BinaryByteBufferInputStream

All Implemented Interfaces:
  BinaryPositionReadable, BinaryInputStream, BinaryStream

    public class BinaryByteBufferInputStream
    extends Object
    implements BinaryInputStream

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`byte[]` `array()`
`byte[]` `arrayCopy()`
`int` `capacity()`
`static BinaryByteBufferInputStream` `create(ByteBuffer buf)`
`boolean` `hasArray()`
`long` `offheapPointer()`
`int` `position()`
`void` `position(int pos)`
`long` `rawOffheapPointer()`
`int` `read(byte[] arr, int off, int cnt)` Reads `cnt` of bytes into byte array.
`boolean` `readBoolean()` Read boolean value.
`boolean[]` `readBooleanArray(int cnt)` Read boolean array.
`byte` `readByte()` Read byte value.
`byte[]` `readByteArray(int cnt)` Read byte array.
`byte` `readBytePositioned(int pos)` Read byte at the given position.
`char` `readChar()` Read char value.
`char[]` `readCharArray(int cnt)` Read char array.
`double` `readDouble()` Read double value.
`double[]` `readDoubleArray(int cnt)` Read double array.
`float` `readFloat()` Read float value.
`float[]` `readFloatArray(int cnt)` Read float array.
`int` `readInt()` Read int value.
`int[]` `readIntArray(int cnt)` Read int array.
`int` `readIntPositioned(int pos)` Read integer at the given position.
`long` `readLong()` Read long value.
`long[]` `readLongArray(int cnt)` Read long array.
`short` `readShort()` Read short value.
`short[]` `readShortArray(int cnt)` Read short array.
`short` `readShortPositioned(int pos)` Read short at the given position.
`int` `remaining()` Gets amount of remaining data in bytes.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### create

    public static BinaryByteBufferInputStream create(ByteBuffer buf)

Parameters:
  `buf` - Buffer to wrap.
Returns:
  Stream.

#### readByte

    public byte readByte()

Read byte value.

Specified by:
  `readByte` in interface `BinaryInputStream`
Returns:
  Byte value.

#### readByteArray

    public byte[] readByteArray(int cnt)

Read byte array.

Specified by:
  `readByteArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Byte array.

#### read

    public int read(byte[] arr,
                    int off,
                    int cnt)

Reads `cnt` of bytes into byte array.

Specified by:
  `read` in interface `BinaryInputStream`
Parameters:
  `arr` - Expected item count.
  `off` - offset
  `cnt` - number of bytes to read.
Returns:
  actual length read.

#### readBoolean

    public boolean readBoolean()

Read boolean value.

Specified by:
  `readBoolean` in interface `BinaryInputStream`
Returns:
  Boolean value.

#### readBooleanArray

    public boolean[] readBooleanArray(int cnt)

Read boolean array.

Specified by:
  `readBooleanArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Boolean array.

#### readShort

    public short readShort()

Read short value.

Specified by:
  `readShort` in interface `BinaryInputStream`
Returns:
  Short value.

#### readShortArray

    public short[] readShortArray(int cnt)

Read short array.

Specified by:
  `readShortArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Short array.

#### readChar

    public char readChar()

Read char value.

Specified by:
  `readChar` in interface `BinaryInputStream`
Returns:
  Char value.

#### readCharArray

    public char[] readCharArray(int cnt)

Read char array.

Specified by:
  `readCharArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Char array.

#### readInt

    public int readInt()

Read int value.

Specified by:
  `readInt` in interface `BinaryInputStream`
Returns:
  Int value.

#### readIntArray

    public int[] readIntArray(int cnt)

Read int array.

Specified by:
  `readIntArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Int array.

#### readFloat

    public float readFloat()

Read float value.

Specified by:
  `readFloat` in interface `BinaryInputStream`
Returns:
  Float value.

#### readFloatArray

    public float[] readFloatArray(int cnt)

Read float array.

Specified by:
  `readFloatArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Float array.

#### readLong

    public long readLong()

Read long value.

Specified by:
  `readLong` in interface `BinaryInputStream`
Returns:
  Long value.

#### readLongArray

    public long[] readLongArray(int cnt)

Read long array.

Specified by:
  `readLongArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Long array.

#### readDouble

    public double readDouble()

Read double value.

Specified by:
  `readDouble` in interface `BinaryInputStream`
Returns:
  Double value.

#### readDoubleArray

    public double[] readDoubleArray(int cnt)

Read double array.

Specified by:
  `readDoubleArray` in interface `BinaryInputStream`
Parameters:
  `cnt` - Expected item count.
Returns:
  Double array.

#### remaining

    public int remaining()

Gets amount of remaining data in bytes.

Specified by:
  `remaining` in interface `BinaryInputStream`
Returns:
  Remaining data.

#### readBytePositioned

    public byte readBytePositioned(int pos)

Read byte at the given position.

Specified by:
  `readBytePositioned` in interface `BinaryPositionReadable`
Parameters:
  `pos` - Position.
Returns:
  Value.

#### readShortPositioned

    public short readShortPositioned(int pos)

Read short at the given position.

Specified by:
  `readShortPositioned` in interface `BinaryPositionReadable`
Parameters:
  `pos` - Position.
Returns:
  Value.

#### readIntPositioned

    public int readIntPositioned(int pos)

Read integer at the given position.

Specified by:
  `readIntPositioned` in interface `BinaryPositionReadable`
Parameters:
  `pos` - Position.
Returns:
  Value.

#### position

    public int position()

Specified by:
  `position` in interface `BinaryStream`
Returns:
  Position.

#### position

    public void position(int pos)

Specified by:
  `position` in interface `BinaryStream`
Parameters:
  `pos` - Position.

#### rawOffheapPointer

    public long rawOffheapPointer()

Specified by:
  `rawOffheapPointer` in interface `BinaryStream`
Returns:
  Offheap pointer if stream is offheap based; otherwise `0`.

#### capacity

    public int capacity()

Specified by:
  `capacity` in interface `BinaryStream`
Returns:
  Total capacity.

#### array

    public byte[] array()

Specified by:
  `array` in interface `BinaryStream`
Returns:
  Underlying array.

#### arrayCopy

    public byte[] arrayCopy()

Specified by:
  `arrayCopy` in interface `BinaryStream`
Returns:
  Copy of data in the stream.

#### offheapPointer

    public long offheapPointer()

Specified by:
  `offheapPointer` in interface `BinaryStream`
Returns:
  Offheap pointer if stream is offheap based and "forceHeap" flag is not set; otherwise `0`.

#### hasArray

    public boolean hasArray()

Specified by:
  `hasArray` in interface `BinaryStream`
Returns:
  `True` is stream is array based.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.8.0
Release Date | : February 27 2020