Class WasmOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
de.inetsoftware.jwebassembly.wasm.LittleEndianOutputStream
de.inetsoftware.jwebassembly.binary.WasmOutputStream
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
-
Field Summary
FieldsFields inherited from class FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionWasmOutputStream(WasmOptions options) Create a in memory stream.WasmOutputStream(WasmOptions options, OutputStream output) Create a wrapped stream. -
Method Summary
Modifier and TypeMethodDescription(package private) voidwriteConst(Number value, ValueType valueType) Write a constant number valuevoidwriteDefaultValue(AnyType type) Write the default/initial value for a type.(package private) voidwriteDouble(double value) Write an double value.(package private) voidwriteFloat(float value) Write an float value.voidwriteOpCode(int op) Write a binary operation code.voidwriteRefValueType(AnyType type) Write the value type.(package private) voidwriteSection(SectionType type, WasmOutputStream data) Write a section with header and data.(package private) voidwriteString(String str) Write a string as UTF8 encoded.voidwriteValueType(AnyType type) Write a value type.(package private) voidwriteVarint(long value) Write an integer value.(package private) voidwriteVaruint32(int value) Write an unsigned integer.Methods inherited from class LittleEndianOutputStream
reset, size, write, write, writeInt32, writeToMethods inherited from class FilterOutputStream
close, flush, writeMethods inherited from class OutputStream
nullOutputStream
-
Field Details
-
options
-
-
Constructor Details
-
WasmOutputStream
WasmOutputStream(WasmOptions options) Create a in memory stream.- Parameters:
options- compiler properties
-
WasmOutputStream
WasmOutputStream(WasmOptions options, OutputStream output) Create a wrapped stream.- Parameters:
options- compiler propertiesoutput- the target of data
-
-
Method Details
-
writeOpCode
Write a binary operation code.- Parameters:
op- a constant fromInstructionOpcodes- Throws:
IOException- if an I/O error occurs.
-
writeValueType
Write a value type.- Parameters:
type- a type constant- Throws:
IOException- if an I/O error occurs.
-
writeRefValueType
Write the value type. If it is a struct type then as reference type.- Parameters:
type- a type constant- Throws:
IOException- if an I/O error occurs.
-
writeDefaultValue
Write the default/initial value for a type.- Parameters:
type- the type- Throws:
IOException- if an I/O error occurs.
-
writeVaruint32
Write an unsigned integer.- Parameters:
value- the value- Throws:
IOException- if an I/O error occurs.
-
writeVarint
Write an integer value.- Parameters:
value- the value- Throws:
IOException- if an I/O error occurs.
-
writeFloat
Write an float value.- Parameters:
value- the value- Throws:
IOException- if an I/O error occurs.
-
writeDouble
Write an double value.- Parameters:
value- the value- Throws:
IOException- if an I/O error occurs.
-
writeConst
Write a constant number value- Parameters:
value- the valuevalueType- the data type of the number- Throws:
IOException- if any I/O error occur
-
writeString
Write a string as UTF8 encoded.- Parameters:
str- the string- Throws:
IOException- if any I/O error occur
-
writeSection
Write a section with header and data.- Parameters:
type- the name of the sectiondata- the data of the section- Throws:
IOException- if any I/O error occur
-