Class LittleEndianOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- de.inetsoftware.jwebassembly.wasm.LittleEndianOutputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable
- Direct Known Subclasses:
WasmOutputStream
public class LittleEndianOutputStream extends java.io.FilterOutputStreamoutputStream with little endian encoding like in Wasm.
-
-
Field Summary
Fields Modifier and Type Field Description private intcount
-
Constructor Summary
Constructors Constructor Description LittleEndianOutputStream()Create a in memory stream.LittleEndianOutputStream(java.io.OutputStream output)Create a wrapped stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidreset()Reset the stream.intsize()The count of bytes in the stream.voidwrite(byte[] b, int off, int len)voidwrite(int b)voidwriteInt32(int value)Write a integer little endian (ever 4 bytes)voidwriteTo(java.io.OutputStream output)Write the data of this stream to the output.
-
-
-
Method Detail
-
write
public void write(int b) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.FilterOutputStream- Throws:
java.io.IOException
-
writeInt32
public void writeInt32(int value) throws java.io.IOExceptionWrite a integer little endian (ever 4 bytes)- Parameters:
value- the value- Throws:
java.io.IOException- if an I/O error occurs.
-
writeTo
public void writeTo(java.io.OutputStream output) throws java.io.IOExceptionWrite the data of this stream to the output. Work only for in memory stream.- Parameters:
output- the target- Throws:
java.io.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.
-
-