Package ghidra.util

Interface GhidraDataConverter

All Superinterfaces:
DataConverter, Serializable
All Known Implementing Classes:
GhidraBigEndianDataConverter, GhidraLittleEndianDataConverter

public interface GhidraDataConverter extends DataConverter
  • Method Details

    • getInstance

      static GhidraDataConverter getInstance(boolean isBigEndian)
      Returns the correct GhidraDataConverter static instance for the requested endian-ness.
      Parameters:
      isBigEndian - boolean flag, true means big endian
      Returns:
      static GhidraDataConverter instance
    • getShort

      short getShort(MemBuffer buf, int offset) throws MemoryAccessException
      Generate a short value by invoking buf.getBytes at the specified offset.
      Parameters:
      buf - MemBuffer source of bytes
      offset - offset in mem buffer to read
      Returns:
      short value
      Throws:
      MemoryAccessException - if failed to read 2-bytes at the specified offset
    • getInt

      int getInt(MemBuffer buf, int offset) throws MemoryAccessException
      Generate a int value by invoking buf.getBytes at the specified offset.
      Parameters:
      buf - MemBuffer source of bytes
      offset - offset in mem buffer to read
      Returns:
      int value
      Throws:
      MemoryAccessException - if failed to read 4-bytes at the specified offset
    • getLong

      long getLong(MemBuffer buf, int offset) throws MemoryAccessException
      Generate a long value by invoking buf.getBytes at the specified offset.
      Parameters:
      buf - MemBuffer source of bytes
      offset - offset in mem buffer to read
      Returns:
      long value
      Throws:
      MemoryAccessException - if failed to read 8-bytes at the specified offset
    • getBigInteger

      BigInteger getBigInteger(MemBuffer buf, int offset, int size, boolean signed) throws MemoryAccessException
      Generate a BigInteger value by invoking buf.getBytes at the specified offset.
      Parameters:
      buf - MemBuffer source of bytes
      offset - offset in mem buffer to read
      size - number of bytes
      signed - boolean flag
      Returns:
      BigInteger value
      Throws:
      MemoryAccessException - if failed to read specified number of bytes at the specified offset