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.FilterOutputStream
outputStream with little endian encoding like in Wasm.
-
-
Field Summary
Fields Modifier and Type Field Description private int
count
-
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 void
reset()
Reset the stream.int
size()
The count of bytes in the stream.void
write(byte[] b, int off, int len)
void
write(int b)
void
writeInt32(int value)
Write a integer little endian (ever 4 bytes)void
writeTo(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:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
write
public void write(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
write
in classjava.io.FilterOutputStream
- Throws:
java.io.IOException
-
writeInt32
public void writeInt32(int value) throws java.io.IOException
Write 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.IOException
Write 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.
-
-