Package org.apache.ignite.internal.direct.stream

## Class DirectByteBufferStream

- java.lang.Object
- - org.apache.ignite.internal.direct.stream.DirectByteBufferStream

    public class DirectByteBufferStream
    extends Object

Direct marshalling I/O stream.

### Field Summary

Fields
`protected long` `baseOff`
`protected ByteBuffer` `buf`
`protected byte[]` `heapArr`
`protected boolean` `lastFinished`
`protected long` `uuidLeast`
`protected long` `uuidLocId`
`protected long` `uuidMost`
`protected int` `uuidState`

### Constructor Summary

Constructors
`DirectByteBufferStream​(MessageFactory msgFactory)`

### Method Summary

All Methods Instance Methods Concrete Methods
`boolean` `lastFinished()`
`protected Object` `read​(MessageCollectionItemType type, MessageReader reader)`
`AffinityTopologyVersion` `readAffinityTopologyVersion()`
`BitSet` `readBitSet()`
`boolean` `readBoolean()`
`boolean[]` `readBooleanArray()`
`byte` `readByte()`
`byte[]` `readByteArray()`
`char` `readChar()`
`char[]` `readCharArray()`
`<C extends Collection<?>> C` `readCollection​(MessageCollectionItemType itemType, MessageReader reader)`
`double` `readDouble()`
`double[]` `readDoubleArray()`
`float` `readFloat()`
`float[]` `readFloatArray()`
`IgniteUuid` `readIgniteUuid()`
`int` `readInt()`
`int[]` `readIntArray()`
`long` `readLong()`
`long[]` `readLongArray()`
`<M extends Map<?,​?>> M` `readMap​(MessageCollectionItemType keyType, MessageCollectionItemType valType, boolean linked, MessageReader reader)`
`<T extends Message> T` `readMessage​(MessageReader reader)`
`<T> T[]` `readObjectArray​(MessageCollectionItemType itemType, Class<T> itemCls, MessageReader reader)`
`short` `readShort()`
`short[]` `readShortArray()`
`String` `readString()`
`UUID` `readUuid()`
`int` `remaining()`
`void` `setBuffer​(ByteBuffer buf)`
`String` `toString()`
`protected void` `write​(MessageCollectionItemType type, Object val, MessageWriter writer)`
`void` `writeAffinityTopologyVersion​(AffinityTopologyVersion val)`
`void` `writeBitSet​(BitSet val)`
`void` `writeBoolean​(boolean val)`
`void` `writeBooleanArray​(boolean[] val)`
`void` `writeByte​(byte val)`
`void` `writeByteArray​(byte[] val)`
`void` `writeByteArray​(byte[] val, long off, int len)`
`void` `writeChar​(char val)`
`void` `writeCharArray​(char[] val)`
`<T> void` `writeCollection​(Collection<T> col, MessageCollectionItemType itemType, MessageWriter writer)`
`void` `writeDouble​(double val)`
`void` `writeDoubleArray​(double[] val)`
`void` `writeFloat​(float val)`
`void` `writeFloatArray​(float[] val)`
`void` `writeIgniteUuid​(IgniteUuid val)`
`void` `writeInt​(int val)`
`void` `writeIntArray​(int[] val)`
`void` `writeLong​(long val)`
`void` `writeLongArray​(long[] val)`
`void` `writeLongArray​(long[] val, int len)`
`<K,​V> void` `writeMap​(Map<K,​V> map, MessageCollectionItemType keyType, MessageCollectionItemType valType, MessageWriter writer)`
`void` `writeMessage​(Message msg, MessageWriter writer)`
`<T> void` `writeObjectArray​(T[] arr, MessageCollectionItemType itemType, MessageWriter writer)`
`void` `writeShort​(short val)`
`void` `writeShortArray​(short[] val)`
`void` `writeString​(String val)`
`void` `writeUuid​(UUID val)`

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

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

### Field Detail

#### buf

    @GridToStringExclude
    protected ByteBuffer buf

#### heapArr

    protected byte[] heapArr

#### baseOff

    protected long baseOff

#### uuidState

    protected int uuidState

#### uuidMost

    protected long uuidMost

#### uuidLeast

    protected long uuidLeast

#### uuidLocId

    protected long uuidLocId

#### lastFinished

    protected boolean lastFinished

### Constructor Detail

#### DirectByteBufferStream

    public DirectByteBufferStream​(MessageFactory msgFactory)

Parameters:
  `msgFactory` - Message factory.

### Method Detail

#### setBuffer

    public void setBuffer​(ByteBuffer buf)

Parameters:
  `buf` - Buffer.

#### remaining

    public int remaining()

Returns:
  Number of remaining bytes.

#### lastFinished

    public boolean lastFinished()

Returns:
  Whether last object was fully written or read.

#### writeByte

    public void writeByte​(byte val)

Parameters:
  `val` - Value.

#### writeShort

    public void writeShort​(short val)

Parameters:
  `val` - Value.

#### writeInt

    public void writeInt​(int val)

Parameters:
  `val` - Value.

#### writeLong

    public void writeLong​(long val)

Parameters:
  `val` - Value.

#### writeFloat

    public void writeFloat​(float val)

Parameters:
  `val` - Value.

#### writeDouble

    public void writeDouble​(double val)

Parameters:
  `val` - Value.

#### writeChar

    public void writeChar​(char val)

Parameters:
  `val` - Value.

#### writeBoolean

    public void writeBoolean​(boolean val)

Parameters:
  `val` - Value.

#### writeByteArray

    public void writeByteArray​(byte[] val)

Parameters:
  `val` - Value.

