public AsyncReader(Stream stream, Encoding encoding, OnStringAvailable callback) { _stream = stream; _callbackText = callback; _decoder = encoding.GetDecoder(); _byteBuffer = new byte[1024]; _charBuffer = new char[encoding.GetMaxCharCount(_byteBuffer.Length)]; _eofEvent = new ManualResetEvent(false); _stream.BeginRead(_byteBuffer, 0, _byteBuffer.Length, read, null); }