Class LittleEndianOutputStream

java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
de.inetsoftware.jwebassembly.wasm.LittleEndianOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
WasmOutputStream

public class LittleEndianOutputStream extends FilterOutputStream
outputStream with little endian encoding like in Wasm.
  • Field Details

    • count

      private int count
  • Constructor Details

    • LittleEndianOutputStream

      public LittleEndianOutputStream()
      Create a in memory stream.
    • LittleEndianOutputStream

      public LittleEndianOutputStream(OutputStream output)
      Create a wrapped stream.
      Parameters:
      output - the target of data
  • Method Details

    • write

      public void write(int b) throws IOException
      Overrides:
      write in class FilterOutputStream
      Throws:
      IOException
    • write

      public void write(byte[] b, int off, int len) throws IOException
      Overrides:
      write in class FilterOutputStream
      Throws:
      IOException
    • writeInt32

      public void writeInt32(int value) throws IOException
      Write a integer little endian (ever 4 bytes)
      Parameters:
      value - the value
      Throws:
      IOException - if an I/O error occurs.
    • writeTo

      public void writeTo(OutputStream output) throws IOException
      Write the data of this stream to the output. Work only for in memory stream.
      Parameters:
      output - the target
      Throws:
      IOException - if any I/O error occur
    • size

      public int size()
      The count of bytes in the stream.
      Returns:
      the data size
    • reset

      public void reset()
      Reset the stream. Work only for in memory stream.