当前位置: 首页>>代码示例>>C#>>正文


C# Name.wireDecode方法代码示例

本文整理汇总了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;
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:48,代码来源:Sqlite3GroupManagerDb.cs

示例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;
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:44,代码来源:Sqlite3GroupManagerDb.cs

示例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);
        }
开发者ID:named-data,项目名称:ndn-dot-net,代码行数:33,代码来源:TestNameMethods.cs


注:本文中的net.named_data.jndn.Name.wireDecode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。