コード例 #1
0
        /// <summary>
        /// Decode the input using a particular wire format and update this Data. If
        /// wireFormat is the default wire format, also set the defaultWireEncoding
        /// field another pointer to the input Blob.
        /// </summary>
        ///
        /// <param name="input"></param>
        /// <param name="wireFormat">A WireFormat object used to decode the input.</param>
        /// <exception cref="EncodingException">For invalid encoding.</exception>
        public virtual void wireDecode(Blob input, WireFormat wireFormat)
        {
            int[] signedPortionBeginOffset = new int[1];
            int[] signedPortionEndOffset   = new int[1];
            wireFormat.decodeData(this, input.buf(), signedPortionBeginOffset,
                                  signedPortionEndOffset);

            if (wireFormat == net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat())
            {
                // This is the default wire encoding.
                setDefaultWireEncoding(new SignedBlob(input,
                                                      signedPortionBeginOffset[0], signedPortionEndOffset[0]),
                                       net.named_data.jndn.encoding.WireFormat.getDefaultWireFormat());
            }
            else
            {
                setDefaultWireEncoding(new SignedBlob(), null);
            }
        }