Class ByteWriter


  • public class ByteWriter
    extends Object
    Write a byte array
    Author:
    osbornb
    • Field Detail

      • DEFAULT_BYTE_ORDER

        public static final ByteOrder DEFAULT_BYTE_ORDER
        Default write byte order
        Since:
        2.0.3
    • Constructor Detail

      • ByteWriter

        public ByteWriter()
        Constructor
      • ByteWriter

        public ByteWriter​(OutputStream outputStream)
        Constructor
        Parameters:
        outputStream - output stream
        Since:
        2.0.3
      • ByteWriter

        public ByteWriter​(ByteOrder byteOrder)
        Constructor
        Parameters:
        byteOrder - byte order
        Since:
        2.0.3
      • ByteWriter

        public ByteWriter​(OutputStream outputStream,
                          ByteOrder byteOrder)
        Constructor
        Parameters:
        outputStream - output stream
        byteOrder - byte order
        Since:
        2.0.3
    • Method Detail

      • getOutputStream

        public OutputStream getOutputStream()
        Get the output stream
        Returns:
        output stream
        Since:
        2.0.3
      • getByteArrayOutputStream

        public ByteArrayOutputStream getByteArrayOutputStream()
        Get the output stream
        Returns:
        output stream
        Since:
        2.0.3
      • close

        public void close()
        Close the byte writer
      • getByteOrder

        public ByteOrder getByteOrder()
        Get the byte order
        Returns:
        byte order
      • setByteOrder

        public void setByteOrder​(ByteOrder byteOrder)
        Set the byte order
        Parameters:
        byteOrder - byte order
      • getBytes

        public byte[] getBytes()
        Get the written bytes
        Returns:
        written bytes
      • size

        public int size()
        Get the current size in bytes written
        Returns:
        bytes written
      • writeString

        public void writeString​(String value)
                         throws IOException
        Write a String
        Parameters:
        value - string value
        Throws:
        IOException - upon error
      • writeByte

        public void writeByte​(byte value)
                       throws IOException
        Write a byte
        Parameters:
        value - byte
        Throws:
        IOException - upon error
      • writeInt

        public void writeInt​(int value)
                      throws IOException
        Write an integer
        Parameters:
        value - int value
        Throws:
        IOException - upon error
      • writeDouble

        public void writeDouble​(double value)
                         throws IOException
        Write a double
        Parameters:
        value - double
        Throws:
        IOException - upon error