Package ghidra.program.model.data
Class StringRenderBuilder
- java.lang.Object
-
- ghidra.program.model.data.StringRenderBuilder
-
public class StringRenderBuilder extends java.lang.ObjectHelper class used to build up a formatted (for human consumption) string representation returned by Unicode and String data types.Call
toString()to retrieve the formatted string.Example (quotes are part of result):
"Test\tstring",01,02,"Second\npart",00
-
-
Field Summary
Fields Modifier and Type Field Description static charDOUBLE_QUOTEstatic charSINGLE_QUOTE
-
Constructor Summary
Constructors Constructor Description StringRenderBuilder(int charSize)StringRenderBuilder(int charSize, char quoteChar)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddByteSeq(byte[] bytes)Add byte values, shown as numeric hex values.voidaddCodePointChar(int codePoint)Add a single character.voidaddCodePointValue(int codePoint)Add a single character that needs to be shown as a numeric hex value.voidaddEscapedChar(char ch)Append the specified char after an escaping backslash "\", ie "x" -> "\x";voidaddEscapedCodePoint(int codePoint)Add an unicode codepoint as its escaped hex value, with a escape character prefix of 'x', 'u' or 'U' depending on the magnitude of the codePoint value.voidaddString(java.lang.String str)Append the characters in the specified string.java.lang.StringtoString()Example (quotes are part of result):"Test\tstring",01,02,"Second\npart",00
-
-
-
Field Detail
-
DOUBLE_QUOTE
public static final char DOUBLE_QUOTE
- See Also:
- Constant Field Values
-
SINGLE_QUOTE
public static final char SINGLE_QUOTE
- See Also:
- Constant Field Values
-
-
Method Detail
-
addString
public void addString(java.lang.String str)
Append the characters in the specified string. The added characters will be shown in a quoted text region.- Parameters:
str- String to add
-
addEscapedChar
public void addEscapedChar(char ch)
Append the specified char after an escaping backslash "\", ie "x" -> "\x";- Parameters:
ch-
-
addCodePointChar
public void addCodePointChar(int codePoint)
Add a single character. It will be shown in a quoted text region.- Parameters:
codePoint- Character to add
-
addCodePointValue
public void addCodePointValue(int codePoint)
Add a single character that needs to be shown as a numeric hex value.- Parameters:
codePoint- Character to add
-
addByteSeq
public void addByteSeq(byte[] bytes)
Add byte values, shown as numeric hex values.{ 0, 1, 2 } -> 00,01,02
- Parameters:
bytes-
-
addEscapedCodePoint
public void addEscapedCodePoint(int codePoint)
Add an unicode codepoint as its escaped hex value, with a escape character prefix of 'x', 'u' or 'U' depending on the magnitude of the codePoint value.codePoint 15 -> '\' 'x' "0F"
codePoint 65535 -> '\' 'u' "FFFF"
codePoint 65536 -> '\' 'U' "10000"- Parameters:
codePoint- int value
-
toString
public java.lang.String toString()
Example (quotes are part of result):"Test\tstring",01,02,"Second\npart",00- Overrides:
toStringin classjava.lang.Object- Returns:
- Formatted string
-
-