CSharp examples for System.IO:BinaryReader
Read Utf8 String using BinaryReader
using System.Text; using System.IO;/*from ww w. j av a 2s. com*/ public class Main{ public static string ReadUtf8String(this BinaryReader br) { MemoryStream ms = new MemoryStream(); while (true) { byte a = br.ReadByte(); if (a == 0) break; ms.WriteByte(a); } return Encoding.UTF8.GetString(ms.GetBuffer(), 0, (int)ms.Length); } }