Пример #1
0
        /// <summary>
        /// Decode the input using a particular wire format and update this Interest. If
        /// wireFormat is the default wire format, also set the defaultWireEncoding
        /// field another pointer to the input Blob.
        /// </summary>
        ///
        /// <param name="input">The input blob to decode.</param>
        /// <param name="wireFormat">A WireFormat object used to decode the input.</param>
        /// <exception cref="EncodingException">For invalid encoding.</exception>
        public void wireDecode(Blob input, WireFormat wireFormat)
        {
            int[] signedPortionBeginOffset = new int[1];
            int[] signedPortionEndOffset   = new int[1];
            wireFormat.decodeInterest(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);
            }
        }
Пример #2
0
        private void wireDecodeHelper(ByteBuffer input, WireFormat wireFormat,
                                      bool copy)
        {
            int[] signedPortionBeginOffset = new int[1];
            int[] signedPortionEndOffset   = new int[1];
            wireFormat.decodeInterest(this, input, signedPortionBeginOffset,
                                      signedPortionEndOffset, copy);

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