Package org.polkadot.types.primitive
Class Text
- java.lang.Object
-
- org.polkadot.types.primitive.Text
-
- All Implemented Interfaces:
java.lang.CharSequence,Codec
- Direct Known Subclasses:
Type
public class Text extends java.lang.Object implements Codec, java.lang.CharSequence
This is a string wrapper, along with the length. It is used both for strings as well as items such as documentation. It simply extends the standard JS `String` built-in object, inheriting all methods exposed from `String`.
-
-
Constructor Summary
Constructors Constructor Description Text(java.lang.Object value)
-
Method Summary
Modifier and Type Method Description charcharAt(int index)booleaneq(java.lang.Object other)Compares the value of the input to see if there is a matchintgetEncodedLength()The length of the value when encoded as a Uint8ArraybooleanisEmpty()Checks if the value is an empty valueintlength()The length of the valuejava.lang.CharSequencesubSequence(int start, int end)java.lang.StringtoHex()Returns a hex string representation of the valuejava.lang.ObjecttoJson()Converts the Object to JSON, typically used for RPC transfersjava.lang.StringtoString()Returns the string representation of the valuebyte[]toU8a(boolean isBare)Encodes the value as a Uint8Array as per the parity-codec specifications
-
-
-
Method Detail
-
getEncodedLength
public int getEncodedLength()
The length of the value when encoded as a Uint8Array- Specified by:
getEncodedLengthin interfaceCodec
-
isEmpty
public boolean isEmpty()
Checks if the value is an empty value
-
eq
public boolean eq(java.lang.Object other)
Compares the value of the input to see if there is a match
-
toHex
public java.lang.String toHex()
Returns a hex string representation of the value
-
toJson
public java.lang.Object toJson()
Converts the Object to JSON, typically used for RPC transfers
-
toString
public java.lang.String toString()
Returns the string representation of the value- Specified by:
toStringin interfacejava.lang.CharSequence- Overrides:
toStringin classjava.lang.Object
-
toU8a
public byte[] toU8a(boolean isBare)
Encodes the value as a Uint8Array as per the parity-codec specifications
-
length
public int length()
The length of the value- Specified by:
lengthin interfacejava.lang.CharSequence
-
charAt
public char charAt(int index)
- Specified by:
charAtin interfacejava.lang.CharSequence
-
subSequence
public java.lang.CharSequence subSequence(int start, int end)- Specified by:
subSequencein interfacejava.lang.CharSequence
-
-