Make Data wireEncode and wireDecode set the wireEncoding_, and setter functions clear it.
diff --git a/ndn-cpp/data.cpp b/ndn-cpp/data.cpp
index 0e01df6..d6c9fcf 100644
--- a/ndn-cpp/data.cpp
+++ b/ndn-cpp/data.cpp
@@ -29,7 +29,7 @@
   timestampMilliseconds_ = metaInfoStruct.timestampMilliseconds;
   type_ = metaInfoStruct.type;
   freshnessSeconds_ = metaInfoStruct.freshnessSeconds;
-  finalBlockID_.setValue(Blob(metaInfoStruct.finalBlockID.value, metaInfoStruct.finalBlockID.valueLength));
+  finalBlockID_ = Name::Component(Blob(metaInfoStruct.finalBlockID.value, metaInfoStruct.finalBlockID.valueLength));
 }
 
 Data::Data()
@@ -61,6 +61,30 @@
   name_.set(dataStruct.name);
   metaInfo_.set(dataStruct.metaInfo);
   content_ = Blob(dataStruct.content, dataStruct.contentLength);
+
+  onChanged();
+}
+
+SignedBlob Data::wireEncode(WireFormat& wireFormat) 
+{
+  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  Blob encoding = wireFormat.encodeData(*this, &signedPortionBeginOffset, &signedPortionEndOffset);
+  
+  wireEncoding_ = SignedBlob(encoding, signedPortionBeginOffset, signedPortionEndOffset);
+  return wireEncoding_;
+}
+
+void Data::wireDecode(const unsigned char *input, unsigned int inputLength, WireFormat& wireFormat) 
+{
+  unsigned int signedPortionBeginOffset, signedPortionEndOffset;
+  wireFormat.decodeData(*this, input, inputLength, &signedPortionBeginOffset, &signedPortionEndOffset);
+  
+  wireEncoding_ = SignedBlob(input, inputLength, signedPortionBeginOffset, signedPortionEndOffset);
+}
+
+void Data::onChanged()
+{
+  wireEncoding_ = SignedBlob();
 }
 
 }