diff --git a/src/torrent-file.cpp b/src/torrent-file.cpp
new file mode 100644
index 0000000..4302b53
--- /dev/null
+++ b/src/torrent-file.cpp
@@ -0,0 +1,241 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent 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.
+*
+* nTorrent 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 nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#include "torrent-file.hpp"
+
+#include <algorithm>
+
+#include <boost/range/adaptors.hpp>
+
+namespace ndn {
+
+namespace ntorrent {
+
+BOOST_CONCEPT_ASSERT((WireEncodable<TorrentFile>));
+BOOST_CONCEPT_ASSERT((WireDecodable<TorrentFile>));
+static_assert(std::is_base_of<Data::Error, TorrentFile::Error>::value,
+                "TorrentFile::Error should inherit from Data::Error");
+
+TorrentFile::TorrentFile(const Name& torrentFileName,
+                         const Name& torrentFilePtr,
+                         const Name& commonPrefix,
+                         const std::vector<ndn::Name>& catalog)
+  : Data(torrentFileName)
+  , m_commonPrefix(commonPrefix)
+  , m_torrentFilePtr(torrentFilePtr)
+  , m_catalog(catalog)
+{
+}
+
+TorrentFile::TorrentFile(const Name& torrentFileName,
+                         const Name& commonPrefix,
+                         const std::vector<ndn::Name>& catalog)
+  : Data(torrentFileName)
+  , m_commonPrefix(commonPrefix)
+  , m_catalog(catalog)
+{
+}
+
+TorrentFile::TorrentFile(const Block& block)
+{
+  this->wireDecode(block);
+}
+
+const Name&
+TorrentFile::getName() const
+{
+  return Data::getName();
+}
+
+const Name&
+TorrentFile::getCommonPrefix() const
+{
+  return m_commonPrefix;
+}
+
+void
+TorrentFile::createSuffixCatalog()
+{
+  for (auto i = m_catalog.begin() ; i != m_catalog.end(); ++i) {
+    m_suffixCatalog.push_back((*i).getSubName(m_commonPrefix.size()));
+  }
+}
+
+shared_ptr<Name>
+TorrentFile::getTorrentFilePtr() const
+{
+  if (this->hasTorrentFilePtr()) {
+    return make_shared<Name>(m_torrentFilePtr);
+  }
+  return nullptr;
+}
+
+void
+TorrentFile::constructLongNames()
+{
+  for (auto i = m_suffixCatalog.begin(); i != m_suffixCatalog.end(); ++i) {
+      Name commonPrefix = m_commonPrefix;
+      m_catalog.push_back(commonPrefix.append((*i)));
+  }
+}
+
+template<encoding::Tag TAG>
+size_t
+TorrentFile::encodeContent(EncodingImpl<TAG>& encoder) const
+{
+  // TorrentFileContent ::= CONTENT-TYPE TLV-LENGTH
+  //                      Suffix+
+  //                      CommonPrefix
+  //                      TorrentFilePtr?
+
+  // Suffix ::= NAME-TYPE TLV-LENGTH
+  //          Name
+
+  // CommonPrefix ::= NAME-TYPE TLV-LENGTH
+  //                Name
+
+  // TorrentFilePtr ::= NAME-TYPE TLV-LENGTH
+  //                  Name
+
+  size_t totalLength = 0;
+  for (const auto& name : m_suffixCatalog |  boost::adaptors::reversed) {
+    size_t fileManifestSuffixLength = 0;
+    fileManifestSuffixLength += name.wireEncode(encoder);
+    totalLength += fileManifestSuffixLength;
+  }
+  totalLength += m_commonPrefix.wireEncode(encoder);
+  if (!m_torrentFilePtr.empty()) {
+    size_t torrentFilePtrLength = 0;
+    torrentFilePtrLength += m_torrentFilePtr.wireEncode(encoder);
+    totalLength += torrentFilePtrLength;
+  }
+
+  totalLength += encoder.prependVarNumber(totalLength);
+  totalLength += encoder.prependVarNumber(tlv::Content);
+  return totalLength;
+}
+
+bool
+TorrentFile::erase(const Name& name)
+{
+  auto found = std::find(m_catalog.begin(), m_catalog.end(), name);
+  if (found != m_catalog.end()) {
+    m_catalog.erase(found);
+    return true;
+  }
+  return false;
+}
+
+void
+TorrentFile::encodeContent()
+{
+  onChanged();
+
+  EncodingEstimator estimator;
+  size_t estimatedSize = encodeContent(estimator);
+
+  EncodingBuffer buffer(estimatedSize, 0);
+  encodeContent(buffer);
+
+  setContentType(tlv::ContentType_Blob);
+  setContent(buffer.block());
+}
+
+void
+TorrentFile::decodeContent()
+{
+  // TorrentFileContent ::= CONTENT-TYPE TLV-LENGTH
+  //                      Suffix+
+  //                      CommonPrefix
+  //                      TorrentFilePtr?
+
+  // Suffix ::= NAME-TYPE TLV-LENGTH
+  //          Name
+
+  // CommonPrefix ::= NAME-TYPE TLV-LENGTH
+  //                Name
+
+  // TorrentFilePtr ::= NAME-TYPE TLV-LENGTH
+  //                  Name
+
+  if (getContentType() != tlv::ContentType_Blob) {
+      BOOST_THROW_EXCEPTION(Error("Expected Content Type Blob"));
+  }
+
+  const Block& content = Data::getContent();
+  content.parse();
+
+  // Check whether there is a TorrentFilePtr
+  auto element = content.elements_begin();
+  if (content.elements_end() == element) {
+    BOOST_THROW_EXCEPTION(Error(".Torrent-file with empty content"));
+  }
+  element->parse();
+  Name name(*element);
+  if (name.empty())
+    BOOST_THROW_EXCEPTION(Error("Empty name included in the .torrent-file"));
+
+  if (name.get(name.size() - 3) == name::Component(".torrent-file")) {
+    m_torrentFilePtr = name;
+    ++element;
+    m_commonPrefix = Name(*element);
+    if (m_commonPrefix.empty()) {
+      BOOST_THROW_EXCEPTION(Error("Common prefix cannot be empty"));
+    }
+  }
+  else {
+    m_commonPrefix = name;
+  }
+  element++;
+  for (; element != content.elements_end(); ++element) {
+    element->parse();
+    Name fileManifestSuffix(*element);
+    if (fileManifestSuffix.empty())
+      BOOST_THROW_EXCEPTION(Error("Empty manifest file name included in the .torrent-file"));
+    this->insertToSuffixCatalog(fileManifestSuffix);
+  }
+  if (m_suffixCatalog.size() == 0) {
+    BOOST_THROW_EXCEPTION(Error(".Torrent-file with empty catalog of file manifest names"));
+  }
+}
+
+void
+TorrentFile::wireDecode(const Block& wire)
+{
+  m_catalog.clear();
+  m_suffixCatalog.clear();
+  Data::wireDecode(wire);
+  this->decodeContent();
+  this->constructLongNames();
+}
+
+const Block&
+TorrentFile::wireEncode()
+{
+  this->createSuffixCatalog();
+  this->encodeContent();
+  m_suffixCatalog.clear();
+  return Data::wireEncode();
+}
+
+} // namespace ntorrent
+
+} // namespace ndn
diff --git a/src/torrent-file.hpp b/src/torrent-file.hpp
new file mode 100644
index 0000000..89d3173
--- /dev/null
+++ b/src/torrent-file.hpp
@@ -0,0 +1,226 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+* Copyright (c) 2016 Regents of the University of California.
+*
+* This file is part of the nTorrent codebase.
+*
+* nTorrent 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.
+*
+* nTorrent 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 nTorrent, e.g., in COPYING.md file. If not, see
+* <http://www.gnu.org/licenses/>.
+*
+* See AUTHORS for complete list of nTorrent authors and contributors.
+*/
+
+#ifndef TORRENT_FILE_HPP
+#define TORRENT_FILE_HPP
+
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/encoding/block.hpp>
+#include <ndn-cxx/data.hpp>
+
+#include <memory>
+
+namespace ndn {
+
+namespace ntorrent {
+
+class TorrentFile : public Data {
+public:
+  class Error : public Data::Error
+  {
+  public:
+    explicit
+    Error(const std::string& what)
+      : Data::Error(what)
+    {
+    }
+  };
+
+  /**
+   * @brief Create a new empty .TorrentFile.
+   */
+  TorrentFile() = default;
+
+  /**
+   * @brief Create a new .TorrentFile.
+   * @param torrentFileName The name of the .torrent-file
+   * @param torrentFilePtr A pointer (name) to the next segment of the .torrent-file
+   * @param commonPrefix The common name prefix of the manifest file names included in the catalog
+   * @param catalog The catalog containing the name of each file manifest
+   */
+  TorrentFile(const Name& torrentFileName,
+              const Name& torrentFilePtr,
+              const Name& commonPrefix,
+              const std::vector<ndn::Name>& catalog);
+
+  /**
+   * @brief Create a new .TorrentFile.
+   * @param torrentFileName The name of the .torrent-file
+   * @param commonPrefix The common name prefix of the manifest file names included in the catalog
+   * @param catalog The catalog containing the name of each file manifest
+   */
+  TorrentFile(const Name& torrentFileName,
+              const Name& commonPrefix,
+              const std::vector<ndn::Name>& catalog);
+
+  /**
+   * @brief Create a new .TorrentFile
+   * @param block The block format of the .torrent-file
+   */
+  explicit
+  TorrentFile(const Block& block);
+
+  /**
+   * @brief Get the name of the .TorrentFile
+   */
+  const Name&
+  getName() const;
+
+  /**
+   * @brief Get the common prefix of the file manifest names of this .torrent-file
+   */
+  const Name&
+  getCommonPrefix() const;
+
+  /**
+   * @brief Get a shared pointer to the name of the next segment of the .torrent-file.
+   *
+   * If there is no next segment, it returns a nullptr
+   */
+  shared_ptr<Name>
+  getTorrentFilePtr() const;
+
+  /**
+   * @brief Get the catalog of names of the file manifests
+   */
+  const std::vector<Name>&
+  getCatalog() const;
+
+  /**
+   * @brief Decode from wire format
+   */
+  void
+  wireDecode(const Block& wire);
+
+  /**
+   * @brief Encode from wire format
+   */
+  const Block&
+  wireEncode();
+
+  /**
+   * @brief Insert a name to the catalog of file manifest names
+   */
+  void
+  insert(const Name& name);
+
+  /**
+   * @brief Erase a name from the catalog of file manifest names
+   */
+  bool
+  erase(const Name& name);
+
+  /**
+   * @brief Get the size of the catalog of file manifest names
+   */
+  size_t
+  catalogSize() const;
+
+protected:
+  /**
+   * @brief prepend .torrent file as a Content block to the encoder
+   */
+  template<encoding::Tag TAG>
+  size_t
+  encodeContent(EncodingImpl<TAG>& encoder) const;
+
+  void
+  encodeContent();
+
+  void
+  decodeContent();
+
+private:
+  /**
+   * @brief Check whether the .torrent-file has a pointer to the next segment
+   */
+  bool
+  hasTorrentFilePtr() const;
+
+  /**
+   * @brief Create a catalog of suffixes for the names of the file manifests
+   *
+   * To optimize encoding and decoding, we encode the name of the file manifests
+   * as suffixes along with their common prefix.
+   *
+   */
+  void
+  createSuffixCatalog();
+
+  /**
+   * @brief Construct the catalog of long names from a catalog of suffixes for the file
+   *        manifests' name
+   *
+   * After decoding a .torrent-file from its wire format, we construct the catalog of
+   * long names from the decoded common prefix and suffixes
+   *
+   */
+  void
+  constructLongNames();
+
+  /**
+   * @brief Insert a suffix to the suffix catalog
+   */
+  void
+  insertToSuffixCatalog(const PartialName& suffix);
+
+private:
+  Name m_commonPrefix;
+  Name m_torrentFilePtr;
+  std::vector<ndn::Name> m_suffixCatalog;
+  std::vector<ndn::Name> m_catalog;
+};
+
+inline bool
+TorrentFile::hasTorrentFilePtr() const
+{
+  return !m_torrentFilePtr.empty();
+}
+
+inline const std::vector<Name>&
+TorrentFile::getCatalog() const
+{
+  return m_catalog;
+}
+
+inline size_t
+TorrentFile::catalogSize() const
+{
+  return m_catalog.size();
+}
+
+inline void
+TorrentFile::insert(const Name& name)
+{
+  m_catalog.push_back(name);
+}
+
+inline void
+TorrentFile::insertToSuffixCatalog(const PartialName& suffix)
+{
+  m_suffixCatalog.push_back(suffix);
+}
+
+} // namespace ntorrent
+
+} // namespace ndn
+
+#endif // TORRENT_FILE_HPP
