Class OracleBlob
The bytes of an Oracle Provider, AssetClass or URI field.
Inheritance
Namespace: Xrpl.Models.Common
Assembly: Xrpl.dll
Syntax
[JsonConverter(typeof(OracleBlobConverter))]
public sealed class OracleBlob
Remarks
These are Blob fields: rippled checks their length and nothing else
(OracleSet::preflight), so an oracle published by anyone may hold arbitrary bytes.
The value is therefore the bytes, not a string. A string could not tell the text
C328FF from the bytes C3 28 FF, and writing it back would sign the hex digits as text.
What is read is written back byte for byte.
A string converts implicitly, as text, so Provider = "chainlink" stores the ASCII
bytes of chainlink. Bytes given as hex go through FromHex(string). Reading the
value as text is TryGetText(out string), which declines bytes that are not printable ASCII.
Properties
| Edit this page View SourceBytes
The bytes of the field.
Declaration
public ReadOnlySpan<byte> Bytes { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlySpan<byte> |
Hex
The bytes as UPPERCASE hex, which is how rippled writes a Blob field in JSON.
Declaration
public string Hex { get; }
Property Value
| Type | Description |
|---|---|
| string |
IsText
Whether the bytes are printable ASCII (0x20-0x7E), the form these fields take when they hold text.
Declaration
public bool IsText { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceEquals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare with the current object. |
Returns
| Type | Description |
|---|---|
| bool | true if the specified object is equal to the current object; otherwise, false. |
Overrides
Equals(OracleBlob)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(OracleBlob other)
Parameters
| Type | Name | Description |
|---|---|---|
| OracleBlob | other | An object to compare with this object. |
Returns
| Type | Description |
|---|---|
| bool | true if the current object is equal to the |
FromBytes(ReadOnlySpan<byte>)
Creates the value from its bytes, which are copied.
Declaration
public static OracleBlob FromBytes(ReadOnlySpan<byte> bytes)
Parameters
| Type | Name | Description |
|---|---|---|
| ReadOnlySpan<byte> | bytes |
Returns
| Type | Description |
|---|---|
| OracleBlob |
FromHex(string)
Creates the value from its bytes written as hex, in either case.
Declaration
public static OracleBlob FromHex(string hex)
Parameters
| Type | Name | Description |
|---|---|---|
| string | hex | An even-length hex string; an empty string is zero bytes. |
Returns
| Type | Description |
|---|---|
| OracleBlob |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| FormatException |
|
FromText(string)
Creates the value from text, as its ASCII bytes.
Declaration
public static OracleBlob FromText(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | Printable ASCII text (U+0020-U+007E). |
Returns
| Type | Description |
|---|---|
| OracleBlob |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the current object. |
Overrides
ToArray()
Returns a copy of the bytes.
Declaration
public byte[] ToArray()
Returns
| Type | Description |
|---|---|
| byte[] |
ToString()
Returns Hex, the one form that stands for every value unambiguously.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
TryGetText(out string)
Reads the bytes as text when they are printable ASCII.
Declaration
public bool TryGetText(out string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text | The text, or |
Returns
| Type | Description |
|---|---|
| bool | Whether the bytes are text. |
Operators
| Edit this page View Sourceoperator ==(OracleBlob, OracleBlob)
Compares two values by their bytes.
Declaration
public static bool operator ==(OracleBlob left, OracleBlob right)
Parameters
| Type | Name | Description |
|---|---|---|
| OracleBlob | left | |
| OracleBlob | right |
Returns
| Type | Description |
|---|---|
| bool |
implicit operator OracleBlob(string)
Converts text to the value, as FromText(string) does; null stays null.
Declaration
public static implicit operator OracleBlob(string text)
Parameters
| Type | Name | Description |
|---|---|---|
| string | text |
Returns
| Type | Description |
|---|---|
| OracleBlob |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | The text is not printable ASCII. |
operator !=(OracleBlob, OracleBlob)
Compares two values by their bytes.
Declaration
public static bool operator !=(OracleBlob left, OracleBlob right)
Parameters
| Type | Name | Description |
|---|---|---|
| OracleBlob | left | |
| OracleBlob | right |
Returns
| Type | Description |
|---|---|
| bool |