Show / Hide Table of Contents

Class OracleBlob

The bytes of an Oracle Provider, AssetClass or URI field.

Inheritance
object
OracleBlob
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 Source

Bytes

The bytes of the field.

Declaration
public ReadOnlySpan<byte> Bytes { get; }
Property Value
Type Description
ReadOnlySpan<byte>
| Edit this page View Source

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
| Edit this page View Source

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 Source

Equals(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
object.Equals(object)
| Edit this page View Source

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 other parameter; otherwise, false.

| Edit this page View Source

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
| Edit this page View Source

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

hex is null.

FormatException

hex is not an even-length hex string.

| Edit this page View Source

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

text is null.

ArgumentException

text holds a character outside printable ASCII, which has no single byte to stand for it.

| Edit this page View Source

GetHashCode()

Serves as the default hash function.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for the current object.

Overrides
object.GetHashCode()
| Edit this page View Source

ToArray()

Returns a copy of the bytes.

Declaration
public byte[] ToArray()
Returns
Type Description
byte[]
| Edit this page View Source

ToString()

Returns Hex, the one form that stands for every value unambiguously.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
| Edit this page View Source

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 null when the bytes are not printable ASCII.

Returns
Type Description
bool

Whether the bytes are text.

Operators

| Edit this page View Source

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
| Edit this page View Source

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.

| Edit this page View Source

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
  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX