本文整理汇总了C#中Apache.Qpid.Buffer.ByteBuffer.GetHexDump方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.GetHexDump方法的具体用法?C# ByteBuffer.GetHexDump怎么用?C# ByteBuffer.GetHexDump使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Apache.Qpid.Buffer.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.GetHexDump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoDecode
protected override bool DoDecode(ByteBuffer input, IProtocolDecoderOutput output)
{
MessageDecoderResult result;
if (_currentDecoder == null)
{
IMessageDecoder[] decoders = _decoders;
int undecodables = 0;
for (int i = decoders.Length - 1; i >= 0; i --)
{
IMessageDecoder decoder = decoders[i];
int limit = input.Limit;
int pos = input.Position;
try
{
result = decoder.Decodable(input);
}
finally
{
input.Position = pos;
input.Limit = limit;
}
if (result == MessageDecoderResult.OK)
{
_currentDecoder = decoder;
break;
}
else if(result == MessageDecoderResult.NOT_OK)
{
undecodables ++;
}
else if (result != MessageDecoderResult.NEED_DATA)
{
throw new Exception("Unexpected decode result (see your decodable()): " + result);
}
}
if (undecodables == _decoders.Length)
{
// Throw an exception if all decoders cannot decode data.
input.Position = input.Limit; // Skip data
throw new ProtocolDecoderException(
"No appropriate message decoder: " + input.GetHexDump());
}
if (_currentDecoder == null)
{
// Decoder is not determined yet (i.e. we need more data)
return false;
}
}
result = _currentDecoder.Decode(input, output);
if (result == MessageDecoderResult.OK)
{
_currentDecoder = null;
return true;
}
else if (result == MessageDecoderResult.NEED_DATA)
{
return false;
}
else if (result == MessageDecoderResult.NOT_OK)
{
throw new ProtocolDecoderException("Message decoder returned NOT_OK.");
}
else
{
throw new Exception("Unexpected decode result (see your decode()): " + result);
}
}