/// <summary> /// 异步读取指定IO流并即时返回直到该流结束(初始化完成后即开始读取) /// </summary> /// <param name="yourBaseStream">目标IO流</param> /// <param name="yourEncode">编码方式</param> /// <param name="dropAscStyle">是否丢弃ASC样式</param> /// <param name="yourGetAsynReadData">数据返回委托</param> public StreamAsynRead(Stream yourBaseStream, Encoding yourEncode, bool dropAscStyle, delegateGetStreamAsynReadEventHandler yourGetAsynReadData) { if (yourBaseStream == null) { throw new Exception("yourBaseStream is null"); } else { isDropAscStyle = dropAscStyle; baseStream = yourBaseStream; baseEncode = yourEncode; OnGetAsynReadData += yourGetAsynReadData; StartRead(); willKill = false; } }
public StreamAsynRead(Stream yourBaseStream, delegateGetStreamAsynReadEventHandler yourGetAsynReadData) : this(yourBaseStream, ASCIIEncoding.UTF8, false, yourGetAsynReadData) { }
public StreamAsynRead(Stream yourBaseStream, Encoding yourEncode, delegateGetStreamAsynReadEventHandler yourGetAsynReadData) : this(yourBaseStream, yourEncode, false, yourGetAsynReadData) { }