Publish code submitted
CLASSES ADDED: Forwarding Entry and FaceInstance.
NOTE: the CCNx daemon doesn't accept the FaceInstance it receives.
Instead,
diff --git a/js/encoding/BinaryXMLEncoder.js b/js/encoding/BinaryXMLEncoder.js
index f05a869..a4217ff 100644
--- a/js/encoding/BinaryXMLEncoder.js
+++ b/js/encoding/BinaryXMLEncoder.js
@@ -21,7 +21,7 @@
var XML_CLOSE = 0x0;
var XML_SUBTYPE_PROCESSING_INSTRUCTIONS = 16;
-
+
var XML_TT_BITS = 3;
var XML_TT_MASK = ((1 << XML_TT_BITS) - 1);
@@ -57,7 +57,9 @@
BinaryXMLEncoder.prototype.writeBlob = function(/*byte []*/ binaryContent
//, /*int*/ offset, /*int*/ length
) {
- console.log(binaryContent);
+
+ if(LOG >3) console.log(binaryContent);
+
this.encodeBlob(this.ostream, binaryContent, this.offset, binaryContent.length);
};
@@ -144,13 +146,30 @@
//long
tag,
//byte[]
- binaryContent,
+ Content,
//TreeMap<String, String>
attributes) {
this.writeStartElement(tag, attributes);
// Will omit if 0-length
- this.writeBlob(binaryContent);
+ if(typeof Content === 'number') {
+ if(LOG>4) console.log('GOING TO WRITE THE NUMBER ' +Content );
+ this.writeBlob(Content.toString());
+ //whatever
+
+ }
+
+ else{
+ //else if(typeof Content === 'string'){
+ console.log('went here');
+ //this.writeBlob(Content);
+ //}
+
+ //else if(typeof Content === 'object'){
+ this.writeBlob(Content);
+ //}
+ }
+
this.writeEndElement();
}
@@ -314,11 +333,19 @@
//CCNTime
offset) {
-
- for (var i = 0; i < input.length; i++) {
- this.ostream[this.offset+i] = (input.charCodeAt(i));
+ if(typeof input === 'string'){
+ //console.log('went here');
+ if(LOG>4) console.log('GOING TO WRITE A STRING');
+
+ for (var i = 0; i < input.length; i++) {
+ this.ostream[this.offset+i] = (input.charCodeAt(i));
+ }
}
-
+
+ else if(typeof input === 'object'){
+ this.writeBlobArray(input);
+ }
+
};
BinaryXMLEncoder.prototype.writeBlobArray = function(
@@ -327,11 +354,16 @@
//CCNTime
offset) {
+ if(LOG>4) console.log('GOING TO WRITE A BLOB');
+
for (var i = 0; i < Blob.length; i++) {
this.ostream[this.offset+i] = Blob[i];
}
};
+
+
+
BinaryXMLEncoder.prototype.getReducedOstream = function() {
return this.ostream.slice(0,this.offset);