Added WireFormat class and make BinaryXmlWireFormat inherit from it.
diff --git a/js/encoding/BinaryXmlWireFormat.js b/js/encoding/BinaryXmlWireFormat.js
index 3120d8c..f294fb0 100644
--- a/js/encoding/BinaryXmlWireFormat.js
+++ b/js/encoding/BinaryXmlWireFormat.js
@@ -9,6 +9,8 @@
* @constructor
*/
var BinaryXmlWireFormat = function BinaryXmlWireFormat() {
+ // Inherit from WireFormat.
+ WireFormat.call(this);
};
/**
diff --git a/js/encoding/WireFormat.js b/js/encoding/WireFormat.js
new file mode 100644
index 0000000..e44bcc6
--- /dev/null
+++ b/js/encoding/WireFormat.js
@@ -0,0 +1,54 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ * This class represents Interest Objects
+ */
+
+/**
+ * Create a WireFormat base class where the encode and decode methods throw an error. You should use a derived class like BinaryXmlWireFormat.
+ * @constructor
+ */
+var WireFormat = function WireFormat() {
+};
+
+/**
+ * The override method in the derived class should encode the interest and return a Uint8Array.
+ * @param {Interest} interest
+ * @returns {UInt8Array}
+ * @throws Error This always throws an "unimplemented" error. The derived class should override.
+ */
+WireFormat.prototype.encodeInterest = function(interest) {
+ throw new Error("encodeInterest is unimplemented in the base WireFormat class. You should use a derived class.");
+};
+
+/**
+ * The override method in the derived class should decode the input and put the result in interest.
+ * @param {Interest} interest
+ * @param {Uint8Array} input
+ * @throws Error This always throws an "unimplemented" error. The derived class should override.
+ */
+WireFormat.prototype.decodeInterest = function(interest, input) {
+ throw new Error("decodeInterest is unimplemented in the base WireFormat class. You should use a derived class.");
+};
+
+/**
+ * The override method in the derived class should encode the contentObject and return a Uint8Array.
+ * @param {ContentObject} contentObject
+ * @returns {Uint8Array}
+ * @throws Error This always throws an "unimplemented" error. The derived class should override.
+ */
+WireFormat.prototype.encodeContentObject = function(contentObject) {
+ throw new Error("encodeContentObject is unimplemented in the base WireFormat class. You should use a derived class.");
+};
+
+/**
+ * The override method in the derived class should decode the input and put the result in contentObject.
+ * @param {ContentObject} contentObject
+ * @param {Uint8Array} input
+ * @throws Error This always throws an "unimplemented" error. The derived class should override.
+ */
+WireFormat.prototype.decodeContentObject = function(contentObject, input) {
+ throw new Error("decodeContentObject is unimplemented in the base WireFormat class. You should use a derived class.");
+};
+
+