Пример #1
0
        }  // DecodeRawBinaryDataUsingTypeIDs

        /// <summary>
        /// Given IDs of records types registered with Kinetica, decode binary
        /// data into distinct records (objects).
        /// </summary>
        /// <typeparam name="T">The type of the records.</typeparam>
        /// <param name="type_ids">The IDs for each of the lists of records.</param>
        /// <param name="lists_records_binary">The binary encoded data to be decoded in a 2d list.</param>
        /// <param name="record_lists">The decoded objects/records in a 2d list.</param>
        public void DecodeRawBinaryDataUsingTypeIDs <T>(IList <string> type_ids,
                                                        IList <IList <byte[]> > lists_records_binary,
                                                        IList <IList <T> > record_lists) where T : new()
        {
            // Make sure that the length of the type IDs and records are the same
            if (type_ids.Count != lists_records_binary.Count)
            {
                throw new KineticaException("Unequal numbers of type IDs and binary encoded data objects provided.");
            }

            // Decode all the records
            for (int i = 0; i < lists_records_binary.Count; ++i)
            {
                // Per object, use the respective type ID to create the appropriate KineticaType
                KineticaType ktype = KineticaType.fromTypeID(this, type_ids[i]);

                // Get the binary encoded data for this list
                IList <byte[]> records_binary = lists_records_binary[i];

                // Create a container to put the decoded records
                IList <T> records = new List <T>();

                // The inner list actually contains the binary data
                foreach (var bin_record in records_binary)
                {
                    // Using the KineticaType object, decode the record.
                    T obj = AvroDecode <T>(bin_record, ktype);
                    records.Add(obj);
                }
                // Add the records into the outgoing list
                record_lists.Add(records);
            }
        }  // DecodeRawBinaryDataUsingTypeIDs
Пример #2
0
        }  // DecodeRawBinaryDataUsingSchemaString

        /// <summary>
        /// Given IDs of records types registered with Kinetica, decode binary
        /// data into distinct records (objects).
        /// </summary>
        /// <typeparam name="T">The type of the records.</typeparam>
        /// <param name="type_ids">The IDs for each of the records' types.</param>
        /// <param name="records_binary">The binary encoded data to be decoded.</param>
        /// <param name="records">The decoded objects/records.</param>
        public void DecodeRawBinaryDataUsingTypeIDs <T>(IList <string> type_ids,
                                                        IList <byte[]> records_binary,
                                                        IList <T> records) where T : new()
        {
            // Make sure that the length of the type IDs and records are the same
            if (type_ids.Count != records_binary.Count)
            {
                throw new KineticaException("Unequal numbers of type IDs and binary encoded data objects provided.");
            }

            // Decode all the records
            for (int i = 0; i < records_binary.Count; ++i)
            {
                // Per object, use the respective type ID to create the appropriate KineticaType
                KineticaType ktype = KineticaType.fromTypeID(this, type_ids[i]);

                // Using the KineticaType object, decode the record.
                T obj = AvroDecode <T>(records_binary[i], ktype);
                records.Add(obj);
            }
        }  // DecodeRawBinaryDataUsingTypeIDs