getString
Decodes a portion of the byte array to a String.
This function decodes a specified range of bytes within the byte array to a String, using UTF-8 character encoding. It allows you to convert a subset of bytes starting at a given offset
and continuing for numBytes
in length. Invalid characters will be replaced by the Unicode replacement character U+FFFD.
Return
A String containing the decoded characters. If numBytes
is 0, an empty String is returned.
Parameters
The starting index in the byte array from which to begin decoding. Must be a non-negative integer.
The number of bytes to decode, starting from the offset
. Must be a non-negative integer.
Throws
If the offset
or numBytes
is negative, or if the requested range (offset
+ numBytes
) extends beyond the bounds of the ByteArray
.