vibe.d beta banner
get vibe.d
0.7.30

Function readAllUTF8

Reads the complete contents of a stream, assuming UTF-8 encoding.

Prototype

string readAllUTF8(
  InputStream stream,
  bool sanitize = false,
  ulong max_bytes = 18446744073709551615LU
);

Parameters

NameDescription
stream Specifies the stream from which to read.
sanitize If true, the input data will not be validated but will instead be made valid UTF-8.
max_bytes Optional size limit of the data that is read.

Returns

The full contents of the stream, excluding a possible BOM, are returned as a UTF-8 string.

Throws

An exception is thrown if max_bytes != 0 and the stream contains more than max_bytes data. If the sanitize parameter is fals and the stream contains invalid UTF-8 code sequences, a UTFException is thrown.

Authors

Sönke Ludwig

Copyright

© 2012-2016 RejectedSoftware e.K.

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.