reads data from istream into a byte array, and calls
fromBytes with given encoding enc.
If maxlen is given, reads not more bytes than maxlen;
if maxlen was not given, or was <= 0, then
whole istream is read and closed afterwards.

reads data from istream into a byte array, and calls
fromBytes with given encoding enc.
If maxlen is given, reads not more bytes than maxlen;
if maxlen was not given, or was <= 0, then
whole istream is read and closed afterwards.

Parameters

istream - the input stream from which to read

enc - the encoding to apply to the bytes

maxlen - optionally, a positive int specifying maximum number of bytes to read