Reads at most max-size bytes as a string.
The read bytes are consumed.
Note that this method is different from read followed by to_string as it ensures that the data is split into valid UTF-8 chunks. If max-size is specified the returned string will never be larger than that size (in bytes), but it may be smaller, even if there is more data available from the underlying reader.
Returns null if the stream has ended.
Errors
The read bytes must be convertible to a legal UTF8 string, but this method will read a number of bytes such that legal UTF-8 characters are not chopped up.
May throw an end-of-stream exception if the stream ends in the middle of a malformed UTF-8 character.
Instead of returning a zero length string it throws an exception. This can happen if max-size is less than 4 bytes and the next thing is a UTF-8 character that is coded in more bytes than were requested. This also means max-size should never be zero.