Package convex.core.data
Class Strings
java.lang.Object
convex.core.data.Strings
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringShort
static final StringShort
static final StringShort
static final StringShort
static final byte
Byte value used for looking outside a String 0xff (-1) is invalid UTF-8static final StringShort
static final StringShort
static final int
static final StringShort
static final StringShort
static final StringShort
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AString
static AString
static AString
Create a canonical CVM String from a regular Java Stringstatic StringShort
empty()
static AString
Constructs a UTF-8 CVM String from raw hex digits.static CharsetDecoder
static AString
Creates a string by joining a sequence of substrings with the given separatorstatic AString
Creates a String by joining a sequence of substrings with the given separatorstatic AString
Reads a String from a Blob encoding.
-
Field Details
-
EMPTY
-
NIL
-
TRUE
-
FALSE
-
BAD_SIGNATURE
-
BAD_FORMAT
-
SERVER_LOADED
-
COLON
-
HEX_PREFIX
-
MAX_ENCODING_LENGTH
public static final int MAX_ENCODING_LENGTH -
EXCESS_BYTE
public static final byte EXCESS_BYTEByte value used for looking outside a String 0xff (-1) is invalid UTF-8- See Also:
-
-
Constructor Details
-
Strings
public Strings()
-
-
Method Details
-
read
Reads a String from a Blob encoding.- Parameters:
blob
- Blob to read fromoffset
- Offset withing blob- Returns:
- String instance
- Throws:
BadFormatException
- If any problem with encoding
-
create
Create a canonical CVM String from a regular Java String- Parameters:
s
- Java String to convert.- Returns:
- CVM String instance.
-
join
Creates a string by joining a sequence of substrings with the given separator- Parameters:
ss
- Sequence of Strings to joinseparator
- any String to use as a separator.- Returns:
- Concatenated String, including the separator. Will return the empty string if the seqence is empty.
-
join
Creates a String by joining a sequence of substrings with the given separator- Parameters:
ss
- Sequence of Strings to joinseparator
- any CVM Character to use as a separator.- Returns:
- Concatenated String, including the separator. Will return the empty string if the sequence is empty.
-
create
-
fromHex
Constructs a UTF-8 CVM String from raw hex digits. This does not perform checking of valid UTF: It is possible to construct bad strings this way. This is allowable on the CVM, and useful for testing.- Parameters:
hexString
- String containing hex digits- Returns:
- New CVM String (possibly not valid UTF)
-
empty
-
getDecoder
-
appendAll
-