shadow:standard@CanIndex<long,ubyte>, shadow:standard@CanIndexStore<long,ubyte>, shadow:standard@CanCompare<shadow:standard@MutableString>, shadow:standard@CanHash
locked class MutableString
Class MutableString
holds arbitrary-length sequences of UTF-8 code points stored in a dynamic array of ubyte
values. MutableString
objects differ from String
objects in that their contents can be changed.
Modifiers | Return Types | Method and Description |
---|---|---|
public |
() |
create() Creates a new |
public |
() |
create(long capacity) Creates a new |
public |
() |
create(nullable Object initialValue) Creates a new |
Modifiers | Return Types | Method and Description |
---|---|---|
public |
() |
destroy() |
Modifiers | Return Types | Method and Description |
---|---|---|
public locked |
(MutableString) |
append(nullable Object value) Appends a |
public locked |
(MutableString) |
append(ubyte value) Appends a single |
public readonly locked |
(int) |
compare(MutableString other) Compares the current object to another |
public readonly |
(MutableString) |
copy(AddressMap addresses) |
public locked |
(MutableString) |
delete(long index) Deletes the byte value at the given offset, shortening the string representation by one byte. |
public locked |
(MutableString) |
delete(long start, long end) Deletes all the byte values from the starting offset up to but not including the ending offset, shortening the string representation by |
public locked |
(MutableString) |
ensureCapacity(long size) Guarantees that there is enough space in the |
public readonly locked |
(boolean) |
equal(MutableString other) Compares the current object to another |
public readonly locked |
(ubyte) |
index(long index) Retrieves the |
public locked |
() |
index(long index, ubyte value) Stores the given |
public locked |
(MutableString) |
insert(long index, nullable Object value) Inserts a |
public locked |
(MutableString) |
insert(long index, ubyte value) Inserts the given |
public locked |
(MutableString) |
prepend(nullable Object value) Prepends a |
public locked |
(MutableString) |
prepend(ubyte value) Prepends a single |
public locked |
(MutableString) |
reverse() Reverses the order of the |
public readonly locked |
(String) |
substring(long start, long end) Produces a substring of this string representation, from the starting byte offset up to but not including the ending byte offset. |
public readonly locked |
(String) |
toString() Produces an immutable |
Modifiers | Return Types | Method and Description |
---|---|---|
public readonly get locked |
(long) |
capacity() Retrieves the current capacity of the |
public get locked |
(ulong) |
hash() Finds a hash value for the current object. |
public get locked |
(int) |
size() Gets the number of |
public readonly get locked |
(long) |
sizeLong() Number of |
public create() => ()
Creates a new MutableString
with no code points and the capacity to hold 10 bytes worth of code points.
public create(long capacity) => ()
Creates a new MutableString
with no code points and the capacity to hold the specified number of bytes worth of code points.
capacity
- initial storage capacity in bytes
public create(nullable Object initialValue) => ()
Creates a new MutableString
containing the string representation of an object.
initialValue
- object whose string representation will fill the new MutableString
public destroy() => ()
public locked append(nullable Object value) => (MutableString)
Appends a String
representation of the given value to the end of the string representation.
value
- value to append
MutableString
object after append
public locked append(ubyte value) => (MutableString)
Appends a single ubyte
value to the end of the string representation.
value
- value to append
MutableString
object after append
public readonly locked compare(MutableString other) => (int)
Compares the current object to another MutableString
, returning -1
, 0
, or 1
, if the current object comes earlier, at exactly the same point, or later in a lexicographic ordering than the other value, respectively.
other
- value to compare to
whether earlier, identical, or later
public readonly copy(AddressMap addresses) => (MutableString)
public locked delete(long index) => (MutableString)
Deletes the byte value at the given offset, shortening the string representation by one byte.
index
- offset inside the object
MutableString
object after deletion
IndexOutOfBoundsException
- if the offset is illegal
public locked delete(long start, long end) => (MutableString)
Deletes all the byte values from the starting offset up to but not including the ending offset, shortening the string representation by end - start
bytes.
start
- starting offset
end
- ending offset
MutableString
object after deletion
IllegalArgumentException
- if either of the offsets is illegal
public locked ensureCapacity(long size) => (MutableString)
Guarantees that there is enough space in the MutableString
to hold the specified number of bytes. If there is insufficient space, this method will take the larger of the requested size and twice the current capacity, to avoid repeated resizes for a series of single byte additions.
size
- minimize number of bytes the MutableString
must be able to hold
current MutableString
object, possibly resized
public readonly locked equal(MutableString other) => (boolean)
Compares the current object to another MutableString
, returning true
if they are identical.
other
- object to compare to
true
if identical
public readonly locked index(long index) => (ubyte)
Retrieves the ubyte
value at the given offset inside the object.
index
- offset inside the object
ubyte
value
IndexOutOfBoundsException
- if the offset is illegal
public locked index(long index, ubyte value) => ()
Stores the given ubyte
value at the given offset inside the object.
index
- offset inside the object
value
- value to store
IndexOutOfBoundsException
- if the offset is illegal
public locked insert(long index, nullable Object value) => (MutableString)
Inserts a String
representation of the given value at the given offset inside the object, moving over any values coming after the offset
index
- offset inside the object
value
- value to store
MutableString
object after insertion
IndexOutOfBoundsException
- if the offset is illegal
public locked insert(long index, ubyte value) => (MutableString)
Inserts the given ubyte
value at the given offset inside the object, moving over any values coming after the offset
index
- offset inside the object
value
- value to store
IndexOutOfBoundsException
- if the offset is illegal
public locked prepend(nullable Object value) => (MutableString)
Prepends a String
representation of the given value to the beginning of the string representation, moving all other values down.
value
- value to append
MutableString
object after append
public locked prepend(ubyte value) => (MutableString)
Prepends a single ubyte
value to the beginning of the string representation, moving all other values down.
value
- value to prepend
MutableString
object after prepend
public locked reverse() => (MutableString)
Reverses the order of the ubyte
values stored in this string representation. Note that this method may not correctly reverse representations containing multi-byte code points.
reversed MutableString
object
public readonly locked substring(long start, long end) => (String)
Produces a substring of this string representation, from the starting byte offset up to but not including the ending byte offset.
start
- starting offset
end
- ending offset
substring
IllegalArgumentException
- if either of the offsets is illegal
public readonly locked toString() => (String)
Produces an immutable String
version of this string representation.
immutable String
version
public readonly get locked capacity() => (long)
Retrieves the current capacity of the MutableString
in bytes.
current capacity in bytes
public get locked hash() => (ulong)
Finds a hash value for the current object.
hash value
public get locked size() => (int)
Gets the number of ubyte
values stored as part of the string as an int
.
number of bytes
public readonly get locked sizeLong() => (long)
Number of ubyte
values stored as part of the string.