本文整理汇总了C#中net.named_data.jndn.Name.wireDecode方法的典型用法代码示例。如果您正苦于以下问题:C# Name.wireDecode方法的具体用法?C# Name.wireDecode怎么用?C# Name.wireDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.named_data.jndn.Name
的用法示例。
在下文中一共展示了Name.wireDecode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getScheduleMembers
/// <summary>
/// For each member using the given schedule, get the name and public key DER
/// of the member's key.
/// </summary>
///
/// <param name="name">The name of the schedule.</param>
/// <returns>a new Map where the map's key is the Name of the public key and the
/// value is the Blob of the public key DER. (Use Map without generics so it
/// works with older Java compilers.) Note that the member's identity name is
/// keyName.getPrefix(-1). If the schedule name is not found, the map is empty.</returns>
/// <exception cref="GroupManagerDb.Error">for a database error.</exception>
public override IDictionary getScheduleMembers(String name)
{
IDictionary map = new Hashtable();
try {
PreparedStatement statement = database_
.prepareStatement(net.named_data.jndn.encrypt.Sqlite3GroupManagerDbBase.SELECT_getScheduleMembers);
statement.setString(1, name);
try {
SqlDataReader result = statement.executeQuery();
while (result.NextResult()) {
Name keyName = new Name();
try {
keyName.wireDecode(new Blob(result.getBytes(1), false),
net.named_data.jndn.encoding.TlvWireFormat.get());
} catch (EncodingException ex) {
// We don't expect this to happen.
throw new GroupManagerDb.Error(
"Sqlite3GroupManagerDb.getScheduleMembers: Error decoding name: "
+ ex);
}
ILOG.J2CsMapping.Collections.Collections.Put(map,keyName,new Blob(result.getBytes(2), false));
}
} finally {
statement.close();
}
} catch (SQLException exception) {
throw new GroupManagerDb.Error(
"Sqlite3GroupManagerDb.getScheduleMembers: SQLite error: "
+ exception);
}
return map;
}
示例2: listAllMembers
/// <summary>
/// List all the members.
/// </summary>
///
/// <returns>A new List of Name with the names of all members. (Use List without
/// generics so it works with older Java compilers.)</returns>
/// <exception cref="GroupManagerDb.Error">for a database error.</exception>
public override IList listAllMembers()
{
IList list = new ArrayList();
try {
PreparedStatement statement = database_
.prepareStatement(net.named_data.jndn.encrypt.Sqlite3GroupManagerDbBase.SELECT_listAllMembers);
try {
SqlDataReader result = statement.executeQuery();
while (result.NextResult()) {
Name identity = new Name();
try {
identity.wireDecode(
new Blob(result.getBytes(1), false),
net.named_data.jndn.encoding.TlvWireFormat.get());
} catch (EncodingException ex) {
// We don't expect this to happen.
throw new GroupManagerDb.Error(
"Sqlite3GroupManagerDb.listAllMembers: Error decoding name: "
+ ex);
}
ILOG.J2CsMapping.Collections.Collections.Add(list,identity);
}
} finally {
statement.close();
}
} catch (SQLException exception) {
throw new GroupManagerDb.Error(
"Sqlite3GroupManagerDb.listAllMembers: SQLite error: "
+ exception);
}
return list;
}
示例3: testEncodeDecode
public void testEncodeDecode()
{
Name name = new Name("/local/ndn/prefix");
Blob encoding = name.wireEncode(net.named_data.jndn.encoding.TlvWireFormat.get());
Assert.AssertTrue(encoding.equals(new Blob(TEST_NAME, false)));
Name decodedName = new Name();
try {
decodedName.wireDecode(new Blob(TEST_NAME, false),
net.named_data.jndn.encoding.TlvWireFormat.get());
} catch (EncodingException ex) {
Assert.Fail("Can't decode TEST_NAME");
}
Assert.AssertEquals(decodedName, name);
// Test ImplicitSha256Digest.
Name name2 = new Name(
"/local/ndn/prefix/sha256digest="
+ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f");
Blob encoding2 = name2.wireEncode(net.named_data.jndn.encoding.TlvWireFormat.get());
Assert.AssertTrue(encoding2.equals(new Blob(TEST_NAME_IMPLICIT_DIGEST, false)));
Name decodedName2 = new Name();
try {
decodedName2.wireDecode(new Blob(TEST_NAME_IMPLICIT_DIGEST, false),
net.named_data.jndn.encoding.TlvWireFormat.get());
} catch (EncodingException ex_0) {
Assert.Fail("Can't decode TEST_NAME");
}
Assert.AssertEquals(decodedName2, name2);
}