public class U8a extends java.lang.Object implements Codec
A basic wrapper around Uint8Array, with no frills and no fuss. It does differ from other implementations wher it will consume the full Uint8Array as passed to it. As such it is meant to be subclassed where the wrapper takes care of the actual lengths instead of used directly.
Modifier and Type | Field and Description |
---|---|
byte[] |
raw |
Constructor and Description |
---|
U8a(java.lang.Object value) |
Modifier and Type | Method and Description |
---|---|
boolean |
eq(java.lang.Object other)
Compares the value of the input to see if there is a match
|
int |
getEncodedLength()
The length of the value when encoded as a Uint8Array
|
boolean |
isEmpty()
Returns true if the type wraps an empty/default all-0 value
|
int |
length()
The length of the value
|
U8a |
subarray(int begin,
int end) |
java.lang.String |
toHex()
Returns a hex string representation of the value
|
java.lang.Object |
toJson()
Converts the Object to JSON, typically used for RPC transfers
|
java.lang.String |
toString()
Returns the string representation of the value
|
byte[] |
toU8a(boolean isBare) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getConstructorCodec, toU8a
public int getEncodedLength()
The length of the value when encoded as a Uint8Array
getEncodedLength
in interface Codec
public boolean isEmpty()
Returns true if the type wraps an empty/default all-0 value
public int length()
The length of the value
public boolean eq(java.lang.Object other)
Compares the value of the input to see if there is a match
public U8a subarray(int begin, int end)
begin
- The position to start atend
- The position to end at Create a new subarray from the actual buffer. This is needed for compat reasons since a new Uint8Array gets returned herepublic java.lang.String toHex()
Returns a hex string representation of the value
public java.lang.Object toJson()
Converts the Object to JSON, typically used for RPC transfers
public java.lang.String toString()
Returns the string representation of the value
toString
in class java.lang.Object