Class Parser


  • public final class Parser
    extends Object
    Parser for Web Assembly binaries.
    • Method Detail

      • 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 - 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)