Record Class DebuggerPcodeUtils.PrettyBytes

java.lang.Object
java.lang.Record
ghidra.pcode.exec.DebuggerPcodeUtils.PrettyBytes
Enclosing class:
DebuggerPcodeUtils

public static record DebuggerPcodeUtils.PrettyBytes(boolean bigEndian, byte[] bytes) extends Record
A wrapper on a byte array to pretty print it
  • Constructor Summary

    Constructors
    Constructor
    Description
    PrettyBytes(boolean bigEndian, byte[] bytes)
    Creates an instance of a PrettyBytes record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns the value of the bigEndian record component.
    byte[]
    Returns the value of the bytes record component.
    Collect various integer representations: signed, unsigned; decimal, hexadecimal
    boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Get the number of bytes
    toBigInteger(boolean signed)
    Convert the array to a big integer with the given signedness
    Render at most 256 bytes in lines of 16 space-separated bytes each
    Render the bytes as an unsigned decimal integer
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PrettyBytes

      public PrettyBytes(boolean bigEndian, byte[] bytes)
      Creates an instance of a PrettyBytes record class.
      Parameters:
      bigEndian - the value for the bigEndian record component
      bytes - the value for the bytes record component
  • Method Details

    • bytes

      public byte[] bytes()
      Returns the value of the bytes record component.
      Returns:
      the value of the bytes record component
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • toBytesString

      public String toBytesString()
      Render at most 256 bytes in lines of 16 space-separated bytes each

      If the total exceeds 256 bytes, the last line will contain ellipses and indicate the total size in bytes.

      Returns:
      the rendered string
    • toIntegerString

      public String toIntegerString()
      Render the bytes as an unsigned decimal integer

      The endianness is taken from bigEndian()

      Returns:
      the rendered string
    • collectDisplays

      public String collectDisplays()
      Collect various integer representations: signed, unsigned; decimal, hexadecimal

      This only presents those forms that differ from those already offered. The preferred form is unsigned decimal. If all four differ, then they are formatted on two lines: unsigned then signed.

      Returns:
      the rendered string
    • equals

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • toBigInteger

      public BigInteger toBigInteger(boolean signed)
      Convert the array to a big integer with the given signedness
      Parameters:
      signed - true for signed, false for unsigned
      Returns:
      the big integer
    • length

      public int length()
      Get the number of bytes
      Returns:
      the count
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • bigEndian

      public boolean bigEndian()
      Returns the value of the bigEndian record component.
      Returns:
      the value of the bigEndian record component