If thestream
is the stream with text then the following will get the text. Obviously a larger capacity can be specified for the buffer.
StringBuilder sb = new StringBuilder();
Windows.Storage.Streams.Buffer buffer = new(100);
await thestream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None);
while (buffer.Length > 0)
{
using (var dataReader = DataReader.FromBuffer(buffer))
{
dataReader.UnicodeEncoding = Windows.Storage.Streams.UnicodeEncoding.Utf8;
sb.Append(dataReader.ReadString(buffer.Length));
await thestream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None);
}
}