Class PlatformInputStreamImpl

    • Constructor Detail

      • PlatformInputStreamImpl

        public PlatformInputStreamImpl​(PlatformMemory mem)
        Constructor.
        Parameters:
        mem - Underlying memory chunk.
    • Method Detail

      • 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.
      • 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.
      • 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.
      • 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.
      • read

        public int read​(byte[] arr,
                        int off,
                        int len)
        Reads cnt of bytes into byte array.
        Specified by:
        read in interface BinaryInputStream
        Parameters:
        arr - Expected item count.
        off - offset
        len - number of bytes to read.
        Returns:
        actual length read.
      • remaining

        public int remaining()
        Gets amount of remaining data in bytes.
        Specified by:
        remaining in interface BinaryInputStream
        Returns:
        Remaining data.
      • capacity

        public int capacity()
        Specified by:
        capacity in interface BinaryStream
        Returns:
        Total capacity.
      • 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.
      • 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.
      • rawOffheapPointer

        public long rawOffheapPointer()
        Specified by:
        rawOffheapPointer in interface BinaryStream
        Returns:
        Offheap pointer if stream is offheap based; otherwise 0.
      • hasArray

        public boolean hasArray()
        Specified by:
        hasArray in interface BinaryStream
        Returns:
        True is stream is array based.
      • synchronize

        public void synchronize()
        Synchronize input. Must be called before start reading data from a memory changed by another platform.
        Specified by:
        synchronize in interface PlatformInputStream