Module com.s8.api

Interface ByteInflow


public interface ByteInflow

Unified in-flow of bytes with getters for standard primitives.

/!\ All array or String lengths are encoded as UInt32 to reflect their maximum possible length in JAVA.

Author:
Pierre Convert Copyright (C) 2022, Pierre Convert. All rights reserved.
  • Field Details

    • BOOL8_FALSE

      static final int BOOL8_FALSE
      Standard encoding for FALSE boolean value/
      See Also:
    • BOOL8_TRUE

      static final int BOOL8_TRUE
      Standard encoding for TRUE boolean value/
      See Also:
  • Method Details

    • getCount

      long getCount()
      getCount
      Returns:
      the count
    • getByte

      byte getByte() throws IOException
      getByte
      Returns:
      next byte
      Throws:
      IOException - exception while reading from the flow
    • getBool8

      default boolean getBool8() throws IOException
      getBool8
      Returns:
      next byte
      Throws:
      IOException - exception while reading from the flow
    • getByteArray

      byte[] getByteArray(int length) throws IOException
      length passed as argument
      Parameters:
      length - next bytes, where n is the length of the bytes array
      Returns:
      the byte array read from the flow
      Throws:
      IOException - exception while reading from the flow
    • matches

      boolean matches(byte[] sequence) throws IOException
      Tells if the next bytes in the ByteInput are matching the sequence passed as argument. Note that this method will return an exception if there is not enough bytes to make the comparison.
      Parameters:
      sequence - the bytes sequence to be tested against the inflow
      Returns:
      true if sequence is matching underlying bytes.
      Throws:
      IOException - exception while reading from the flow
    • getFlags8

      boolean[] getFlags8() throws IOException
      getFlags8
      Returns:
      the flags
      Throws:
      IOException - exception while reading from the flow
    • getUInt7x

      long getUInt7x() throws IOException
      getUInt7x
      Returns:
      the long value read from the flow
      Throws:
      IOException - exception while reading from the flow
    • getUInt8

      int getUInt8() throws IOException
      getUInt8
      Returns:
      the next Unsigned Integer 8 bits (1 byte)
      Throws:
      IOException - exception while reading from the flow
    • getUInt16

      int getUInt16() throws IOException
      getUInt16
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getUInt24

      int getUInt24() throws IOException
      getUInt24
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getUInt31

      int getUInt31() throws IOException
      getUInt31
      Returns:
      the next Unsigned Integer 31 bits (4 bytes, first bit ignored)
      Throws:
      IOException - exception while reading from the flow
    • getUInt32

      int getUInt32() throws IOException
      getUInt32 Curretly doing the same as getUInt31
      Returns:
      the int read forom flow
      Throws:
      IOException - exception while reading from the flow
    • getUInt40

      long getUInt40() throws IOException
      getUInt40
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getUInt48

      long getUInt48() throws IOException
      getUInt48
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getUInt56

      long getUInt56() throws IOException
      getUInt56
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getUInt64

      long getUInt64() throws IOException
      getUInt64
      Returns:
      the next Unsigned Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getInt8

      byte getInt8() throws IOException
      getInt8
      Returns:
      the value
      Throws:
      IOException - exception while reading from the flow
    • getInt16

      short getInt16() throws IOException
      getInt16
      Returns:
      the next Signed Integer 16 bits (2 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getInt32

      int getInt32() throws IOException
      getInt32
      Returns:
      the next Signed Integer 32 bits (4 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getInt32Array

      default int[] getInt32Array() throws IOException
      getInt32Array
      Returns:
      the value
      Throws:
      IOException - exception while reading from the flow
    • getInt64

      long getInt64() throws IOException
      getInt64
      Returns:
      the next Signed Integer 64 bits (8 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getFloat32

      float getFloat32() throws IOException
      getFloat32
      Returns:
      the next Float 32 bits (4 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getFloat64

      double getFloat64() throws IOException
      getFloat64
      Returns:
      the next Float 64 bits (8 bytes)
      Throws:
      IOException - exception while reading from the flow
    • getFloat64Array

      default double[] getFloat64Array() throws IOException
      getFloat64Array
      Returns:
      the value
      Throws:
      IOException - exception while reading from the flow
    • getStringUTF8

      String getStringUTF8() throws IOException
      getStringUTF8 ASCII char only String, whose length is encoded on 8bits (max length is 256).
      Returns:
      the value
      Throws:
      IOException - exception while reading from the flow
    • startRecording

      void startRecording(ByteOutflow outflow)
      startRecording
      Parameters:
      outflow - theouflow
    • stopRecording

      void stopRecording() throws IOException
      stopRecording
      Throws:
      IOException - exception while reading from the flow