Interface ByteOrderOutput

All Known Implementing Classes:
BinaryMsg, BinaryMsgOutputStream, ByteOrderOutputStream

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

    Modifier and Type
    Method
    Description
    void
    write(byte[] b)
    Write the array of bytes.
    void
    write(byte[] b, int len)
    Write the specified array of bytes and then pad with zeros to the specified length.
    void
    write(byte[] b, int off, int len)
    Write the specified number of bytes from the array starting at the specified offset.
    void
    write(int b)
    Write a byte.
    void
    writeBoolean(boolean v)
    Write a boolean as a one byte value of 0 or 1.
    void
    writeByte(int v)
    Write a single byte to the output stream.
    void
    Write a variable length string as an ascii encoded C string.
    void
    writeCString(String str, int maxLen)
    Write a string as an ascii encoded, null terminated C string.
    void
    writeCString(String str, int maxLen, byte pad)
    Write a string as an ascii encoded C string.
    void
    writeDouble(double v)
    Write a double to the output stream.
    void
    writeFloat(float v)
    Write a float to the output stream.
    void
    writeInt(int v)
    Writes an int to the output stream.
    void
    writeInt24(int v)
    Writes the lower 24 bits of an int to the output stream.
    void
    writeLong(long v)
    Writes a long to the output stream.
    void
    writeShort(int v)
    Writes a short to the output stream.
    void
    Write a short utf-8 string preceded by an 8 bit length in bytes (not characters).
    void
    writeShortStringWithLen(String str, int maxChars)
    Write a short utf-8 string preceded by an 8 bit length in bytes (not characters), limited to the specified number of characters (not bytes).
    void
    Write a utf-8 string preceded by a 16 bit length in bytes (not characters).
  • Method Details

    • write

      void write(int b) throws IOException
      Write a byte.
      Parameters:
      b - the byte to write
      Throws:
      IOException
    • write

      void write(byte[] b) throws IOException
      Write the array of bytes.
      Parameters:
      b - the byte to write
      Throws:
      IOException
    • write

      void write(byte[] b, int off, int len) throws IOException
      Write the specified number of bytes from the array starting at the specified offset.
      Parameters:
      b - the data to write
      off - offset to start from
      len - number of bytes to write
      Throws:
      IOException
    • writeBoolean

      void writeBoolean(boolean v) throws IOException
      Write a boolean as a one byte value of 0 or 1.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeByte

      void writeByte(int v) throws IOException
      Write a single byte to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeShort

      void writeShort(int v) throws IOException
      Writes a short to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeInt

      void writeInt(int v) throws IOException
      Writes an int to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeInt24

      void writeInt24(int v) throws IOException
      Writes the lower 24 bits of an int to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeLong

      void writeLong(long v) throws IOException
      Writes a long to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeFloat

      void writeFloat(float v) throws IOException
      Write a float to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeDouble

      void writeDouble(double v) throws IOException
      Write a double to the output stream.
      Parameters:
      v - the value to write
      Throws:
      IOException - if there is an underlying error
    • writeCString

      void writeCString(String str, int maxLen) throws IOException
      Write a string as an ascii encoded, null terminated C string. If the string is longer than maxLen then an exception will be thrown. If the string is shorter than the string, the difference will be zero padded. This makes it easy to write strings to fixed size buffers on the native side of things.
      Parameters:
      str - the string to write
      maxLen - the max length of the string
      Throws:
      IOException
    • writeCString

      void writeCString(String str, int maxLen, byte pad) throws IOException
      Write a string as an ascii encoded C string. The string is NOT null terminated. If the string is longer than maxLen then an exception will be thrown. If the string is shorter than the string, the difference will be padded with desired padding byte. This makes it easy to write strings to fixed size buffers on the native side of things.
      Parameters:
      str - the string to write
      maxLen - the max length of the string
      pad - the padding byte to use
      Throws:
      IOException
    • writeCString

      void writeCString(String str) throws IOException
      Write a variable length string as an ascii encoded C string. The string is null terminated. It is up to the caller to make sure the length is not a problem.
      Parameters:
      str - the string to write
      Throws:
      IOException
    • writeStringWithLen

      void writeStringWithLen(String str) throws IOException
      Write a utf-8 string preceded by a 16 bit length in bytes (not characters).
      Parameters:
      str - the string to write
      Throws:
      IOException
    • writeShortStringWithLen

      void writeShortStringWithLen(String str) throws IOException
      Write a short utf-8 string preceded by an 8 bit length in bytes (not characters).
      Parameters:
      str - the string to write
      Throws:
      IOException
    • writeShortStringWithLen

      void writeShortStringWithLen(String str, int maxChars) throws IOException
      Write a short utf-8 string preceded by an 8 bit length in bytes (not characters), limited to the specified number of characters (not bytes).
      Parameters:
      str - the string to write
      Throws:
      IOException
    • write

      void write(byte[] b, int len) throws IOException
      Write the specified array of bytes and then pad with zeros to the specified length.
      Parameters:
      b - the bytes to write
      len - the length to pad to
      Throws:
      IOException