#### writeByteArray

    public void writeByteArray​(byte[] val,
                               long off,
                               int len)

Parameters:
  `val` - Value.
  `off` - Offset.
  `len` - Length.

#### writeShortArray

    public void writeShortArray​(short[] val)

Parameters:
  `val` - Value.

#### writeIntArray

    public void writeIntArray​(int[] val)

Parameters:
  `val` - Value.

#### writeLongArray

    public void writeLongArray​(long[] val)

Parameters:
  `val` - Value.

#### writeLongArray

    public void writeLongArray​(long[] val,
                               int len)

Parameters:
  `val` - Value.
  `len` - Length.

#### writeFloatArray

    public void writeFloatArray​(float[] val)

Parameters:
  `val` - Value.

#### writeDoubleArray

    public void writeDoubleArray​(double[] val)

Parameters:
  `val` - Value.

#### writeCharArray

    public void writeCharArray​(char[] val)

Parameters:
  `val` - Value.

#### writeBooleanArray

    public void writeBooleanArray​(boolean[] val)

Parameters:
  `val` - Value.

#### writeString

    public void writeString​(String val)

Parameters:
  `val` - Value.

#### writeBitSet

    public void writeBitSet​(BitSet val)

Parameters:
  `val` - Value.

#### writeUuid

    public void writeUuid​(UUID val)

Parameters:
  `val` - Value.

#### writeIgniteUuid

    public void writeIgniteUuid​(IgniteUuid val)

Parameters:
  `val` - Value.

#### writeAffinityTopologyVersion

    public void writeAffinityTopologyVersion​(AffinityTopologyVersion val)

Parameters:
  `val` - Value.

#### writeMessage

    public void writeMessage​(Message msg,
                             MessageWriter writer)

Parameters:
  `msg` - Message.
  `writer` - Writer.

#### writeObjectArray

    public <T> void writeObjectArray​(T[] arr,
                                     MessageCollectionItemType itemType,
                                     MessageWriter writer)

Parameters:
  `arr` - Array.
  `itemType` - Component type.
  `writer` - Writer.

#### writeCollection

    public <T> void writeCollection​(Collection<T> col,
                                    MessageCollectionItemType itemType,
                                    MessageWriter writer)

Parameters:
  `col` - Collection.
  `itemType` - Component type.
  `writer` - Writer.

#### writeMap

    public <K,​V> void writeMap​(Map<K,​V> map,
                                     MessageCollectionItemType keyType,
                                     MessageCollectionItemType valType,
                                     MessageWriter writer)

Parameters:
  `map` - Map.
  `keyType` - Key type.
  `valType` - Value type.
  `writer` - Writer.

#### readByte

    public byte readByte()

Returns:
  Value.

#### readShort

    public short readShort()

Returns:
  Value.

#### readInt

    public int readInt()

Returns:
  Value.

#### readLong

    public long readLong()

Returns:
  Value.

#### readFloat

    public float readFloat()

Returns:
  Value.

#### readDouble

    public double readDouble()

Returns:
  Value.

#### readChar

    public char readChar()

Returns:
  Value.

#### readBoolean

    public boolean readBoolean()

Returns:
  Value.

#### readByteArray

    public byte[] readByteArray()

Returns:
  Value.

#### readShortArray

    public short[] readShortArray()

Returns:
  Value.

#### readIntArray

    public int[] readIntArray()

Returns:
  Value.

#### readLongArray

    public long[] readLongArray()

Returns:
  Value.

#### readFloatArray

    public float[] readFloatArray()

Returns:
  Value.

#### readDoubleArray

    public double[] readDoubleArray()

Returns:
  Value.

#### readCharArray

    public char[] readCharArray()

Returns:
  Value.

#### readBooleanArray

    public boolean[] readBooleanArray()

Returns:
  Value.

#### readString

    public String readString()

Returns:
  Value.

#### readBitSet

    public BitSet readBitSet()

Returns:
  Value.

#### readUuid

    public UUID readUuid()

Returns:
  Value.

#### readIgniteUuid

    public IgniteUuid readIgniteUuid()

Returns:
  Value.

#### readAffinityTopologyVersion

    public AffinityTopologyVersion readAffinityTopologyVersion()

Returns:
  Value.

#### readMessage

    public <T extends Message> T readMessage​(MessageReader reader)

Parameters:
  `reader` - Reader.
Returns:
  Message.

#### readObjectArray

    public <T> T[] readObjectArray​(MessageCollectionItemType itemType,
                                   Class<T> itemCls,
                                   MessageReader reader)

Parameters:
  `itemType` - Item type.
  `itemCls` - Item class.
  `reader` - Reader.
Returns:
  Array.

#### readCollection

    public <C extends Collection<?>> C readCollection​(MessageCollectionItemType itemType,
                                                      MessageReader reader)

Parameters:
  `itemType` - Item type.
  `reader` - Reader.
Returns:
  Collection.

#### readMap

    public <M extends Map<?,​?>> M readMap​(MessageCollectionItemType keyType,
                                                MessageCollectionItemType valType,
                                                boolean linked,
                                                MessageReader reader)

Parameters:
  `keyType` - Key type.
  `valType` - Value type.
  `linked` - Whether linked map should be created.
  `reader` - Reader.
Returns:
  Map.

#### write

    protected void write​(MessageCollectionItemType type,
                         Object val,
                         MessageWriter writer)

Parameters:
  `type` - Type.
  `val` - Value.
  `writer` - Writer.

#### read

    protected Object read​(MessageCollectionItemType type,
                          MessageReader reader)

Parameters:
  `type` - Type.
  `reader` - Reader.
Returns:
  Value.

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`