Class NameCustomSection


  • public class NameCustomSection
    extends CustomSection
    The "name" custom section.
    • Constructor Detail

      • NameCustomSection

        public NameCustomSection()
        Construct a new, empty section instance.
      • NameCustomSection

        public NameCustomSection​(byte[] bytes)
        Construct a new instance.
        Parameters:
        bytes - the byte content of the section
    • Method Detail

      • moduleName

        public String moduleName()
        {@return the module name, or null if none is set}
      • nameOfFunction

        public String nameOfFunction​(int functionIdx)
        {@return the name of the function with the given index, or null if none is set}
      • functionNameCount

        public int functionNameCount()
        {@return the number of function names in this section} This value does not have any relationship to the function index of any particular entry; it merely reflects the number of function names in this section. Used for testing.
      • nameOfLocal

        public String nameOfLocal​(int functionIdx,
                                  int localIdx)
        {@return the name of the local with the given index within the function with the given index, or null if none is set}
      • nameOfLabel

        public String nameOfLabel​(int functionIdx,
                                  int labelIdx)
        {@return the name of the local with the given index within the function with the given index, or null if none is set}
      • nameOfTable

        public String nameOfTable​(int tableIdx)
        {@return the name of the table with the given index, or null if none is set}
      • nameOfMemory

        public String nameOfMemory​(int memoryIdx)
        {@return the name of the memory with the given index, or null if none is set}
      • nameOfGlobal

        public String nameOfGlobal​(int globalIdx)
        {@return the name of the global with the given index, or null if none is set}
      • nameOfElement

        public String nameOfElement​(int elementIdx)
        {@return the name of the element with the given index, or null if none is set}
      • nameOfData

        public String nameOfData​(int dataIdx)
        {@return the name of the data segment with the given index, or null if none is set}
      • nameOfTag

        public String nameOfTag​(int tagIdx)
        {@return the name of the tag with the given index, or null if none is set}
      • setModuleName

        public String setModuleName​(String moduleName)
        Set the module name.
        Parameters:
        moduleName - the module name to set (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addFunctionName

        public String addFunctionName​(int functionIdx,
                                      String name)
        Add a function name to this section.
        Parameters:
        functionIdx - the index of the function to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addLocalName

        public String addLocalName​(int functionIdx,
                                   int localIdx,
                                   String name)
        Add a local name to this section.
        Parameters:
        functionIdx - the index of the function containing the local
        localIdx - the index of the local to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addLabelName

        public String addLabelName​(int functionIdx,
                                   int labelIdx,
                                   String name)
        Add a label name to this section.
        Parameters:
        functionIdx - the index of the function containing the label
        labelIdx - the index of the label to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addTableName

        public String addTableName​(int tableIdx,
                                   String name)
        Add a table name to this section.
        Parameters:
        tableIdx - the index of the table to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addMemoryName

        public String addMemoryName​(int memoryIdx,
                                    String name)
        Add a memory name to this section.
        Parameters:
        memoryIdx - the index of the memory to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addGlobalName

        public String addGlobalName​(int globalIdx,
                                    String name)
        Add a global name to this section.
        Parameters:
        globalIdx - the index of the global to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addElementName

        public String addElementName​(int elementIdx,
                                     String name)
        Add an element name to this section.
        Parameters:
        elementIdx - the index of the element to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addDataName

        public String addDataName​(int dataIdx,
                                  String name)
        Add a data segment name to this section.
        Parameters:
        dataIdx - the index of the data segment to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none
      • addTagName

        public String addTagName​(int tagIdx,
                                 String name)
        Add a tag name to this section.
        Parameters:
        tagIdx - the index of the tag to name
        name - the new name (must not be null)
        Returns:
        the previously set name, or null if there was none