當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。