本文整理匯總了C#中Blob.toString方法的典型用法代碼示例。如果您正苦於以下問題:C# Blob.toString方法的具體用法?C# Blob.toString怎麽用?C# Blob.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Blob
的用法示例。
在下文中一共展示了Blob.toString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: decodeControlResponse
/// <summary>
/// Decode input as a control parameters in NDN-TLV and set the fields of the
/// controlResponse object.
/// </summary>
///
/// <param name="controlResponse"></param>
/// <param name="input"></param>
/// <param name="copy">unchanged while the Blob values are used.</param>
/// <exception cref="EncodingException">For invalid encoding</exception>
public override void decodeControlResponse(ControlResponse controlResponse,
ByteBuffer input, bool copy)
{
TlvDecoder decoder = new TlvDecoder(input);
int endOffset = decoder
.readNestedTlvsStart(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_ControlResponse);
controlResponse.setStatusCode((int) decoder
.readNonNegativeIntegerTlv(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_StatusCode));
// Set copy false since we just immediately get a string.
Blob statusText = new Blob(
decoder.readBlobTlv(net.named_data.jndn.encoding.tlv.Tlv.NfdCommand_StatusText), false);
controlResponse.setStatusText(statusText.toString());
// Decode the body.
if (decoder
.peekType(net.named_data.jndn.encoding.tlv.Tlv.ControlParameters_ControlParameters, endOffset)) {
controlResponse.setBodyAsControlParameters(new ControlParameters());
// Decode into the existing ControlParameters to avoid copying.
decodeControlParameters(
controlResponse.getBodyAsControlParameters(), decoder, copy);
} else
controlResponse.setBodyAsControlParameters(null);
decoder.finishNestedTlvs(endOffset);
}