object Companion
source · line 102public companion : ValueEncoder<String>, ValueDecoder<String>, ValueInspector<String>
- Supertype
ValueEncoder<String> - Supertype
ValueDecoder<String> - Supertype
ValueInspector<String>
String construction and scalar encoding, decoding, and inspection operations.
function fromChars
source · line 124public fun fromChars(chars: List<Char>): String
Encodes the supplied Unicode scalars as a new UTF-8 string.
parameter chars
source · line 124chars: List<Char>
function fromUtf8OrNone
source · line 143public fun fromUtf8OrNone(bytes: List<Byte>): String?
Returns decoded UTF-8 text, or None for invalid encoding.
parameter bytes
source · line 143bytes: List<Byte>
function fromUtf8Lossy
source · line 148public fun fromUtf8Lossy(bytes: List<Byte>): String
Decodes UTF-8 while replacing malformed input with Unicode replacement characters.
parameter bytes
source · line 148bytes: List<Byte>
function fromUtf8Unchecked
source · line 129@Unsafe
public fun fromUtf8Unchecked(bytes: List<Byte>): String
Copies bytes that the unsafe caller guarantees are valid UTF-8.
parameter bytes
source · line 130bytes: List<Byte>
function fromUtf8
source · line 137public fun fromUtf8(bytes: List<Byte>): String
Validates and copies UTF-8 bytes. Invalid encoding throws CharacterCodingException; raw-pointer callers must provide readable, stable memory for the specified length.
parameter bytes
source · line 137bytes: List<Byte>
function inspect
source · line 106public override fun inspect(value: String): ValueView
- Overrides
inspect· ValueInspector
Observes the complete string as a text scalar.
parameter value
source · line 106value: String
function encode
source · line 112public override fun encode(value: String, encoder: Encoder): Unit
- Overrides
encode· ValueEncoder
Writes the string through the backend's text scalar operation.
parameter value
source · line 112value: String
parameter encoder
source · line 112encoder: Encoder
function fromUtf8
source · line 154@Unsafe
public fun fromUtf8(pointer: Ptr<UInt8>, length: Long): String
Validates and copies UTF-8 bytes. Invalid encoding throws CharacterCodingException; raw-pointer callers must provide readable, stable memory for the specified length.
parameter pointer
source · line 155pointer: Ptr<UInt8>
parameter length
source · line 155length: Long
function decode
source · line 118public override fun decode(decoder: Decoder): String
- Overrides
decode· ValueDecoder
Reads a string through the backend's text scalar operation.
parameter decoder
source · line 118decoder: Decoder
function fromCString
source · line 164@Unsafe
public fun fromCString(pointer: Ptr<Int8>): String
Copies and validates the UTF-8 bytes preceding the first NUL. The unsafe caller must keep the entire terminated region readable and stable.
parameter pointer
source · line 165pointer: Ptr<Int8>