Interface ByteOrderInput

All Known Implementing Classes:
BinaryMsg, ByteOrderInputStream

public interface ByteOrderInput
Interface for operation supported by ByteOrderInputStream. Useful in that other objects can implement this interface and act as a facade over top of ByteOrderInputStream and ensure things match up.
Since:
1.0
Version:
2022-09-21
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    read(byte[] b)
    Read data into the byte array.
    int
    read(byte[] b, int off, int len)
    Read the specified number of bytes of data into the array starting at the specified offset.
    boolean
    Read the next byte of input as a boolean value.
    byte
    Return the next available byte.
    Read a C string from input, terminated by a null byte.
    readCString(int len)
    Read a C string from input, terminated by a null byte and padded up to the specified size.
    double
    Read the next eight bytes as a double.
    Read a C string from input, terminated by a null byte and then process it for escaped UTF-8 characters.
    float
    Read the next four bytes as a float.
    void
    readFully(byte[] b)
    Read data into the byte array and only return if the array is full or there is an EOF in the data.
    int
    Return the next four bytes as an int.
    long
    Return the next eight bytes as a long.
    short
    Return the next two bytes as a signed short.
    Read all remaining input as a string.
    int
    Return the next byte as an unsigned byte.
    int
    Return the next two bytes as an unsigned short.
    int
    skipBytes(int n)
    Skip the specified number of bytes of input.
  • Method Details

    • read

      int read(byte[] b) throws IOException
      Read data into the byte array. This is not guaranteed to fill the array.
      Parameters:
      b - the byte array to read into
      Returns:
      the actual number of bytes read
      Throws:
      IOException
    • read

      int read(byte[] b, int off, int len) throws IOException
      Read the specified number of bytes of data into the array starting at the specified offset.
      Parameters:
      b - the array to read data into
      off - the starting offset
      len - the number of bytes to read
      Returns:
      the actual number of bytes read
      Throws:
      IOException
    • readFully

      void readFully(byte[] b) throws IOException, EOFException
      Read data into the byte array and only return if the array is full or there is an EOF in the data.
      Parameters:
      b - the array to read into
      Throws:
      IOException - if there is an underlying exception
      EOFException - if EOF is reached
    • skipBytes

      int skipBytes(int n) throws IOException
      Skip the specified number of bytes of input. Returns the total number of bytes skipped.
      Parameters:
      n - the number of bytes to skip
      Returns:
      the number of byte skipped
      Throws:
      IOException - if there is an underlying exception
    • readBoolean

      boolean readBoolean() throws IOException
      Read the next byte of input as a boolean value.
      Returns:
      the boolean value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readByte

      byte readByte() throws IOException
      Return the next available byte.
      Returns:
      the byte value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readUnsignedByte

      int readUnsignedByte() throws IOException
      Return the next byte as an unsigned byte.
      Returns:
      the unsigned byte value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readShort

      short readShort() throws IOException
      Return the next two bytes as a signed short.
      Returns:
      the short value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readUnsignedShort

      int readUnsignedShort() throws IOException
      Return the next two bytes as an unsigned short.
      Returns:
      the unsigned short value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readInt

      int readInt() throws IOException
      Return the next four bytes as an int.
      Returns:
      the int value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readLong

      long readLong() throws IOException
      Return the next eight bytes as a long.
      Returns:
      the long value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readFloat

      float readFloat() throws IOException
      Read the next four bytes as a float.
      Returns:
      the float value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readDouble

      double readDouble() throws IOException
      Read the next eight bytes as a double.
      Returns:
      the double value
      Throws:
      IOException - if there is an underlying exception or EOF
    • readCString

      String readCString() throws IOException
      Read a C string from input, terminated by a null byte.
      Returns:
      the C string converted to a string
      Throws:
      IOException - if there is an underlying exception or EOF
    • readEscapedCString

      String readEscapedCString() throws IOException
      Read a C string from input, terminated by a null byte and then process it for escaped UTF-8 characters.
      Returns:
      the converted string
      Throws:
      IOException - if there is an underlying exception or EOF
    • readCString

      String readCString(int len) throws IOException
      Read a C string from input, terminated by a null byte and padded up to the specified size.
      Returns:
      the C string converted to a string
      Throws:
      IOException - if there is an underlying exception or EOF
    • readString

      String readString() throws IOException
      Read all remaining input as a string. This assumes the data in the buffer is not null terminated as a normal C string.
      Returns:
      the remaining bytes converted to a string
      Throws:
      IOException - if there is an underlying exception or EOF