Package com.dylibso.chicory.wasm
Class Parser
- java.lang.Object
-
- com.dylibso.chicory.wasm.Parser
-
public final class Parser extends Object
Parser for Web Assembly binaries.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidincludeSection(int sectionId)ModuleparseModule(InputStream in)static longreadFloat32(ByteBuffer buffer)Read a F32 from the buffer which fits neatly into a long.static longreadFloat64(ByteBuffer buffer)Read a F64 from the buffer which fits neatly into a long.static StringreadName(ByteBuffer buffer)Read a symbol name from the buffer as UTF-8 String.static longreadVarSInt32(ByteBuffer buffer)Read a signed I32 from the buffer.static longreadVarSInt64(ByteBuffer buffer)Read a signed I64 from the buffer which fits neatly into a long.static longreadVarUInt32(ByteBuffer buffer)Read an unsigned I32 from the buffer.
-
-
-
Method Detail
-
parseModule
public Module parseModule(InputStream in)
-
includeSection
public void includeSection(int sectionId)
-
readVarUInt32
public static long readVarUInt32(ByteBuffer buffer)
Read an unsigned I32 from the buffer. We can't fit an unsigned 32bit int into a java int, so we must use a long. See 2.2.2. Integers of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
readVarSInt32
public static long readVarSInt32(ByteBuffer buffer)
Read a signed I32 from the buffer. We can't fit an unsigned 32bit int into a java int, so we must use a long to use the same type as unsigned. See 2.2.2. Integers of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
readVarSInt64
public static long readVarSInt64(ByteBuffer buffer)
Read a signed I64 from the buffer which fits neatly into a long. See 2.2.2. Integers of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
readFloat64
public static long readFloat64(ByteBuffer buffer)
Read a F64 from the buffer which fits neatly into a long. See 2.2.3. Floating-Point of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
readFloat32
public static long readFloat32(ByteBuffer buffer)
Read a F32 from the buffer which fits neatly into a long. See 2.2.3. Floating-Point of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
readName
public static String readName(ByteBuffer buffer)
Read a symbol name from the buffer as UTF-8 String. See 2.2.4. Names of the WebAssembly Core Specification.- Parameters:
buffer-- Returns:
-
-