Package ghidra.util.charset
Class CharsetInfo
java.lang.Object
ghidra.util.charset.CharsetInfo
Additional information about
java.nio.charset.Charset's that
Ghidra needs to be able to create Ghidra string datatype instances.
See charset_info.json to specify info about a custom charset.
-
Constructor Summary
ConstructorsConstructorDescriptionCharsetInfo(String name, String comment, int minBytesPerChar, int maxBytesPerChar, int alignment, int codePointCount, boolean standardCharset, boolean canProduceError, EnumSet<Character.UnicodeScript> scripts, Set<String> contains) CharsetInfo(Charset cs) -
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturns the alignment value for this charset, typically 1 for most charsets, but for well-known fixed-width charsets, it will return those charsets fixed-width.intReturns the number of codepoints that this charset can produce.Returns a string comment describing this charset, or null.Returns the names of other charsets that this charsetCharset.contains(Charset).intReturns the largest number of bytes needed to produce a codepoint.intReturns the smallest number of bytes needed to produce a codepoint.getName()Returns name of the charset.Returns the UnicodeScripts that this charset can produce.booleanReturns true if this charset only consumes a fixed number of bytes per output codepoint.inthashCode()booleanReturns true if this charset can produce Unicode REPLACEMENT codepoints for bad byte sequences, otherwise false if there are no byte sequences that result in REPLACEMENT codepoints. This is typically single-byte charsets that map all byte values to a codepoint.booleanReturns boolean flag, true if this is a standard charset that is guaranteed to be present in the jvm, otherwise false.booleanReturns true if this charset can produce Unicode codepoints that are in all scripts.toString()withComment(String newComment) Returns a copy of this instance, with a new comment value.
-
Constructor Details
-
CharsetInfo
-
CharsetInfo
-
-
Method Details
-
withComment
Returns a copy of this instance, with a new comment value.- Parameters:
newComment- string- Returns:
- a copy of this instance, with a new comment value
-
getCharset
- Returns:
Charset
-
getName
Returns name of the charset.- Returns:
- name of the charset
-
isStandardCharset
public boolean isStandardCharset()Returns boolean flag, true if this is a standard charset that is guaranteed to be present in the jvm, otherwise false.- Returns:
- boolean flag, true if this is a standard charset that is guaranteed to be present in the jvm, otherwise false
-
isCanProduceError
public boolean isCanProduceError()Returns true if this charset can produce Unicode REPLACEMENT codepoints for bad byte sequences, otherwise false if there are no byte sequences that result in REPLACEMENT codepoints. This is typically single-byte charsets that map all byte values to a codepoint.- Returns:
- true if this charset can produce Unicode REPLACEMENT codepoints for bad byte sequences, otherwise false if there are no byte sequences that result in REPLACEMENT codepoints. This is typically single-byte charsets that map all byte values to a codepoint
-
supportsAllScripts
public boolean supportsAllScripts()Returns true if this charset can produce Unicode codepoints that are in all scripts.- Returns:
- true if this charset can produce Unicode codepoints that are in all scripts
-
getScripts
Returns the UnicodeScripts that this charset can produce.- Returns:
- the UnicodeScripts that this charset can produce
-
hasFixedLengthChars
public boolean hasFixedLengthChars()Returns true if this charset only consumes a fixed number of bytes per output codepoint.- Returns:
- true if this charset only consumes a fixed number of bytes per output codepoint
-
getAlignment
public int getAlignment()Returns the alignment value for this charset, typically 1 for most charsets, but for well-known fixed-width charsets, it will return those charsets fixed-width.- Returns:
- the alignment value for this charset, typically 1 for most charsets, but for well-known fixed-width charsets, it will return those charsets fixed-width
-
getMinBytesPerChar
public int getMinBytesPerChar()Returns the smallest number of bytes needed to produce a codepoint.- Returns:
- the smallest number of bytes needed to produce a codepoint
-
getMaxBytesPerChar
public int getMaxBytesPerChar()Returns the largest number of bytes needed to produce a codepoint.- Returns:
- the largest number of bytes needed to produce a codepoint
-
getCodePointCount
public int getCodePointCount()Returns the number of codepoints that this charset can produce.- Returns:
- the number of codepoints that this charset can produce
-
getContains
Returns the names of other charsets that this charsetCharset.contains(Charset).- Returns:
- names of other charsets
-
getComment
Returns a string comment describing this charset, or null.- Returns:
- a string comment describing this charset, or null
-
hashCode
public int hashCode() -
equals
-
toString
-