Package com.dylibso.chicory.wasm
Class Encoding
java.lang.Object
com.dylibso.chicory.wasm.Encoding
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longstatic final intstatic final intstatic final long -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 StringreadName(ByteBuffer buffer, boolean checkMalformed) Read a symbol name from the buffer as UTF-8 String.static longreadSigned32Leb128(ByteBuffer byteBuffer) Reads an unsigned integer frombyteBuffer.static longreadSigned64Leb128(ByteBuffer byteBuffer) static longreadUnsignedLeb128(ByteBuffer byteBuffer, int maxVarInt) Reads an unsigned integer frombyteBuffer.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.
-
Field Details
-
MAX_VARINT_LEN_32
public static final int MAX_VARINT_LEN_32- See Also:
-
MAX_VARINT_LEN_64
public static final int MAX_VARINT_LEN_64- See Also:
-
MIN_SIGNED_INT
public static final long MIN_SIGNED_INT- See Also:
-
MAX_SIGNED_INT
public static final long MAX_SIGNED_INT- See Also:
-
MAX_UNSIGNED_INT
public static final long MAX_UNSIGNED_INT- See Also:
-
-
Method Details
-
readVarUInt32
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- the byte buffer- Returns:
- the resulting long
-
readVarSInt32
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- the byte buffer- Returns:
- the resulting long
-
readVarSInt64
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- the byte buffer- Returns:
- the resulting long
-
readFloat64
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- the byte buffer- Returns:
- the resulting long
-
readFloat32
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- the byte buffer- Returns:
- the resulting long
-
readName
Read a symbol name from the buffer as UTF-8 String. See 2.2.4. Names of the WebAssembly Core Specification.- Parameters:
buffer- the byte buffer- Returns:
- the resulting long
-
readName
Read a symbol name from the buffer as UTF-8 String. See 2.2.4. Names of the WebAssembly Core Specification.- Parameters:
buffer- the byte buffercheckMalformed- verify if it's a valid identifier- Returns:
- the resulting long
-
readUnsignedLeb128
Reads an unsigned integer frombyteBuffer. -
readSigned32Leb128
Reads an unsigned integer frombyteBuffer. -
readSigned64Leb128
-