HexFormat Class

Definition

HexFormat converts between bytes and chars and hex-encoded strings which may include additional formatting markup such as prefixes, suffixes, and delimiters.

[Android.Runtime.Register("java/util/HexFormat", ApiSince=34, DoNotGenerateAcw=true)]
public sealed class HexFormat : Java.Lang.Object
[<Android.Runtime.Register("java/util/HexFormat", ApiSince=34, DoNotGenerateAcw=true)>]
type HexFormat = class
    inherit Object
Inheritance
HexFormat
Attributes

Remarks

HexFormat converts between bytes and chars and hex-encoded strings which may include additional formatting markup such as prefixes, suffixes, and delimiters.

There are two factories of HexFormat with preset parameters #of() and #ofDelimiter(String) ofDelimiter(delimiter). For other parameter combinations the withXXX methods return copies of HexFormat modified #withPrefix(String), #withSuffix(String), #withDelimiter(String) or choice of #withUpperCase() or #withLowerCase() parameters.

For primitive to hexadecimal string conversions the toHexDigits methods include #toHexDigits(byte), #toHexDigits(int), and #toHexDigits(long), etc. The default is to use lowercase characters "0-9","a-f". For conversions producing uppercase hexadecimal the characters are "0-9","A-F". Only the HexFormat#isUpperCase() HexFormat.isUpperCase() parameter is considered; the delimiter, prefix and suffix are not used.

For hexadecimal string to primitive conversions the fromHexDigits methods include #fromHexDigits(CharSequence) fromHexDigits(string), #fromHexDigitsToLong(CharSequence) fromHexDigitsToLong(string), and #fromHexDigit(int) fromHexDigit(int) converts a single character or codepoint. For conversions from hexadecimal characters the digits and uppercase and lowercase characters in "0-9", "a-f", and "A-F" are converted to corresponding values 0-15. The delimiter, prefix, suffix, and uppercase parameters are not used.

For byte array to formatted hexadecimal string conversions the formatHex methods include #formatHex(byte[]) formatHex(byte[]) and #formatHex(Appendable, byte[]) formatHex(Appendable, byte[]). The formatted output is a string or is appended to an Appendable such as StringBuilder or java.io.PrintStream. Each byte value is formatted as the prefix, two hexadecimal characters from the uppercase or lowercase digits, and the suffix. A delimiter follows each formatted value, except the last. For conversions producing uppercase hexadecimal strings use #withUpperCase().

For formatted hexadecimal string to byte array conversions the parseHex methods include #parseHex(CharSequence) parseHex(CharSequence) and #parseHex(char[], int, int) parseHex(char[], offset, length). Each byte value is parsed from the prefix, two case insensitive hexadecimal characters, and the suffix. A delimiter follows each formatted value, except the last.

Added in 17.

Java documentation for java.util.HexFormat.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsUpperCase

Returns true if the hexadecimal digits are uppercase, otherwise false.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Delimiter()

Returns the delimiter between hexadecimal values in formatted hexadecimal strings.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FormatHex(Byte[])

Returns a hexadecimal string formatted from a byte array.

FormatHex(Byte[], Int32, Int32)

Returns a hexadecimal string formatted from a byte array range.

FormatHex(Object, Byte[])

Appends formatted hexadecimal strings from a byte array to the Appendable.

FormatHex(Object, Byte[], Int32, Int32)

Appends formatted hexadecimal strings from a byte array range to the Appendable.

FromHexDigit(Int32)

Returns the value for the hexadecimal character or codepoint.

FromHexDigits(ICharSequence)

Returns the int value parsed from a string of up to eight hexadecimal characters.

FromHexDigits(ICharSequence, Int32, Int32)

Returns the int value parsed from a string range of up to eight hexadecimal characters.

FromHexDigits(String)

Returns the int value parsed from a string of up to eight hexadecimal characters.

FromHexDigits(String, Int32, Int32)

Returns the int value parsed from a string range of up to eight hexadecimal characters.

FromHexDigitsToLong(ICharSequence)

Returns the long value parsed from a string of up to sixteen hexadecimal characters.

FromHexDigitsToLong(ICharSequence, Int32, Int32)

Returns the long value parsed from a string range of up to sixteen hexadecimal characters.

FromHexDigitsToLong(String)

Returns the long value parsed from a string of up to sixteen hexadecimal characters.

FromHexDigitsToLong(String, Int32, Int32)

Returns the long value parsed from a string range of up to sixteen hexadecimal characters.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsHexDigit(Int32)

Returns true if the character is a valid hexadecimal character or codepoint.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Of()

Returns a hexadecimal formatter with no delimiter and lowercase characters.

OfDelimiter(String)

Returns a hexadecimal formatter with the delimiter and lowercase characters.

ParseHex(Char[], Int32, Int32)

Returns a byte array containing hexadecimal values parsed from a range of the character array.

ParseHex(ICharSequence)

Returns a byte array containing hexadecimal values parsed from the string.

ParseHex(ICharSequence, Int32, Int32)

Returns a byte array containing hexadecimal values parsed from a range of the string.

ParseHex(String)

Returns a byte array containing hexadecimal values parsed from the string.

ParseHex(String, Int32, Int32)

Returns a byte array containing hexadecimal values parsed from a range of the string.

Prefix()

Returns the prefix used for each hexadecimal value in formatted hexadecimal strings.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
Suffix()

Returns the suffix used for each hexadecimal value in formatted hexadecimal strings.

ToArray<T>() (Inherited from Object)
ToHexDigits(Char)

Returns the four hexadecimal characters for the char value.

ToHexDigits(Int16)

Returns the four hexadecimal characters for the short value.

ToHexDigits(Int32)

Returns the eight hexadecimal characters for the int value.

ToHexDigits(Int64)

Returns the sixteen hexadecimal characters for the long value.

ToHexDigits(Int64, Int32)

Returns up to sixteen hexadecimal characters for the long value.

ToHexDigits(Object, SByte)

Appends two hexadecimal characters for the byte value to the Appendable.

ToHexDigits(SByte)

Returns the two hexadecimal characters for the byte value.

ToHighHexDigit(Int32)

Returns the hexadecimal character for the high 4 bits of the value considering it to be a byte.

ToLowHexDigit(Int32)

Returns the hexadecimal character for the low 4 bits of the value considering it to be a byte.

ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WithDelimiter(String)

Returns a copy of this HexFormat with the delimiter.

WithLowerCase()

Returns a copy of this HexFormat to use lowercase hexadecimal characters.

WithPrefix(String)

Returns a copy of this HexFormat with the prefix.

WithSuffix(String)

Returns a copy of this HexFormat with the suffix.

WithUpperCase()

Returns a copy of this HexFormat to use uppercase hexadecimal characters.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to