本文整理汇总了C#中LumiSoft.Net.IO.SmartStream.BeginReadLine方法的典型用法代码示例。如果您正苦于以下问题:C# SmartStream.BeginReadLine方法的具体用法?C# SmartStream.BeginReadLine怎么用?C# SmartStream.BeginReadLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LumiSoft.Net.IO.SmartStream
的用法示例。
在下文中一共展示了SmartStream.BeginReadLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadToTerminatorAsyncOperation
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="owner">Owner stream.</param>
/// <param name="terminator">Data terminator.</param>
/// <param name="storeStream">Stream where to store readed header.</param>
/// <param name="maxCount">Maximum number of bytes to read. Value 0 means not limited.</param>
/// <param name="exceededAction">Specifies how this method behaves when maximum line size exceeded.</param>
/// <param name="callback">The AsyncCallback delegate that is executed when asynchronous operation completes.</param>
/// <param name="asyncState">User-defined object that qualifies or contains information about an asynchronous operation.</param>
/// <exception cref="ArgumentNullException">Is raised when <b>owner</b>,<b>terminator</b> or <b>storeStream</b> is null reference.</exception>
public ReadToTerminatorAsyncOperation(SmartStream owner,string terminator,Stream storeStream,long maxCount,SizeExceededAction exceededAction,AsyncCallback callback,object asyncState)
{
if(owner == null){
throw new ArgumentNullException("owner");
}
if(terminator == null){
throw new ArgumentNullException("terminator");
}
if(storeStream == null){
throw new ArgumentNullException("storeStream");
}
if(maxCount < 0){
throw new ArgumentException("Argument 'maxCount' must be >= 0.");
}
m_pOwner = owner;
m_Terminator = terminator;
m_pTerminatorBytes = Encoding.ASCII.GetBytes(terminator);
m_pStoreStream = storeStream;
m_MaxCount = maxCount;
m_SizeExceededAction = exceededAction;
m_pAsyncCallback = callback;
m_pAsyncState = asyncState;
m_pAsyncWaitHandle = new AutoResetEvent(false);
m_pLineBuffer = new byte[32000];
// Start reading data.
#pragma warning disable
m_pOwner.BeginReadLine(m_pLineBuffer,0,m_pLineBuffer.Length - 2,m_SizeExceededAction,new AsyncCallback(this.ReadLine_Completed),null);
#pragma warning restore
}