Interface: Bytes

Methods

size

size() returns rules.Integer

Returns the number of bytes in a Bytes sequence.

Returns

non-null rules.Integer the number of bytes.

Example

b'\xFF\xFF'.size() == 2
b'a'.size() == 1
b'€'.size() == 3 // 3-byte UTF-8 encoded string

toBase64

toBase64() returns rules.String

Returns the Base64-encoded string corresponding to the provided Bytes sequence.

Base64 encoding is performed per the base64url specification.

Returns

non-null rules.String a Base64-encoded string.

Example

b'\xFB\xEF\xBE'.toBase64() == '----'

toHexString

toHexString() returns rules.String

Returns the hexadecimal-encoded string corresponding to the provided Bytes sequence.

Returns

non-null rules.String a hexadecimal-encoded string.

Example

b'\x2A'.toHexString() == '2A'
b'**'.toHexString() == '2A2A'
b'€'.toHexString() == 'E282AC'