本文整理汇总了C#中IDataSource.GetNext方法的典型用法代码示例。如果您正苦于以下问题:C# IDataSource.GetNext方法的具体用法?C# IDataSource.GetNext怎么用?C# IDataSource.GetNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataSource
的用法示例。
在下文中一共展示了IDataSource.GetNext方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
static ulong Get(IDataSource input)
{
byte b;
while ( ( b = input.GetNext() ) == SPACE ){
// Do nothing
}
var res = ( ulong ) b - ZERO;
while ( ( b = input.GetNext() ) != SPACE && b != ENTER ) {
res = res * 10 + b - ZERO;
}
return res;
}
示例2: DecodeData
public void DecodeData(IFactory factory, IDataSource istream, IDataProccess ostream, IFreqTableBuilder table)
{
var tail = ( byte ) ( istream.GetNext() - ZERO );
var count = ( int ) Get( istream );
while ( ( count-- ) != 0 ) {
table.AddPair( ( byte ) Get( istream ), Get( istream ) );
}
var tree = table.Create();
var root = tree.CreateRoot();
root.SetDecode();
while ( !istream.IsFinished() ) {
byte b = istream.GetNext(), i = BYTELENGHT;
if ( istream.IsFinished() && tail != 0 ) {
i = tail;
}
while ( ( i-- ) != 0 ) {
root.Decode( Number.CheckBit( b, i ), ostream );
}
}
}
示例3: EncodeData
public void EncodeData(IFactory factory, IDataSource istream, IDataProccess ostream, IFreqTableBuilder table)
{
while ( !istream.IsFinished() ) {
table.AddByte( istream.GetNext() );
}
istream.Reset();
var tree = table.Create();
var root = tree.CreateRoot();
ostream.OutString( tree.OutTable().ToString() );
var list = factory.CreateEncode();
while ( !istream.IsFinished() ) {
list = root.Encode( istream.GetNext() );
while ( list.Count() >= BYTELENGHT )
ostream.OutByte( list.ConverToByte( BYTELENGHT ) );
}
var listCount = ( byte ) list.Count();
if (listCount == 0) return;
ostream.OutByte( list.ConverToByte( listCount ) );
ostream.Reset();
ostream.OutString( listCount.ToString(CultureInfo.InvariantCulture) );
}