Click or drag to resize

Utf8String Class

A mutable string stored and serialized in utf-8 format.
Inheritance Hierarchy
SystemObject
  Ookii.Jumbo.IOUtf8String

Namespace: Ookii.Jumbo.IO
Assembly: Ookii.Jumbo (in Ookii.Jumbo.dll) Version: 0.3.0+dc1307f20e065bb638e0b73a34cd216f57e486f1
Syntax
public sealed class Utf8String : IWritable, 
	IEquatable<Utf8String>, IComparable<Utf8String>, IComparable, 
	ICloneable, ISpanFormattable, IFormattable, IUtf8SpanFormattable, ISpanParsable<Utf8String>, 
	IParsable<Utf8String>, IUtf8SpanParsable<Utf8String>

The Utf8String type exposes the following members.

Constructors
 NameDescription
Public methodUtf8String Initializes a new instance of the Utf8String class.
Public methodUtf8String(ReadOnlySpanByte) Initializes a new instance of the Utf8String class using the specified utf-8 span.
Public methodUtf8String(ReadOnlySpanChar) Initializes a new instance of the Utf8String class using the specified span of characters.
Public methodUtf8String(String) Initializes a new instance of the Utf8String class using the specified string.
Public methodUtf8String(Utf8String) Initializes a new instance of the Utf8String class that is a copy of the specified Utf8String.
Top
Properties
 NameDescription
Public propertyByteLength Gets the number of bytes in the encoded string.
Public propertyBytes Gets the bytes of the utf-8 encoded string.
Public propertyCapacity Gets or sets the maximum size, in bytes, of the string this instance can hold without resizing.
Public propertyCharLength Gets the length of the string in characters.
Top
Methods
 NameDescription
Public methodAppend(ReadOnlySpanByte) Appends a span containing utf-8 encoded data to this string.
Public methodAppend(Utf8String) Appends the specified Utf8String to this instance..
Public methodClone Creates a clone of the current Utf8String.
Public methodCompareTo(Object) Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Public methodCompareTo(Utf8String) Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Public methodEquals(Object) Tests this Utf8String for equality with the specified object.
(Overrides ObjectEquals(Object))
Public methodEquals(Utf8String) Tests this Utf8String for equality with the specified Utf8String.
Public methodGetHashCode Gets a hash code for this Utf8String.
(Overrides ObjectGetHashCode)
Public methodStatic memberGetLength Gets the length of a Utf8String stored in a byte array.
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodStatic memberParse(ReadOnlySpanByte, IFormatProvider)Parses a span of UTF-8 characters into a value.
Public methodStatic memberParse(ReadOnlySpanChar, IFormatProvider)Parses a span of characters into a value.
Public methodStatic memberParse(String, IFormatProvider)Parses a string into a value.
Public methodRead Reads the object from the specified reader.
Public methodSet(ReadOnlySpanByte) Sets the value of this Utf8String to the specified region of the specified byte array.
Public methodSet(ReadOnlySpanChar) Sets the value of this Utf8String to the specified span of characters.
Public methodSet(String) Sets the value of this Utf8String to the specified String.
Public methodSet(Utf8String) Sets the value of this Utf8String to the value of the specified Utf8String.
Public methodToString Gets a string representation of the current Utf8String.
(Overrides ObjectToString)
Public methodToString(String, IFormatProvider)Formats the value of the current instance using the specified format.
Public methodTryFormat(SpanByte, Int32, ReadOnlySpanChar, IFormatProvider)Tries to format the value of the current instance as UTF-8 into the provided span of bytes.
Public methodTryFormat(SpanChar, Int32, ReadOnlySpanChar, IFormatProvider)Tries to format the value of the current instance into the provided span of characters.
Public methodStatic memberTryParse(ReadOnlySpanByte, IFormatProvider, Utf8String)Tries to parse a span of UTF-8 characters into a value.
Public methodStatic memberTryParse(ReadOnlySpanChar, IFormatProvider, Utf8String)Tries to parse a span of characters into a value.
Public methodStatic memberTryParse(String, IFormatProvider, Utf8String)Tries to parse a string into a value.
Public methodWrite(BinaryWriter) Writes the object to the specified writer.
Public methodWrite(Stream) Writes this Utf8String to the specified stream.
Top
Operators
 NameDescription
Public operatorStatic memberEquality(Utf8String, Utf8String) Determines whether two specified Utf8String objects have the same value.
Public operatorStatic memberGreaterThan(Utf8String, Utf8String) Determines whether one specified Utf8String is greater than another specified Utf8String
Public operatorStatic memberGreaterThanOrEqual(Utf8String, Utf8String) Determines whether one specified Utf8String is greater than or equal to another specified Utf8String
Public operatorStatic memberInequality(Utf8String, Utf8String) Determines whether two specified Utf8String objects have different values.
Public operatorStatic memberLessThan(Utf8String, Utf8String) Determines whether one specified Utf8String is less than another specified Utf8String
Public operatorStatic memberLessThanOrEqual(Utf8String, Utf8String) Determines whether one specified Utf8String is less than or equal to another specified Utf8String
Top
Remarks
Caution note  Caution
The Utf8String class does not provide full utf-8 string manipulation. Its primary use is as a mutable serialization format, providing a IWritable record type that allows record reuse for strings. For string manipulation, conversion to/from String will typically be necessary.
Note  Note
Instances of the Utf8String class are compared per byte, and will not sort in proper lexicographical order if the string contains multi-byte characters. The only guarantee is that the ordering is deterministic.

Because this object is mutable you must take care when using it scenarios where immutability is expected, e.g. as a key in a DictionaryTKey, TValue.

See Also