Class Encoding

java.lang.Object
com.dylibso.chicory.wasm.Encoding

public final class Encoding extends Object
  • Field Details

  • Method Details

    • 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 - the byte buffer
      Returns:
      the resulting long
    • 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 - the byte buffer
      Returns:
      the resulting long
    • 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 - the byte buffer
      Returns:
      the resulting long
    • 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 - the byte buffer
      Returns:
      the resulting long
    • 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 - the byte buffer
      Returns:
      the resulting long
    • 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 - the byte buffer
      Returns:
      the resulting long
    • readName

      public static String readName(ByteBuffer buffer, boolean checkMalformed)
      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
      checkMalformed - verify if it's a valid identifier
      Returns:
      the resulting long
    • readUnsignedLeb128

      public static long readUnsignedLeb128(ByteBuffer byteBuffer, int maxVarInt)
      Reads an unsigned integer from byteBuffer.
    • readSigned32Leb128

      public static long readSigned32Leb128(ByteBuffer byteBuffer)
      Reads an unsigned integer from byteBuffer.
    • readSigned64Leb128

      public static long readSigned64Leb128(ByteBuffer byteBuffer)