org.apache.ignite.internal.binary.streams

## 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 and Description
`BinaryOffheapInputStream(long ptr, int cap)` Constructor.
`BinaryOffheapInputStream(long ptr, int cap, boolean forceHeap)` Constructor.

### Method Summary

Methods
`byte[]` `array()`
`byte[]` `arrayCopy()`
`protected void` `copyAndShift(Object target, long off, int len)` Copy data to target object shift position afterwards.
`boolean` `hasArray()`
`long` `offheapPointer()`
`protected byte` `readByteAndShift()` Read next byte from the stream and perform shift.
`protected byte` `readBytePositioned0(int pos)` Internal routine for positioned byte value read.
`protected char` `readCharFast()` Read char value (fast path).
`protected int` `readIntFast()` Read int value (fast path).
`protected int` `readIntPositioned0(int pos)` Internal routine for positioned int value read.
`protected long` `readLongFast()` Read long value (fast path).
`protected short` `readShortFast()` Read short value (fast path).
`protected short` `readShortPositioned0(int pos)` Internal routine for positioned short value read.
`int` `remaining()` 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` - If `true` method `offheapPointer()` 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.

#### array

    public byte[] array()

Returns:
  Underlying array.

#### arrayCopy

    public byte[] arrayCopy()

Returns:
  Copy of data in the stream.

#### hasArray

    public boolean hasArray()

Returns:
  `True` is stream is array based.

#### readByteAndShift

    protected byte readByteAndShift()

Read next byte from the stream and perform shift.

Specified by:
  `readByteAndShift` in class `BinaryAbstractInputStream`
Returns:
  Next byte.

#### copyAndShift

    protected void copyAndShift(Object target,
                    long off,
                    int len)

Copy data to target object shift position afterwards.

Specified by:
  `copyAndShift` in class `BinaryAbstractInputStream`
Parameters:
  `target` - Target.
  `off` - Offset.
  `len` - Length.

#### readShortFast

    protected short readShortFast()

Read short value (fast path).

Specified by:
  `readShortFast` in class `BinaryAbstractInputStream`
Returns:
  Short value.

#### readCharFast

    protected char readCharFast()

Read char value (fast path).

Specified by:
  `readCharFast` in class `BinaryAbstractInputStream`
Returns:
  Char value.

#### readIntFast

    protected int readIntFast()

Read int value (fast path).

Specified by:
  `readIntFast` in class `BinaryAbstractInputStream`
Returns:
  Int value.

#### readLongFast

    protected long readLongFast()

Read long value (fast path).

Specified by:
  `readLongFast` in class `BinaryAbstractInputStream`
Returns:
  Long value.

#### readBytePositioned0

    protected byte readBytePositioned0(int pos)

Internal routine for positioned byte value read.

Specified by:
  `readBytePositioned0` in class `BinaryAbstractInputStream`
Parameters:
  `pos` - Position.
Returns:
  Int value.

#### readShortPositioned0

    protected short readShortPositioned0(int pos)

Internal routine for positioned short value read.

Specified by:
  `readShortPositioned0` in class `BinaryAbstractInputStream`
Parameters:
  `pos` - Position.
Returns:
  Int value.

#### readIntPositioned0

    protected int readIntPositioned0(int pos)

Internal routine for positioned int value read.

Specified by:
  `readIntPositioned0` in class `BinaryAbstractInputStream`
Parameters:
  `pos` - Position.
Returns:
  Int value.

#### offheapPointer

    public long offheapPointer()

Specified by:
  `offheapPointer` in interface `BinaryStream`
Overrides:
  `offheapPointer` in class `BinaryAbstractInputStream`
Returns:
  Offheap pointer if stream is offheap based, otherwise `0`.

2015 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Fabric | : ver. 1.6.0
Release Date | : May 18 2016