diff --git a/src/encoding/estimator.cpp b/src/encoding/estimator.cpp
new file mode 100644
index 0000000..9ec2336
--- /dev/null
+++ b/src/encoding/estimator.cpp
@@ -0,0 +1,140 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2013-2015 Regents of the University of California.
+ *
+ * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
+ *
+ * ndn-cxx library is free software: you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later version.
+ *
+ * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
+ *
+ * You should have received copies of the GNU General Public License and GNU Lesser
+ * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
+ */
+
+#include "estimator.hpp"
+
+namespace ndn {
+namespace encoding {
+
+Estimator::Estimator(size_t totalReserve, size_t reserveFromBack)
+{
+}
+
+size_t
+Estimator::prependByte(uint8_t value)
+{
+  return 1;
+}
+
+size_t
+Estimator::appendByte(uint8_t value)
+{
+  return 1;
+}
+
+
+size_t
+Estimator::prependByteArray(const uint8_t* array, size_t length)
+{
+  return length;
+}
+
+size_t
+Estimator::appendByteArray(const uint8_t* array, size_t length)
+{
+  return prependByteArray(array, length);
+}
+
+size_t
+Estimator::prependVarNumber(uint64_t varNumber)
+{
+  if (varNumber < 253) {
+    return 1;
+  }
+  else if (varNumber <= std::numeric_limits<uint16_t>::max()) {
+    return 3;
+  }
+  else if (varNumber <= std::numeric_limits<uint32_t>::max()) {
+    return 5;
+  }
+  else {
+    return 9;
+  }
+}
+
+size_t
+Estimator::appendVarNumber(uint64_t varNumber)
+{
+  return prependVarNumber(varNumber);
+}
+
+
+size_t
+Estimator::prependNonNegativeInteger(uint64_t varNumber)
+{
+  if (varNumber <= std::numeric_limits<uint8_t>::max()) {
+    return 1;
+  }
+  else if (varNumber <= std::numeric_limits<uint16_t>::max()) {
+    return 2;
+  }
+  else if (varNumber <= std::numeric_limits<uint32_t>::max()) {
+    return 4;
+  }
+  else {
+    return 8;
+  }
+}
+
+size_t
+Estimator::appendNonNegativeInteger(uint64_t varNumber)
+{
+  return prependNonNegativeInteger(varNumber);
+}
+
+
+size_t
+Estimator::prependByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize)
+{
+  size_t totalLength = arraySize;
+  totalLength += prependVarNumber(arraySize);
+  totalLength += prependVarNumber(type);
+
+  return totalLength;
+}
+
+size_t
+Estimator::appendByteArrayBlock(uint32_t type, const uint8_t* array, size_t arraySize)
+{
+  return prependByteArrayBlock(type, array, arraySize);
+}
+
+
+size_t
+Estimator::prependBlock(const Block& block)
+{
+  if (block.hasWire()) {
+    return block.size();
+  }
+  else {
+    return prependByteArrayBlock(block.type(), block.value(), block.value_size());
+  }
+}
+
+size_t
+Estimator::appendBlock(const Block& block)
+{
+  return prependBlock(block);
+}
+
+
+} // namespace encoding
+} // namespace ndn
