ndnboost: Include boost::iostreams for internal use.
diff --git a/include/ndnboost/iostreams/device/array.hpp b/include/ndnboost/iostreams/device/array.hpp
new file mode 100644
index 0000000..f4eb39e
--- /dev/null
+++ b/include/ndnboost/iostreams/device/array.hpp
@@ -0,0 +1,144 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2004-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+#ifndef NDNBOOST_IOSTREAMS_ARRAY_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_ARRAY_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/config.hpp>         // NDNBOOST_MSVC, make sure size_t is in std.
+#include <ndnboost/detail/workaround.hpp>
+#include <cstddef>                  // std::size_t.
+#include <utility>                  // pair.
+#include <ndnboost/iostreams/categories.hpp>
+#include <ndnboost/preprocessor/cat.hpp>
+#include <ndnboost/static_assert.hpp>
+#include <ndnboost/type_traits/is_convertible.hpp>
+#include <ndnboost/type_traits/is_same.hpp>
+
+namespace ndnboost { namespace iostreams {
+
+namespace detail {
+
+template<typename Mode, typename Ch>
+class array_adapter {
+public:
+    typedef Ch                                 char_type;
+    typedef std::pair<char_type*, char_type*>  pair_type;
+    struct category
+        : public Mode,
+          public device_tag,
+          public direct_tag
+        { };
+    array_adapter(char_type* begin, char_type* end);
+    array_adapter(char_type* begin, std::size_t length);
+    array_adapter(const char_type* begin, const char_type* end);
+    array_adapter(const char_type* begin, std::size_t length);
+#if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, < 1300)
+    template<int N>
+    array_adapter(char_type (&ar)[N])
+        : begin_(ar), end_(ar + N) 
+        { }
+#endif
+    pair_type input_sequence();
+    pair_type output_sequence();
+private:
+    char_type* begin_;
+    char_type* end_;
+};
+
+} // End namespace detail.
+
+// Local macros, #undef'd below.
+#if !NDNBOOST_WORKAROUND(NDNBOOST_MSVC, <= 1300)
+# define NDNBOOST_IOSTREAMS_ARRAY_CTOR(name, ch) \
+    template<int N> \
+    NDNBOOST_PP_CAT(basic_, name)(ch (&ar)[N]) \
+        : base_type(ar) { } \
+    /**/
+#else
+# define NDNBOOST_IOSTREAMS_ARRAY_CTOR(name, ch)
+#endif
+#define NDNBOOST_IOSTREAMS_ARRAY(name, mode) \
+    template<typename Ch> \
+    struct NDNBOOST_PP_CAT(basic_, name) : detail::array_adapter<mode, Ch> { \
+    private: \
+        typedef detail::array_adapter<mode, Ch>  base_type; \
+    public: \
+        typedef typename base_type::char_type    char_type; \
+        typedef typename base_type::category     category; \
+        NDNBOOST_PP_CAT(basic_, name)(char_type* begin, char_type* end) \
+            : base_type(begin, end) { } \
+        NDNBOOST_PP_CAT(basic_, name)(char_type* begin, std::size_t length) \
+            : base_type(begin, length) { } \
+        NDNBOOST_PP_CAT(basic_, name)(const char_type* begin, const char_type* end) \
+            : base_type(begin, end) { } \
+        NDNBOOST_PP_CAT(basic_, name)(const char_type* begin, std::size_t length) \
+            : base_type(begin, length) { } \
+        NDNBOOST_IOSTREAMS_ARRAY_CTOR(name, Ch) \
+    }; \
+    typedef NDNBOOST_PP_CAT(basic_, name)<char>     name; \
+    typedef NDNBOOST_PP_CAT(basic_, name)<wchar_t>  NDNBOOST_PP_CAT(w, name); \
+    /**/
+NDNBOOST_IOSTREAMS_ARRAY(array_source, input_seekable)
+NDNBOOST_IOSTREAMS_ARRAY(array_sink, output_seekable)
+NDNBOOST_IOSTREAMS_ARRAY(array, seekable)
+#undef NDNBOOST_IOSTREAMS_ARRAY_CTOR
+#undef NDNBOOST_IOSTREAMS_ARRAY
+
+
+//------------------Implementation of array_adapter---------------------------//
+
+namespace detail {
+
+template<typename Mode, typename Ch>
+array_adapter<Mode, Ch>::array_adapter
+    (char_type* begin, char_type* end) 
+    : begin_(begin), end_(end) 
+    { }
+
+template<typename Mode, typename Ch>
+array_adapter<Mode, Ch>::array_adapter
+    (char_type* begin, std::size_t length) 
+    : begin_(begin), end_(begin + length) 
+    { }
+
+template<typename Mode, typename Ch>
+array_adapter<Mode, Ch>::array_adapter
+    (const char_type* begin, const char_type* end) 
+    : begin_(const_cast<char_type*>(begin)),  // Treated as read-only.
+      end_(const_cast<char_type*>(end))       // Treated as read-only.
+{ NDNBOOST_STATIC_ASSERT((!is_convertible<Mode, output>::value)); }
+
+template<typename Mode, typename Ch>
+array_adapter<Mode, Ch>::array_adapter
+    (const char_type* begin, std::size_t length) 
+    : begin_(const_cast<char_type*>(begin)),       // Treated as read-only.
+      end_(const_cast<char_type*>(begin) + length) // Treated as read-only.
+{ NDNBOOST_STATIC_ASSERT((!is_convertible<Mode, output>::value)); }
+
+template<typename Mode, typename Ch>
+typename array_adapter<Mode, Ch>::pair_type
+array_adapter<Mode, Ch>::input_sequence()
+{ NDNBOOST_STATIC_ASSERT((is_convertible<Mode, input>::value));
+  return pair_type(begin_, end_); }
+
+template<typename Mode, typename Ch>
+typename array_adapter<Mode, Ch>::pair_type
+array_adapter<Mode, Ch>::output_sequence()
+{ NDNBOOST_STATIC_ASSERT((is_convertible<Mode, output>::value));
+  return pair_type(begin_, end_); }
+
+} // End namespace detail.
+
+//----------------------------------------------------------------------------//
+
+} } // End namespaces iostreams, boost.
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_ARRAY_HPP_INCLUDED
diff --git a/include/ndnboost/iostreams/device/back_inserter.hpp b/include/ndnboost/iostreams/device/back_inserter.hpp
new file mode 100644
index 0000000..3daace6
--- /dev/null
+++ b/include/ndnboost/iostreams/device/back_inserter.hpp
@@ -0,0 +1,41 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+#ifndef NDNBOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/iostreams/detail/ios.hpp> // streamsize.
+#include <ndnboost/iostreams/categories.hpp>
+
+namespace ndnboost { namespace iostreams {
+
+template<typename Container>
+class back_insert_device {
+public:
+    typedef typename Container::value_type  char_type;
+    typedef sink_tag                        category;
+    back_insert_device(Container& cnt) : container(&cnt) { }
+    std::streamsize write(const char_type* s, std::streamsize n)
+    { 
+        container->insert(container->end(), s, s + n); 
+        return n;
+    }
+protected:
+    Container* container;
+};
+
+template<typename Container>
+back_insert_device<Container> back_inserter(Container& cnt)
+{ return back_insert_device<Container>(cnt); }
+
+} } // End namespaces iostreams, boost.
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_BACK_INSERTER_HPP_INCLUDED
diff --git a/include/ndnboost/iostreams/device/file.hpp b/include/ndnboost/iostreams/device/file.hpp
new file mode 100644
index 0000000..b8c85f2
--- /dev/null
+++ b/include/ndnboost/iostreams/device/file.hpp
@@ -0,0 +1,191 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+#ifndef NDNBOOST_IOSTREAMS_FILE_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_FILE_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/iostreams/detail/config/wide_streams.hpp>
+#ifndef NDNBOOST_IOSTREAMS_NO_LOCALE
+# include <locale>
+#endif
+#include <string>                               // pathnames, char_traits.
+#include <ndnboost/iostreams/categories.hpp>
+#include <ndnboost/iostreams/detail/ios.hpp>       // openmode, seekdir, int types.
+#include <ndnboost/iostreams/detail/fstream.hpp>
+#include <ndnboost/iostreams/operations.hpp>       // seek.
+#include <ndnboost/shared_ptr.hpp>      
+
+// Must come last.
+#include <ndnboost/iostreams/detail/config/disable_warnings.hpp>  // MSVC.
+
+namespace ndnboost { namespace iostreams {
+
+template<typename Ch>
+class basic_file {
+public:
+    typedef Ch char_type;
+    struct category
+        : public seekable_device_tag,
+          public closable_tag,
+          public localizable_tag,
+          public flushable_tag
+        { };
+    basic_file( const std::string& path,
+                NDNBOOST_IOS::openmode mode =
+                    NDNBOOST_IOS::in | NDNBOOST_IOS::out,
+                NDNBOOST_IOS::openmode base_mode =
+                    NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+    std::streamsize read(char_type* s, std::streamsize n);
+    bool putback(char_type c);
+    std::streamsize write(const char_type* s, std::streamsize n);
+    std::streampos seek( stream_offset off, NDNBOOST_IOS::seekdir way, 
+                         NDNBOOST_IOS::openmode which = 
+                             NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+    void open( const std::string& path,
+               NDNBOOST_IOS::openmode mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out,
+               NDNBOOST_IOS::openmode base_mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+    bool is_open() const;
+    void close();
+    bool flush();
+#ifndef NDNBOOST_IOSTREAMS_NO_LOCALE
+    void imbue(const std::locale& loc) { pimpl_->file_.pubimbue(loc);  }
+#endif
+private:
+    struct impl {
+        impl(const std::string& path, NDNBOOST_IOS::openmode mode)
+            { file_.open(path.c_str(), mode); }
+        ~impl() { if (file_.is_open()) file_.close(); }
+        NDNBOOST_IOSTREAMS_BASIC_FILEBUF(Ch) file_;
+    };
+    shared_ptr<impl> pimpl_;
+};
+
+typedef basic_file<char>     file;
+typedef basic_file<wchar_t>  wfile;
+
+template<typename Ch>
+struct basic_file_source : private basic_file<Ch> {
+    typedef Ch char_type;
+    struct category
+        : input_seekable,
+          device_tag,
+          closable_tag
+        { };
+    using basic_file<Ch>::read;
+    using basic_file<Ch>::putback;
+    using basic_file<Ch>::seek;
+    using basic_file<Ch>::is_open;
+    using basic_file<Ch>::close;
+    basic_file_source( const std::string& path,
+                       NDNBOOST_IOS::openmode mode = 
+                           NDNBOOST_IOS::in )
+        : basic_file<Ch>(path, mode & ~NDNBOOST_IOS::out, NDNBOOST_IOS::in)
+        { }
+    void open( const std::string& path,
+               NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in )
+    {
+        basic_file<Ch>::open(path, mode & ~NDNBOOST_IOS::out, NDNBOOST_IOS::in);
+    }
+};
+
+typedef basic_file_source<char>     file_source;
+typedef basic_file_source<wchar_t>  wfile_source;
+
+template<typename Ch>
+struct basic_file_sink : private basic_file<Ch> {
+    typedef Ch char_type;
+    struct category
+        : output_seekable,
+          device_tag,
+          closable_tag,
+          flushable_tag
+        { };
+    using basic_file<Ch>::write;
+    using basic_file<Ch>::seek;
+    using basic_file<Ch>::is_open;
+    using basic_file<Ch>::close;
+    using basic_file<Ch>::flush;
+    basic_file_sink( const std::string& path,
+                     NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out )
+        : basic_file<Ch>(path, mode & ~NDNBOOST_IOS::in, NDNBOOST_IOS::out)
+        { }
+    void open( const std::string& path,
+               NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out )
+    {
+        basic_file<Ch>::open(path, mode & ~NDNBOOST_IOS::in, NDNBOOST_IOS::out);
+    }
+};
+
+typedef basic_file_sink<char>     file_sink;
+typedef basic_file_sink<wchar_t>  wfile_sink;
+                                 
+//------------------Implementation of basic_file------------------------------//
+
+template<typename Ch>
+basic_file<Ch>::basic_file
+    ( const std::string& path, NDNBOOST_IOS::openmode mode, 
+      NDNBOOST_IOS::openmode base_mode )
+{ 
+    open(path, mode, base_mode);
+}
+
+template<typename Ch>
+inline std::streamsize basic_file<Ch>::read
+    (char_type* s, std::streamsize n)
+{ 
+    std::streamsize result = pimpl_->file_.sgetn(s, n); 
+    return result != 0 ? result : -1;
+}
+
+template<typename Ch>
+inline bool basic_file<Ch>::putback(char_type c)
+{ 
+    return !!pimpl_->file_.sputbackc(c); 
+}
+
+template<typename Ch>
+inline std::streamsize basic_file<Ch>::write
+    (const char_type* s, std::streamsize n)
+{ return pimpl_->file_.sputn(s, n); }
+
+template<typename Ch>
+std::streampos basic_file<Ch>::seek
+    ( stream_offset off, NDNBOOST_IOS::seekdir way, 
+      NDNBOOST_IOS::openmode )
+{ return iostreams::seek(pimpl_->file_, off, way); }
+
+template<typename Ch>
+void basic_file<Ch>::open
+    ( const std::string& path, NDNBOOST_IOS::openmode mode, 
+      NDNBOOST_IOS::openmode base_mode )
+{ 
+    pimpl_.reset(new impl(path, mode | base_mode));
+}
+
+template<typename Ch>
+bool basic_file<Ch>::is_open() const { return pimpl_->file_.is_open(); }
+
+template<typename Ch>
+void basic_file<Ch>::close() { pimpl_->file_.close(); }
+
+template<typename Ch>
+bool basic_file<Ch>::flush()
+{ return pimpl_->file_.NDNBOOST_IOSTREAMS_PUBSYNC() == 0; }
+
+//----------------------------------------------------------------------------//
+
+} } // End namespaces iostreams, boost.
+
+#include <ndnboost/iostreams/detail/config/enable_warnings.hpp> // MSVC
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_FILE_HPP_INCLUDED
diff --git a/include/ndnboost/iostreams/device/file_descriptor.hpp b/include/ndnboost/iostreams/device/file_descriptor.hpp
new file mode 100644
index 0000000..165a89e
--- /dev/null
+++ b/include/ndnboost/iostreams/device/file_descriptor.hpp
@@ -0,0 +1,318 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2003-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// Inspired by fdstream.hpp, (C) Copyright Nicolai M. Josuttis 2001,
+// available at http://www.josuttis.com/cppcode/fdstream.html.
+
+#ifndef NDNBOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <string>
+#include <ndnboost/cstdint.hpp>               // intmax_t.
+#include <ndnboost/iostreams/categories.hpp>  // tags.
+#include <ndnboost/iostreams/detail/config/auto_link.hpp>
+#include <ndnboost/iostreams/detail/config/dyn_link.hpp>
+#include <ndnboost/iostreams/detail/config/windows_posix.hpp>
+#include <ndnboost/iostreams/detail/file_handle.hpp>
+#include <ndnboost/iostreams/detail/ios.hpp>  // openmode, seekdir, int types.
+#include <ndnboost/iostreams/detail/path.hpp>
+#include <ndnboost/iostreams/positioning.hpp>
+#include <ndnboost/shared_ptr.hpp>
+
+// Must come last.
+#include <ndnboost/config/abi_prefix.hpp>
+
+namespace ndnboost { namespace iostreams {
+
+// Forward declarations
+class file_descriptor_source;
+class file_descriptor_sink;
+namespace detail { struct file_descriptor_impl; }
+
+enum file_descriptor_flags
+{
+    never_close_handle = 0,
+    close_handle = 3
+};
+
+class NDNBOOST_IOSTREAMS_DECL file_descriptor {
+public:
+    friend class file_descriptor_source;
+    friend class file_descriptor_sink;
+    typedef detail::file_handle  handle_type;
+    typedef char                 char_type;
+    struct category
+        : seekable_device_tag,
+          closable_tag
+        { };
+
+    // Default constructor
+    file_descriptor();
+
+    // Constructors taking file desciptors
+    file_descriptor(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    file_descriptor(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // Constructors taking file desciptors
+    explicit file_descriptor(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    explicit file_descriptor(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // Constructor taking a std:: string
+    explicit file_descriptor( const std::string& path,
+                              NDNBOOST_IOS::openmode mode =
+                                  NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+
+    // Constructor taking a C-style string
+    explicit file_descriptor( const char* path,
+                              NDNBOOST_IOS::openmode mode =
+                                  NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+
+    // Constructor taking a Boost.Filesystem path
+    template<typename Path>
+    explicit file_descriptor( const Path& path,
+                              NDNBOOST_IOS::openmode mode =
+                                  NDNBOOST_IOS::in | NDNBOOST_IOS::out )
+    { 
+        init();
+        open(detail::path(path), mode); 
+    }
+
+    // Copy constructor
+    file_descriptor(const file_descriptor& other);
+
+    // open overloads taking file descriptors
+    void open(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // open overloads taking file descriptors
+    void open(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // open overload taking a std::string
+    void open( const std::string& path,
+               NDNBOOST_IOS::openmode mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+
+    // open overload taking C-style string
+    void open( const char* path,
+               NDNBOOST_IOS::openmode mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out );
+
+    // open overload taking a Boost.Filesystem path
+    template<typename Path>
+    void open( const Path& path,
+               NDNBOOST_IOS::openmode mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out )
+    { open(detail::path(path), mode); }
+
+    bool is_open() const;
+    void close();
+    std::streamsize read(char_type* s, std::streamsize n);
+    std::streamsize write(const char_type* s, std::streamsize n);
+    std::streampos seek(stream_offset off, NDNBOOST_IOS::seekdir way);
+    handle_type handle() const;
+private:
+    void init();
+
+    // open overload taking a detail::path
+    void open( const detail::path& path, 
+               NDNBOOST_IOS::openmode, 
+               NDNBOOST_IOS::openmode = NDNBOOST_IOS::openmode(0) );
+
+    typedef detail::file_descriptor_impl impl_type;
+    shared_ptr<impl_type> pimpl_;
+};
+
+class NDNBOOST_IOSTREAMS_DECL file_descriptor_source : private file_descriptor {
+public:
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    typedef void*  handle_type;  // A.k.a HANDLE
+#else
+    typedef int    handle_type;
+#endif
+    typedef char   char_type;
+    struct category
+      : input_seekable,
+        device_tag,
+        closable_tag
+      { };
+    using file_descriptor::is_open;
+    using file_descriptor::close;
+    using file_descriptor::read;
+    using file_descriptor::seek;
+    using file_descriptor::handle;
+
+    // Default constructor
+    file_descriptor_source() { }
+
+    // Constructors taking file desciptors
+    explicit file_descriptor_source(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    explicit file_descriptor_source(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // Constructors taking file desciptors
+    explicit file_descriptor_source(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    explicit file_descriptor_source(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // Constructor taking a std:: string
+    explicit file_descriptor_source( const std::string& path,
+                                     NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in );
+
+    // Constructor taking a C-style string
+    explicit file_descriptor_source( const char* path,
+                                     NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in );
+
+    // Constructor taking a Boost.Filesystem path
+    template<typename Path>
+    explicit file_descriptor_source( const Path& path,
+                                     NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in )
+    { open(detail::path(path), mode); }
+
+    // Copy constructor
+    file_descriptor_source(const file_descriptor_source& other);
+
+    // Constructors taking file desciptors
+    void open(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // open overloads taking file descriptors
+    void open(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // open overload taking a std::string
+    void open(const std::string& path, NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in);
+
+    // open overload taking C-style string
+    void open(const char* path, NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in);
+
+    // open overload taking a Boost.Filesystem path
+    template<typename Path>
+    void open(const Path& path, NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::in);
+private:
+
+    // open overload taking a detail::path
+    void open(const detail::path& path, NDNBOOST_IOS::openmode);
+};
+
+class NDNBOOST_IOSTREAMS_DECL file_descriptor_sink : private file_descriptor {
+public:
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    typedef void*  handle_type;  // A.k.a HANDLE
+#else
+    typedef int    handle_type;
+#endif
+    typedef char   char_type;
+    struct category
+      : output_seekable,
+        device_tag,
+        closable_tag
+      { };
+    using file_descriptor::is_open;
+    using file_descriptor::close;
+    using file_descriptor::write;
+    using file_descriptor::seek;
+    using file_descriptor::handle;
+
+    // Default constructor
+    file_descriptor_sink() { }
+
+    // Constructors taking file desciptors
+    file_descriptor_sink(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    file_descriptor_sink(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // Constructors taking file desciptors
+    explicit file_descriptor_sink(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    explicit file_descriptor_sink(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // Constructor taking a std:: string
+    explicit file_descriptor_sink( const std::string& path,
+                                   NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out );
+
+    // Constructor taking a C-style string
+    explicit file_descriptor_sink( const char* path,
+                                   NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out );
+
+    // Constructor taking a Boost.Filesystem path
+    template<typename Path>
+    explicit file_descriptor_sink( const Path& path,
+                                   NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out )
+    { open(detail::path(path), mode); }
+
+    // Copy constructor
+    file_descriptor_sink(const file_descriptor_sink& other);
+
+    // open overloads taking file descriptors
+    void open(handle_type fd, file_descriptor_flags);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, file_descriptor_flags);
+#endif
+
+#if defined(NDNBOOST_IOSTREAMS_USE_DEPRECATED)
+    // open overloads taking file descriptors
+    void open(handle_type fd, bool close_on_exit = false);
+#ifdef NDNBOOST_IOSTREAMS_WINDOWS
+    void open(int fd, bool close_on_exit = false);
+#endif
+#endif
+
+    // open overload taking a std::string
+    void open( const std::string& path, 
+               NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out );
+
+    // open overload taking C-style string
+    void open( const char* path, 
+               NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out );
+
+    // open overload taking a Boost.Filesystem path
+    template<typename Path>
+    void open( const Path& path, 
+               NDNBOOST_IOS::openmode mode = NDNBOOST_IOS::out )
+    { open(detail::path(path), mode); }
+private:
+
+    // open overload taking a detail::path
+    void open(const detail::path& path, NDNBOOST_IOS::openmode);
+};
+
+} } // End namespaces iostreams, boost.
+
+#include <ndnboost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_FILE_DESCRIPTOR_HPP_INCLUDED
diff --git a/include/ndnboost/iostreams/device/mapped_file.hpp b/include/ndnboost/iostreams/device/mapped_file.hpp
new file mode 100644
index 0000000..f8fbd55
--- /dev/null
+++ b/include/ndnboost/iostreams/device/mapped_file.hpp
@@ -0,0 +1,599 @@
+// (C) Copyright Jorge Lodos 2008.
+// (C) Copyright Jonathan Turkanis 2003.
+// (C) Copyright Craig Henderson 2002.   'boost/memmap.hpp' from sandbox
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+#ifndef NDNBOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/config.hpp>                   // make sure size_t is in std.
+#include <cstddef>                            // size_t.
+#include <string>                             // pathnames.
+#include <utility>                            // pair.
+#include <ndnboost/config.hpp>                   // NDNBOOST_MSVC.
+#include <ndnboost/detail/workaround.hpp>
+#include <ndnboost/iostreams/close.hpp>
+#include <ndnboost/iostreams/concepts.hpp>
+#include <ndnboost/iostreams/detail/config/auto_link.hpp>
+#include <ndnboost/iostreams/detail/config/dyn_link.hpp>
+#include <ndnboost/iostreams/detail/config/wide_streams.hpp>
+#include <ndnboost/iostreams/detail/ios.hpp>     // openmode, failure
+#include <ndnboost/iostreams/detail/path.hpp>
+#include <ndnboost/iostreams/operations_fwd.hpp>
+#include <ndnboost/iostreams/positioning.hpp>
+#include <ndnboost/shared_ptr.hpp>
+#include <ndnboost/static_assert.hpp>
+#include <ndnboost/throw_exception.hpp>
+#include <ndnboost/type_traits/is_same.hpp>
+
+// Must come last.
+#include <ndnboost/config/abi_prefix.hpp>
+
+namespace ndnboost { namespace iostreams {
+
+//------------------Definition of mapped_file_base and mapped_file_params-----//
+
+// Forward declarations
+class mapped_file_source;
+class mapped_file_sink;
+class mapped_file;
+namespace detail { class mapped_file_impl; }
+
+class mapped_file_base {
+public:
+    enum mapmode {
+        readonly = 1,
+        readwrite = 2,
+        priv = 4
+    };
+};
+
+// Bitmask operations for mapped_file_base::mapmode
+mapped_file_base::mapmode 
+operator|(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
+
+mapped_file_base::mapmode 
+operator&(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
+
+mapped_file_base::mapmode 
+operator^(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
+
+mapped_file_base::mapmode 
+operator~(mapped_file_base::mapmode a);
+
+mapped_file_base::mapmode 
+operator|=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
+
+mapped_file_base::mapmode 
+operator&=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
+
+mapped_file_base::mapmode 
+operator^=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
+
+//------------------Definition of mapped_file_params--------------------------//
+
+namespace detail {
+
+struct mapped_file_params_base {
+    mapped_file_params_base()
+        : flags(static_cast<mapped_file_base::mapmode>(0)), 
+          mode(), offset(0), length(static_cast<std::size_t>(-1)), 
+          new_file_size(0), hint(0)
+        { }
+private:
+    friend class mapped_file_impl;
+    void normalize();
+public:
+    mapped_file_base::mapmode   flags;
+    NDNBOOST_IOS::openmode         mode;  // Deprecated
+    stream_offset               offset;
+    std::size_t                 length;
+    stream_offset               new_file_size;
+    const char*                 hint;
+};
+
+} // End namespace detail.
+
+// This template allows Boost.Filesystem paths to be specified when creating or
+// reopening a memory mapped file, without creating a dependence on
+// Boost.Filesystem. Possible values of Path include std::string,
+// ndnboost::filesystem::path, ndnboost::filesystem::wpath, 
+// and ndnboost::iostreams::detail::path (used to store either a std::string or a
+// std::wstring).
+template<typename Path>
+struct basic_mapped_file_params 
+    : detail::mapped_file_params_base 
+{
+    typedef detail::mapped_file_params_base base_type;
+
+    // For wide paths, instantiate basic_mapped_file_params 
+    // with ndnboost::filesystem::wpath
+#ifndef NDNBOOST_IOSTREAMS_NO_WIDE_STREAMS
+    NDNBOOST_STATIC_ASSERT((!is_same<Path, std::wstring>::value));
+#endif
+
+    // Default constructor
+    basic_mapped_file_params() { }
+
+    // Construction from a Path
+    explicit basic_mapped_file_params(const Path& p) : path(p) { }
+
+    // Construction from a path of a different type
+    template<typename PathT>
+    explicit basic_mapped_file_params(const PathT& p) : path(p) { }
+
+    // Copy constructor
+    basic_mapped_file_params(const basic_mapped_file_params& other)
+        : base_type(other), path(other.path)
+        { }
+
+    // Templated copy constructor
+    template<typename PathT>
+    basic_mapped_file_params(const basic_mapped_file_params<PathT>& other)
+        : base_type(other), path(other.path)
+        { }
+
+    typedef Path  path_type;
+    Path          path;
+};
+
+typedef basic_mapped_file_params<std::string> mapped_file_params;
+
+//------------------Definition of mapped_file_source--------------------------//
+
+class NDNBOOST_IOSTREAMS_DECL mapped_file_source : public mapped_file_base {
+private:
+    struct safe_bool_helper { int x; };
+    typedef int safe_bool_helper::*                 safe_bool;
+    typedef detail::mapped_file_impl                impl_type;
+    typedef basic_mapped_file_params<detail::path>  param_type;
+    friend class mapped_file;
+    friend class detail::mapped_file_impl;
+    friend struct ndnboost::iostreams::operations<mapped_file_source>;
+public:
+    typedef char                                    char_type;
+    struct category
+        : public source_tag,
+          public direct_tag,
+          public closable_tag
+        { };
+    typedef std::size_t                             size_type;
+    typedef const char*                             iterator;
+    NDNBOOST_STATIC_CONSTANT(size_type, max_length = static_cast<size_type>(-1));
+
+    // Default constructor
+    mapped_file_source();
+
+    // Constructor taking a parameters object
+    template<typename Path>
+    explicit mapped_file_source(const basic_mapped_file_params<Path>& p);
+
+    // Constructor taking a list of parameters
+    template<typename Path>
+    explicit mapped_file_source( const Path& path,
+                                 size_type length = max_length,
+                                 ndnboost::intmax_t offset = 0 );
+
+    // Copy Constructor
+    mapped_file_source(const mapped_file_source& other);
+
+    //--------------Stream interface------------------------------------------//
+
+    template<typename Path>
+    void open(const basic_mapped_file_params<Path>& p);
+
+    template<typename Path>
+    void open( const Path& path,
+               size_type length = max_length,
+               ndnboost::intmax_t offset = 0 );
+
+    bool is_open() const;
+    void close();
+    operator safe_bool() const;
+    bool operator!() const;
+    mapmode flags() const;
+
+    //--------------Container interface---------------------------------------//
+
+    size_type size() const;
+    const char* data() const;
+    iterator begin() const;
+    iterator end() const;
+
+    //--------------Query admissible offsets----------------------------------//
+
+    // Returns the allocation granularity for virtual memory. Values passed
+    // as offsets must be multiples of this value.
+    static int alignment();
+
+private:
+    void init();
+    void open_impl(const param_type& p);
+
+    ndnboost::shared_ptr<impl_type> pimpl_;
+};
+
+//------------------Definition of mapped_file---------------------------------//
+
+class NDNBOOST_IOSTREAMS_DECL mapped_file : public mapped_file_base {
+private:
+    typedef mapped_file_source                      delegate_type;
+    typedef delegate_type::safe_bool                safe_bool;
+    typedef basic_mapped_file_params<detail::path>  param_type;
+    friend struct ndnboost::iostreams::operations<mapped_file >;
+    friend class mapped_file_sink;
+public:
+    typedef char                                    char_type;
+    struct category
+        : public seekable_device_tag,
+          public direct_tag,
+          public closable_tag
+        { };
+    typedef mapped_file_source::size_type           size_type;
+    typedef char*                                   iterator;
+    typedef const char*                             const_iterator;
+    NDNBOOST_STATIC_CONSTANT(size_type, max_length = delegate_type::max_length);
+
+    // Default constructor
+    mapped_file() { }
+
+    // Construstor taking a parameters object
+    template<typename Path>
+    explicit mapped_file(const basic_mapped_file_params<Path>& p);
+
+    // Constructor taking a list of parameters
+    template<typename Path>
+    mapped_file( const Path& path,
+                 mapmode flags,
+                 size_type length = max_length,
+                 stream_offset offset = 0 );
+
+    // Constructor taking a list of parameters, including a 
+    // std::ios_base::openmode (deprecated)
+    template<typename Path>
+    explicit mapped_file( const Path& path,
+                          NDNBOOST_IOS::openmode mode =
+                              NDNBOOST_IOS::in | NDNBOOST_IOS::out,
+                          size_type length = max_length,
+                          stream_offset offset = 0 );
+
+    // Copy Constructor
+    mapped_file(const mapped_file& other);
+
+    //--------------Conversion to mapped_file_source (deprecated)-------------//
+
+    operator mapped_file_source&() { return delegate_; }
+    operator const mapped_file_source&() const { return delegate_; }
+
+    //--------------Stream interface------------------------------------------//
+
+    // open overload taking a parameters object
+    template<typename Path>
+    void open(const basic_mapped_file_params<Path>& p);
+
+    // open overload taking a list of parameters
+    template<typename Path>
+    void open( const Path& path,
+               mapmode mode,
+               size_type length = max_length,
+               stream_offset offset = 0 );
+
+    // open overload taking a list of parameters, including a 
+    // std::ios_base::openmode (deprecated)
+    template<typename Path>
+    void open( const Path& path,
+               NDNBOOST_IOS::openmode mode =
+                   NDNBOOST_IOS::in | NDNBOOST_IOS::out,
+               size_type length = max_length,
+               stream_offset offset = 0 );
+
+    bool is_open() const { return delegate_.is_open(); }
+    void close() { delegate_.close(); }
+    operator safe_bool() const { return delegate_; }
+    bool operator!() const { return !delegate_; }
+    mapmode flags() const { return delegate_.flags(); }
+
+    //--------------Container interface---------------------------------------//
+
+    size_type size() const { return delegate_.size(); }
+    char* data() const;
+    const char* const_data() const { return delegate_.data(); }
+    iterator begin() const { return data(); }
+    const_iterator const_begin() const { return const_data(); }
+    iterator end() const { return data() + size(); }
+    const_iterator const_end() const { return const_data() + size(); }
+
+    //--------------Query admissible offsets----------------------------------//
+
+    // Returns the allocation granularity for virtual memory. Values passed
+    // as offsets must be multiples of this value.
+    static int alignment() { return mapped_file_source::alignment(); }
+
+    //--------------File access----------------------------------------------//
+
+    void resize(stream_offset new_size);
+private:
+    delegate_type delegate_;
+};
+
+//------------------Definition of mapped_file_sink----------------------------//
+
+class NDNBOOST_IOSTREAMS_DECL mapped_file_sink : private mapped_file {
+public:
+    friend struct ndnboost::iostreams::operations<mapped_file_sink>;
+    using mapped_file::mapmode;
+    using mapped_file::readonly;
+    using mapped_file::readwrite;
+    using mapped_file::priv;
+    using mapped_file::char_type;
+    struct category
+        : public sink_tag,
+          public direct_tag,
+          public closable_tag
+        { };
+    using mapped_file::size_type;
+    using mapped_file::iterator;
+    using mapped_file::max_length;
+    using mapped_file::is_open;
+    using mapped_file::close;
+    using mapped_file::operator safe_bool;
+    using mapped_file::operator !;
+    using mapped_file::flags;
+    using mapped_file::size;
+    using mapped_file::data;
+    using mapped_file::begin;
+    using mapped_file::end;
+    using mapped_file::alignment;
+    using mapped_file::resize;
+
+    // Default constructor
+    mapped_file_sink() { }
+
+    // Constructor taking a parameters object
+    template<typename Path>
+    explicit mapped_file_sink(const basic_mapped_file_params<Path>& p);
+
+    // Constructor taking a list of parameters
+    template<typename Path>
+    explicit mapped_file_sink( const Path& path,
+                               size_type length = max_length,
+                               ndnboost::intmax_t offset = 0,
+                               mapmode flags = readwrite );
+
+    // Copy Constructor
+    mapped_file_sink(const mapped_file_sink& other);
+
+    // open overload taking a parameters object
+    template<typename Path>
+    void open(const basic_mapped_file_params<Path>& p);
+
+    // open overload taking a list of parameters
+    template<typename Path>
+    void open( const Path& path,
+               size_type length = max_length,
+               ndnboost::intmax_t offset = 0,
+               mapmode flags = readwrite );
+};
+
+//------------------Implementation of mapped_file_source----------------------//
+
+template<typename Path>
+mapped_file_source::mapped_file_source(const basic_mapped_file_params<Path>& p)
+{ init(); open(p); }
+
+template<typename Path>
+mapped_file_source::mapped_file_source( 
+    const Path& path, size_type length, ndnboost::intmax_t offset)
+{ init(); open(path, length, offset); }
+
+template<typename Path>
+void mapped_file_source::open(const basic_mapped_file_params<Path>& p)
+{
+    param_type params(p);
+    if (params.flags) {
+        if (params.flags != mapped_file::readonly)
+            ndnboost::throw_exception(NDNBOOST_IOSTREAMS_FAILURE("invalid flags"));
+    } else {
+        if (params.mode & NDNBOOST_IOS::out)
+            ndnboost::throw_exception(NDNBOOST_IOSTREAMS_FAILURE("invalid mode"));
+        params.mode |= NDNBOOST_IOS::in;
+    }
+    open_impl(params);
+}
+
+template<typename Path>
+void mapped_file_source::open(
+    const Path& path, size_type length, ndnboost::intmax_t offset)
+{
+    param_type p(path);
+    p.length = length;
+    p.offset = offset;
+    open(p);
+}
+
+//------------------Implementation of mapped_file-----------------------------//
+
+template<typename Path>
+mapped_file::mapped_file(const basic_mapped_file_params<Path>& p)
+{ open(p); }
+
+template<typename Path>
+mapped_file::mapped_file( 
+    const Path& path, mapmode flags, 
+    size_type length, stream_offset offset )
+{ open(path, flags, length, offset); }
+
+template<typename Path>
+mapped_file::mapped_file( 
+    const Path& path, NDNBOOST_IOS::openmode mode, 
+    size_type length, stream_offset offset )
+{ open(path, mode, length, offset); }
+
+template<typename Path>
+void mapped_file::open(const basic_mapped_file_params<Path>& p)
+{ delegate_.open_impl(p); }
+
+template<typename Path>
+void mapped_file::open( 
+    const Path& path, mapmode flags, 
+    size_type length, stream_offset offset )
+{
+    param_type p(path);
+    p.flags = flags;
+    p.length = length;
+    p.offset = offset;
+    open(p);
+}
+
+template<typename Path>
+void mapped_file::open( 
+    const Path& path, NDNBOOST_IOS::openmode mode, 
+    size_type length, stream_offset offset )
+{
+    param_type p(path);
+    p.mode = mode;
+    p.length = length;
+    p.offset = offset;
+    open(p);
+}
+
+inline char* mapped_file::data() const 
+{ return (flags() != readonly) ? const_cast<char*>(delegate_.data()) : 0; }
+
+//------------------Implementation of mapped_file_sink------------------------//
+
+template<typename Path>
+mapped_file_sink::mapped_file_sink(const basic_mapped_file_params<Path>& p)
+{ open(p); }
+
+template<typename Path>
+mapped_file_sink::mapped_file_sink(
+    const Path& path, size_type length,
+    ndnboost::intmax_t offset, mapmode flags )
+{ open(path, length, offset, flags); }
+
+template<typename Path>
+void mapped_file_sink::open(const basic_mapped_file_params<Path>& p)
+{
+    param_type params(p);
+    if (params.flags) {
+        if (params.flags & mapped_file::readonly)
+            ndnboost::throw_exception(NDNBOOST_IOSTREAMS_FAILURE("invalid flags"));
+    } else {
+        if (params.mode & NDNBOOST_IOS::in)
+            ndnboost::throw_exception(NDNBOOST_IOSTREAMS_FAILURE("invalid mode"));
+        params.mode |= NDNBOOST_IOS::out;
+    }
+    mapped_file::open(params);
+}
+
+template<typename Path>
+void mapped_file_sink::open(
+    const Path& path, size_type length,
+    ndnboost::intmax_t offset, mapmode flags )
+{
+    param_type p(path);
+    p.flags = flags;
+    p.length = length;
+    p.offset = offset;
+    open(p);
+}
+
+//------------------Specialization of direct_impl-----------------------------//
+
+template<>
+struct operations<mapped_file_source>
+    : ndnboost::iostreams::detail::close_impl<closable_tag>
+{
+    static std::pair<char*, char*>
+    input_sequence(mapped_file_source& src)
+    {
+        return std::make_pair( const_cast<char*>(src.begin()),
+                               const_cast<char*>(src.end()) );
+    }
+};
+
+template<>
+struct operations<mapped_file>
+    : ndnboost::iostreams::detail::close_impl<closable_tag>
+{
+    static std::pair<char*, char*>
+    input_sequence(mapped_file& file)
+    { 
+        return std::make_pair(file.begin(), file.end()); 
+    }
+    static std::pair<char*, char*>
+    output_sequence(mapped_file& file)
+    { 
+        return std::make_pair(file.begin(), file.end()); 
+    }
+};
+
+template<>
+struct operations<mapped_file_sink>
+    : ndnboost::iostreams::detail::close_impl<closable_tag>
+{
+    static std::pair<char*, char*>
+    output_sequence(mapped_file_sink& sink)
+    { 
+        return std::make_pair(sink.begin(), sink.end()); 
+    }
+};
+                    
+//------------------Definition of mapmode operators---------------------------//
+
+inline mapped_file::mapmode 
+operator|(mapped_file::mapmode a, mapped_file::mapmode b)
+{
+    return static_cast<mapped_file::mapmode>
+        (static_cast<int>(a) | static_cast<int>(b));
+}
+
+inline mapped_file::mapmode 
+operator&(mapped_file::mapmode a, mapped_file::mapmode b)
+{
+    return static_cast<mapped_file::mapmode>
+        (static_cast<int>(a) & static_cast<int>(b));
+}
+
+inline mapped_file::mapmode 
+operator^(mapped_file::mapmode a, mapped_file::mapmode b)
+{
+    return static_cast<mapped_file::mapmode>
+        (static_cast<int>(a) ^ static_cast<int>(b));
+}
+
+inline mapped_file::mapmode
+operator~(mapped_file::mapmode a)
+{
+    return static_cast<mapped_file::mapmode>(~static_cast<int>(a));
+}
+
+inline mapped_file::mapmode 
+operator|=(mapped_file::mapmode& a, mapped_file::mapmode b)
+{
+    return a = a | b;
+}
+
+inline mapped_file::mapmode 
+operator&=(mapped_file::mapmode& a, mapped_file::mapmode b)
+{
+    return a = a & b;
+}
+
+inline mapped_file::mapmode 
+operator^=(mapped_file::mapmode& a, mapped_file::mapmode b)
+{
+    return a = a ^ b;
+}
+
+} } // End namespaces iostreams, boost.
+
+#include <ndnboost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_MAPPED_FILE_HPP_INCLUDED
diff --git a/include/ndnboost/iostreams/device/null.hpp b/include/ndnboost/iostreams/device/null.hpp
new file mode 100644
index 0000000..66abd9b
--- /dev/null
+++ b/include/ndnboost/iostreams/device/null.hpp
@@ -0,0 +1,66 @@
+// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
+// (C) Copyright 2004-2007 Jonathan Turkanis
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
+
+// See http://www.boost.org/libs/iostreams for documentation.
+
+// Inspired by Daryle Walker's nullbuf from his More I/O submission.
+
+#ifndef NDNBOOST_IOSTREAMS_NULL_HPP_INCLUDED
+#define NDNBOOST_IOSTREAMS_NULL_HPP_INCLUDED
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+# pragma once
+#endif
+
+#include <ndnboost/iostreams/categories.hpp>
+#include <ndnboost/iostreams/detail/ios.hpp> // openmode, streamsize.
+#include <ndnboost/iostreams/positioning.hpp>
+
+namespace ndnboost { namespace iostreams {
+
+template<typename Ch, typename Mode>
+class basic_null_device {
+public:
+    typedef Ch char_type;
+    struct category
+        : public Mode,
+          public device_tag,
+          public closable_tag
+        { };
+    std::streamsize read(Ch*, std::streamsize) { return 0; }
+    std::streamsize write(const Ch*, std::streamsize n) { return n; }
+    std::streampos seek( stream_offset, NDNBOOST_IOS::seekdir,
+                         NDNBOOST_IOS::openmode = 
+                             NDNBOOST_IOS::in | NDNBOOST_IOS::out ) 
+    { return -1; }
+    void close() { }
+    void close(NDNBOOST_IOS::openmode) { }
+};
+
+template<typename Ch>
+struct basic_null_source : private basic_null_device<Ch, input> {
+    typedef Ch          char_type;
+    typedef source_tag  category;
+    using basic_null_device<Ch, input>::read;
+    using basic_null_device<Ch, input>::close;
+};
+
+typedef basic_null_source<char>     null_source;
+typedef basic_null_source<wchar_t>  wnull_source;
+
+template<typename Ch>
+struct basic_null_sink : private basic_null_device<Ch, output> {
+    typedef Ch        char_type;
+    typedef sink_tag  category;
+    using basic_null_device<Ch, output>::write;
+    using basic_null_device<Ch, output>::close;
+};
+
+typedef basic_null_sink<char>     null_sink;
+typedef basic_null_sink<wchar_t>  wnull_sink;
+
+} } // End namespaces iostreams, boost.
+
+#endif // #ifndef NDNBOOST_IOSTREAMS_NULL_HPP_INCLUDED