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
outputStream with little endian encoding like in Wasm.
-
Field Summary
FieldsFields inherited from class java.io.FilterOutputStream
out
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a in memory stream.LittleEndianOutputStream
(OutputStream output) Create a wrapped stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
(OutputStream output) Write the data of this stream to the output.Methods inherited from class java.io.FilterOutputStream
close, flush, write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Field Details
-
count
private int count
-
-
Constructor Details
-
LittleEndianOutputStream
public LittleEndianOutputStream()Create a in memory stream. -
LittleEndianOutputStream
Create a wrapped stream.- Parameters:
output
- the target of data
-
-
Method Details
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classFilterOutputStream
- Throws:
IOException
-
writeInt32
Write a integer little endian (ever 4 bytes)- Parameters:
value
- the value- Throws:
IOException
- if an I/O error occurs.
-
writeTo
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.
-