Package ghidra.app.util.bin.format.golang.rtti

# Class GoVarlenString

java.lang.Object
ghidra.app.util.bin.format.golang.rtti.GoVarlenString

All Implemented Interfaces:
  `StructureReader<GoVarlenString>`

public class GoVarlenString extends Object implements StructureReader<GoVarlenString>
A pascal-ish string, using a LEB128 (or a uint16 in pre-1.16) value as the length of the following bytes.

Used mainly in lower-level RTTI structures, this class is a Ghidra'ism used to parse the Go RTTI data and does not have a counterpart in the Go src.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `GoVarlenString()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `byte[]`
  `getBytes()`
  Returns the raw bytes of the string
  `String`
  `getString()`
  Returns the string value.
  `int`
  `getStrlen()`
  Returns the string's length
  `DataTypeInstance`
  `getStrlenDataType()`
  Returns the data type that is needed to hold the string length field.
  `int`
  `getStrlenLen()`
  Returns the size of the string length field.
  `DataType`
  `getValueDataType()`
  Returns the data type that holds the raw string value.
  `void`
  `readStructure()`
  Called after an instance has been created and its context has been initialized, to give the struct a chance to deserialize itself using the BinaryReaders and such found in the context information.
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### GoVarlenString

    public GoVarlenString()

- ## Method Details

  - ### readStructure

    public void readStructure() throws IOException
    Description copied from interface: `StructureReader`
    Called after an instance has been created and its context has been initialized, to give the struct a chance to deserialize itself using the BinaryReaders and such found in the context information.
    Specified by:
      `readStructure` in interface `StructureReader<GoVarlenString>`
    Throws:
      `IOException` - if error deserializing data for this struct

  - ### getStrlen

    public int getStrlen()
    Returns the string's length
    Returns:
      string's length

  - ### getStrlenLen

    public int getStrlenLen()
    Returns the size of the string length field.
    Returns:
      size of the string length field

  - ### getBytes

    public byte[] getBytes()
    Returns the raw bytes of the string
    Returns:
      raw bytes of the string

  - ### getString

    public String getString()
    Returns the string value.
    Returns:
      string value

  - ### getStrlenDataType

    public DataTypeInstance getStrlenDataType()
    Returns the data type that is needed to hold the string length field.
    Returns:
      data type needed to hold the string length field

  - ### getValueDataType

    public DataType getValueDataType()
    Returns the data type that holds the raw string value.
    Returns:
      data type that holds the raw string value.

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`