readToString
Reads a Modified UTF-8 string from the source and returns it as a String.
This method does not read the 2-byte "UTF length" that comes before standard Modified UTF-8 strings. That must be read separately (if applicable) and passed to this method via the mutf8Length parameter.
Return
a string of all the characters that were read, in order. Note that its length...
will never exceed mutf8Length
will only be
0if mutf8Length is also0will never be
0if mutf8Length is not0either
Parameters
The number of bytes used to encode the string. This must be at least 0 and at most 65535 (UShort.MAX_VALUE).
Unless an EOFException or IOException is thrown, this is exactly the number of bytes that are read by this method.
Throws
if mutf8Length exceeds UShort.MAX_VALUE.
if readBytes returns fewer bytes than expected by the mutf8Length.
if readBytes returns more bytes than expected by the mutf8Length.
if the second and/or third byte of a character does not have its most-significant bit set (1) and its second-most-significant bit unset (0), which is required for the second and third bytes of 2-byte and 3-byte characters. In other words, either byte's bits don't follow the pattern 10xx xxxx, where each x can be either a 1 or 0.