Alexander Afanasyev | 1122501 | 2013-11-21 23:11:10 -0800 | [diff] [blame] | 1 | BinaryXmlWireFormat Class |
| 2 | ========================= |
| 3 | |
| 4 | :[C++]: |
| 5 | Namespace: `ndn` |
| 6 | |
| 7 | BinaryXmlWireFormat Constructor |
| 8 | ------------------------------- |
| 9 | |
| 10 | Create a BinaryXmlWireFormat which extends the WireFormat interface to implement encoding and decoding in binary XML. |
| 11 | |
| 12 | :[C++]: |
| 13 | |
| 14 | .. code-block:: c++ |
| 15 | |
| 16 | BinaryXmlWireFormat(); |
| 17 | |
| 18 | :[JavaScript]: |
| 19 | |
| 20 | .. code-block:: javascript |
| 21 | |
| 22 | var BinaryXmlWireFormat = function BinaryXmlWireFormat() |
| 23 | |
| 24 | BinaryXmlWireFormat.decodeData Method |
| 25 | ------------------------------------- |
| 26 | |
| 27 | Decode the input and Binary XML and put the result in data. |
| 28 | |
| 29 | :[C++]: |
| 30 | |
| 31 | .. code-block:: c++ |
| 32 | |
| 33 | void decodeData( |
| 34 | |
| 35 | Data& data, |
| 36 | const uint8_t* input, |
| 37 | size_t inputLength |
| 38 | [, size_t* signedPortionBeginOffset, |
| 39 | size_t* signedPortionEndOffset] |
| 40 | |
| 41 | ); |
| 42 | |
| 43 | :[JavaScript]: |
| 44 | |
| 45 | .. code-block:: javascript |
| 46 | |
| 47 | BinaryXmlWireFormat.prototype.decodeContentObject = function( |
| 48 | |
| 49 | contentObject, // ContentObject |
| 50 | input // Uint8Array |
| 51 | |
| 52 | ) |
| 53 | |
| 54 | :Parameters: |
| 55 | |
| 56 | - `data` |
| 57 | The Data which is set to the values decoded from the input. |
| 58 | |
| 59 | - `input` |
| 60 | The input byte array to be decoded. |
| 61 | |
| 62 | - `inputLength` |
| 63 | (C++ only) The length of the input byte array. |
| 64 | |
| 65 | - `signedPortionBeginOffset` |
| 66 | (optional) Return the offset in the input of the beginning of the signed portion. If you are not decoding in order to verify, you can ignore this returned value. |
| 67 | |
| 68 | - `signedPortionEndOffset` |
| 69 | (optional) Return the offset in the input of the end of the signed portion. If you are not decoding in order to verify, you can ignore this returned value. |
| 70 | |
| 71 | BinaryXmlWireFormat.encodeData Method |
| 72 | ------------------------------------- |
| 73 | |
| 74 | Encode the data object as Binary XML and return the encoding. |
| 75 | |
| 76 | :[C++]: |
| 77 | |
| 78 | .. code-block:: c++ |
| 79 | |
| 80 | Blob encodeData( |
| 81 | |
| 82 | const Data& data |
| 83 | [, size_t* signedPortionBeginOffset, |
| 84 | size_t* signedPortionEndOffset] |
| 85 | |
| 86 | ); |
| 87 | |
| 88 | :[JavaScript]: |
| 89 | |
| 90 | .. code-block:: javascript |
| 91 | |
| 92 | // Returns Uint8Array |
| 93 | BinaryXmlWireFormat.prototype.encodeContentObject = function( |
| 94 | |
| 95 | contentObject, // ContentObject |
| 96 | |
| 97 | ) |
| 98 | |
| 99 | :Parameters: |
| 100 | |
| 101 | - `data` |
| 102 | The Data object to be encoded. |
| 103 | |
| 104 | - `signedPortionBeginOffset` |
| 105 | (optional) Return the offset in the encoding of the beginning of the signed portion. If you are not encoding in order to sign, you can ignore this returned value. |
| 106 | |
| 107 | - `signedPortionEndOffset` |
| 108 | (optional) Return the offset in the encoding of the end of the signed portion. If you are not encoding in order to sign, you can ignore this returned value. |
| 109 | |
| 110 | :Returns: |
| 111 | |
| 112 | The encoded byte array. |
| 113 | |
| 114 | BinaryXmlWireFormat.decodeInterest Method |
| 115 | ----------------------------------------- |
| 116 | |
| 117 | Decode the input and Binary XML and put the result in interest. |
| 118 | |
| 119 | :[C++]: |
| 120 | .. code-block:: c++ |
| 121 | |
| 122 | void decodeInterest( |
| 123 | |
| 124 | Interest& interest, |
| 125 | const uint8_t* input, |
| 126 | size_t inputLength |
| 127 | |
| 128 | ); |
| 129 | |
| 130 | :[JavaScript]: |
| 131 | |
| 132 | .. code-block:: javascript |
| 133 | |
| 134 | BinaryXmlWireFormat.prototype.decodeInterest = function( |
| 135 | |
| 136 | interest, // Interest |
| 137 | input // Uint8Array |
| 138 | |
| 139 | ) |
| 140 | |
| 141 | :Parameters: |
| 142 | |
| 143 | - `interest` |
| 144 | The Interest which is set to the values decoded from the input. |
| 145 | |
| 146 | - `input` |
| 147 | The input byte array to be decoded. |
| 148 | |
| 149 | - `inputLength` |
| 150 | (C++ only) The length of the input byte array. |
| 151 | |
| 152 | BinaryXmlWireFormat.encodeInterest Method |
| 153 | ----------------------------------------- |
| 154 | |
| 155 | Encode the interest as Binary XML and return the encoding. |
| 156 | |
| 157 | :[C++]: |
| 158 | |
| 159 | .. code-block:: c++ |
| 160 | |
| 161 | Blob encodeInterest( |
| 162 | |
| 163 | const Interest& interest, |
| 164 | |
| 165 | ); |
| 166 | |
| 167 | :[JavaScript]: |
| 168 | |
| 169 | .. code-block:: javascript |
| 170 | |
| 171 | // Returns Uint8Array |
| 172 | BinaryXmlWireFormat.prototype.encodeContentObject = function( |
| 173 | |
| 174 | interest, // Interest |
| 175 | |
| 176 | ) |
| 177 | |
| 178 | :Parameters: |
| 179 | |
| 180 | - `interest` |
| 181 | The Interest to be encoded. |
| 182 | |
| 183 | :Returns: |
| 184 | |
| 185 | The encoded byte array. |