Package ghidra.pcode.exec
Record Class DebuggerPcodeUtils.PrettyBytes
java.lang.Object
java.lang.Record
ghidra.pcode.exec.DebuggerPcodeUtils.PrettyBytes
- Enclosing class:
DebuggerPcodeUtils
A wrapper on a byte array to pretty print it
-
Constructor Summary
ConstructorsConstructorDescriptionPrettyBytes(boolean bigEndian, byte[] bytes) Creates an instance of aPrettyBytesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of thebigEndianrecord component.byte[]bytes()Returns the value of thebytesrecord component.Collect various integer representations: signed, unsigned; decimal, hexadecimalbooleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intlength()Get the number of bytestoBigInteger(boolean signed) Convert the array to a big integer with the given signednessRender at most 256 bytes in lines of 16 space-separated bytes eachRender the bytes as an unsigned decimal integertoString()Returns a string representation of this record class.
-
Constructor Details
-
PrettyBytes
public PrettyBytes(boolean bigEndian, byte[] bytes) Creates an instance of aPrettyBytesrecord class.- Parameters:
bigEndian- the value for thebigEndianrecord componentbytes- the value for thebytesrecord component
-
-
Method Details
-
bytes
public byte[] bytes()Returns the value of thebytesrecord component.- Returns:
- the value of the
bytesrecord component
-
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. -
toBytesString
Render at most 256 bytes in lines of 16 space-separated bytes eachIf the total exceeds 256 bytes, the last line will contain ellipses and indicate the total size in bytes.
- Returns:
- the rendered string
-
toIntegerString
Render the bytes as an unsigned decimal integerThe endianness is taken from
bigEndian()- Returns:
- the rendered string
-
collectDisplays
Collect various integer representations: signed, unsigned; decimal, hexadecimalThis 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
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
toBigInteger
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. -
bigEndian
public boolean bigEndian()Returns the value of thebigEndianrecord component.- Returns:
- the value of the
bigEndianrecord component
-