Jeff Thompson | 0e47415 | 2013-07-31 18:30:37 -0700 | [diff] [blame] | 1 | /** |
| 2 | * @author: Jeff Thompson |
| 3 | * See COPYING for copyright and distribution information. |
| 4 | * This class represents Interest Objects |
| 5 | */ |
| 6 | |
| 7 | /** |
| 8 | * Create a WireFormat base class where the encode and decode methods throw an error. You should use a derived class like BinaryXmlWireFormat. |
| 9 | * @constructor |
| 10 | */ |
| 11 | var WireFormat = function WireFormat() { |
| 12 | }; |
| 13 | |
| 14 | /** |
| 15 | * The override method in the derived class should encode the interest and return a Uint8Array. |
| 16 | * @param {Interest} interest |
| 17 | * @returns {UInt8Array} |
| 18 | * @throws Error This always throws an "unimplemented" error. The derived class should override. |
| 19 | */ |
| 20 | WireFormat.prototype.encodeInterest = function(interest) { |
| 21 | throw new Error("encodeInterest is unimplemented in the base WireFormat class. You should use a derived class."); |
| 22 | }; |
| 23 | |
| 24 | /** |
| 25 | * The override method in the derived class should decode the input and put the result in interest. |
| 26 | * @param {Interest} interest |
| 27 | * @param {Uint8Array} input |
| 28 | * @throws Error This always throws an "unimplemented" error. The derived class should override. |
| 29 | */ |
| 30 | WireFormat.prototype.decodeInterest = function(interest, input) { |
| 31 | throw new Error("decodeInterest is unimplemented in the base WireFormat class. You should use a derived class."); |
| 32 | }; |
| 33 | |
| 34 | /** |
| 35 | * The override method in the derived class should encode the contentObject and return a Uint8Array. |
| 36 | * @param {ContentObject} contentObject |
| 37 | * @returns {Uint8Array} |
| 38 | * @throws Error This always throws an "unimplemented" error. The derived class should override. |
| 39 | */ |
| 40 | WireFormat.prototype.encodeContentObject = function(contentObject) { |
| 41 | throw new Error("encodeContentObject is unimplemented in the base WireFormat class. You should use a derived class."); |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * The override method in the derived class should decode the input and put the result in contentObject. |
| 46 | * @param {ContentObject} contentObject |
| 47 | * @param {Uint8Array} input |
| 48 | * @throws Error This always throws an "unimplemented" error. The derived class should override. |
| 49 | */ |
| 50 | WireFormat.prototype.decodeContentObject = function(contentObject, input) { |
| 51 | throw new Error("decodeContentObject is unimplemented in the base WireFormat class. You should use a derived class."); |
| 52 | }; |
| 53 | |
| 54 | |