ByteString

scalus.builtin.ByteString
See theByteString companion object
class ByteString

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

infix inline def ++(that: ByteString): ByteString
Extension method from ByteString

Concatenates two ByteStrings and returns a new ByteString

Concatenates two ByteStrings and returns a new ByteString

Attributes

infix inline def <(that: ByteString): Boolean
Extension method from ByteString

Checks if one 'ByteString' is less than another

Checks if one 'ByteString' is less than another

Attributes

infix inline def <=(that: ByteString): Boolean
Extension method from ByteString

Checks if one 'ByteString' is less than or equal to another

Checks if one 'ByteString' is less than or equal to another

Attributes

infix inline def >(that: ByteString): Boolean
Extension method from ByteString

Checks if one 'ByteString' is greater than another

Checks if one 'ByteString' is greater than another

Attributes

infix inline def >=(that: ByteString): Boolean
Extension method from ByteString

Checks if one 'ByteString' is greater than or equal to another

Checks if one 'ByteString' is greater than or equal to another

Attributes

def apply(i: Int): Byte

Gets byte by index

Gets byte by index

Offchain operation, not available onchain. Use ByteString.at for onchain access.

Attributes

inline def at(index: BigInt): BigInt
Extension method from ByteString

Returns the byte at the specified index in the ByteString

Returns the byte at the specified index in the ByteString

Attributes

Throws
BuiltinException

if the index is out of bounds (offchain)

Concatenates two ByteStrings and returns a new ByteString

Concatenates two ByteStrings and returns a new ByteString

Offchain operation, not available onchain.

Attributes

def drop(n: BigInt): ByteString
Extension method from ByteString

Drops the first n bytes from the ByteString

Drops the first n bytes from the ByteString

Value parameters

n

the number of bytes to drop

Attributes

Example
 hex"1234567890abcdef".drop(0) // returns hex"1234567890abcdef"
 hex"1234567890abcdef".drop(4) // returns hex"90abcdef"
 hex"1234567890abcdef".drop(20) // returns hex""
 hex"".drop(20) // returns hex""
override def equals(obj: Any): Boolean

Compares two ByteStrings for equality

Compares two ByteStrings for equality

Offchain operation, not available onchain. Use == for onchain equality checks.

Attributes

Definition Classes
Any
override def hashCode: Int

Calculates a hash code value for the object.

Calculates a hash code value for the object.

The default hashing algorithm is platform dependent.

Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

Attributes

Returns

the hash code value for this object.

Definition Classes
Any
def isEmpty: Boolean

Checks if the ByteString is empty

Checks if the ByteString is empty

Offchain operation, not available onchain.

Attributes

inline def length: BigInt
Extension method from ByteString

Returns the length of the ByteString

Returns the length of the ByteString

Attributes

def size: Int

The length of the ByteString

The length of the ByteString

Offchain operation, not available onchain.

Attributes

inline def slice(from: BigInt, len: BigInt): ByteString
Extension method from ByteString

Returns a new ByteString that is a slice of the original ByteString

Returns a new ByteString that is a slice of the original ByteString

Value parameters

from

the starting index of the slice (inclusive)

len

the length of the slice

Attributes

Example
 hex"1234567890abcdef".slice(2, 4) // returns hex"567890ab"
 hex"1234567890abcdef".slice(5, 4) // returns hex"abcdef"
 hex"1234567890abcdef".slice(9, 4) // returns hex""
 hex"1234567890abcdef".slice(0, 0) // returns hex""
inline def take(n: BigInt): ByteString
Extension method from ByteString

Takes the first n bytes from the ByteString

Takes the first n bytes from the ByteString

Value parameters

n

the number of bytes to take

Attributes

Example
 hex"1234567890abcdef".take(0) // returns hex""
 hex"1234567890abcdef".take(4) // returns hex"12345678"
 hex"1234567890abcdef".take(20) // returns hex"1234567890abcdef"
 hex"".take(20) // returns hex""
def toBinaryString: String

Converts the ByteString to a binary string representation

Converts the ByteString to a binary string representation

Offchain operation, not available onchain.

Attributes

override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any

Concrete fields

val bytes: Array[Byte]
val toHex: String

Converts the ByteString to a hexadecimal string representation

Converts the ByteString to a hexadecimal string representation

Offchain operation, not available onchain.

Attributes