Index: src/hu/varadiistvan/scpl/io/BlockingStream.cc
===================================================================
--- src/hu/varadiistvan/scpl/io/BlockingStream.cc	(revision 10)
+++ src/hu/varadiistvan/scpl/io/BlockingStream.cc	(revision 10)
@@ -0,0 +1,175 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "BlockingStream.h"
+
+#include "ReadingBuffer.h"
+#include "WritingBuffer.h"
+#include "Waiter.h"
+
+#include <cstring>
+#include <cstdio>
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::scpl::io::BlockingStream;
+
+using std::min;
+
+//------------------------------------------------------------------------------
+
+inline bool BlockingStream::checkInterrupted()
+{
+    if (!interrupted) {
+        interrupted = event.check();
+        if (!interrupted && event.failed()) {
+            setErrorCode(event.getErrorCode());
+        }
+    }
+
+    return interrupted;
+}
+
+//------------------------------------------------------------------------------
+
+bool BlockingStream::read(void* dest, size_t length)
+{
+    unsigned char* d = reinterpret_cast<unsigned char*>(dest);
+
+    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
+    while (length>0) {
+        size_t copied = readingBuffer.extract(d, length, readingOffset);
+        readingOffset += copied;
+        length -= copied;
+        d += copied;
+
+        if (length!=0) {
+            if (!fill()) return false;
+        }
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool BlockingStream::skip(size_t length)
+{
+    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
+    while (length>0) {
+        size_t toSkip = min(length, readingBuffer.getLength() - readingOffset);
+        readingOffset += toSkip;
+        length -= toSkip;
+
+        if (length!=0) {
+            if (!fill()) return false;
+        }
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool BlockingStream::write(const void* src, size_t length)
+{
+    const unsigned char* s = reinterpret_cast<const unsigned char*>(src);
+
+    WritingBuffer& writingBuffer = stream.getWritingBuffer();
+    while(length>0) {
+        size_t copied = writingBuffer.append(s, length);
+        length -= copied;
+        s += copied;
+
+        if (length==0) break;
+        if (!flush()) return false;
+    }
+
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+bool BlockingStream::flush()
+{
+    WritingBuffer& writingBuffer = stream.getWritingBuffer();
+    while (*this) {
+        if (checkInterrupted()) return false;
+
+        if (writingBuffer.write()) {
+            return true;
+        } else if (writingBuffer.failed()) {
+            setErrorCode(writingBuffer.getErrorCode());
+        } else {
+            Waiter* waiter = stream.getWaiter();
+            waiter->wait();
+            if (waiter->failed()) {
+                setErrorCode(waiter->getErrorCode());
+            }
+        }
+    }
+    return false;
+}
+
+//------------------------------------------------------------------------------
+
+bool BlockingStream::fill()
+{
+    ReadingBuffer& readingBuffer = stream.getReadingBuffer();
+
+    readingBuffer.reset();
+    readingOffset = 0;
+    while (*this) {
+        if (checkInterrupted()) return false;
+
+        if (readingBuffer.read()) {
+            eof = readingBuffer.isEmpty();
+            return !eof;
+        } else if (readingBuffer.failed()) {
+            setErrorCode(readingBuffer.getErrorCode());
+        } else {
+            Waiter* waiter = stream.getWaiter();
+            waiter->wait();
+            if (waiter->failed()) {
+                setErrorCode(waiter->getErrorCode());
+                return false;
+            }
+        }
+    }
+    return false;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/io/BlockingStream.h
===================================================================
--- src/hu/varadiistvan/scpl/io/BlockingStream.h	(revision 10)
+++ src/hu/varadiistvan/scpl/io/BlockingStream.h	(revision 10)
@@ -0,0 +1,197 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef HU_VARADIISTVAN_SCPL_IO_BLOCKINGSTREAM_H
+#define HU_VARADIISTVAN_SCPL_IO_BLOCKINGSTREAM_H
+//------------------------------------------------------------------------------
+
+#include "Failable.h"
+
+#include "BufferedStream.h"
+#include "WaitableEvent.h"
+
+#include <cstdlib>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl { namespace io {
+
+//------------------------------------------------------------------------------
+
+/**
+ * Wrapper for a buffered stream, which an event and provides
+ * blocking, but interruptible read() and write() operations.
+ *
+ * The class is designed in a way, that it expects its constructed
+ * instances to be called only from a single thread at a time, except
+ * for the interrupt() function, which may be called from another
+ * thread anytime.
+ */
+class BlockingStream : public Failable
+{
+private:
+    /**
+     * The buffered stream used.
+     */
+    BufferedStream& stream;
+
+    /**
+     * The waitable event.
+     */
+    WaitableEvent event;
+
+    /**
+     * Indicate if we are interrupted.
+     */
+    bool interrupted;
+
+    /**
+     * The offset in the buffer of the reading stream.
+     */
+    size_t readingOffset;
+
+    /**
+     * Indicate if the end-of-file has been reached while reading.
+     */
+    bool eof;
+
+public:
+    /**
+     * Construct the blocking stream for the given buffered stream.
+     *
+     * The stream must have a waiter which is used for waiting.
+     */
+    BlockingStream(BufferedStream& stream);
+
+    /**
+     * Determine if the stream has neither failed nor been
+     * interrupted.
+     */
+    operator bool() const;
+
+    /**
+     * Interrupt the stream. Pending or future read and write calls
+     * will return indicating error. The isInterrupted() function can
+     * be used to check if the stream was interrupted or not.
+     */
+    void interrupt();
+
+    /**
+     * Indicate if the stream is interrupted or not.
+     */
+    bool isInterrupted();
+
+    /**
+     * Read the given number of bytes into the given buffer.
+     *
+     * @return if the reading has succeeded
+     */
+    bool read(void* dest, size_t length);
+
+    /**
+     * Skip the given number of bytes.
+     */
+    bool skip(size_t length);
+
+    /**
+     * Write the given number of bytes from the given buffer. The data
+     * may not be written to the underlying stream fully, so if you
+     * want to make sure that it is sent, call flush() afterwards.
+     *
+     * @return true on success, false on error.
+     */
+    bool write(const void* src, size_t length);
+
+    /**
+     * Flush anything written so far into the buffer, but not to the
+     * underlying stream.
+     *
+     * @return whether the operation has succeeded.
+     */
+    bool flush();
+
+private:
+    /**
+     * Fill the buffer with data from the stream.
+     */
+    bool fill();
+
+    /**
+     * Check for the stream being interrupted.
+     *
+     * @return if the stream is interrupted, false otherwise
+     */
+    bool checkInterrupted();
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline BlockingStream::BlockingStream(BufferedStream& stream) :
+    stream(stream),
+    event(stream.getWaiter()),
+    interrupted(false),
+    readingOffset(0),
+    eof(false)
+{
+}
+
+//------------------------------------------------------------------------------
+
+inline BlockingStream::operator bool() const
+{
+    return !failed() && !interrupted && !eof;
+}
+
+//------------------------------------------------------------------------------
+
+inline void BlockingStream::interrupt()
+{
+    event.fire();
+}
+
+//------------------------------------------------------------------------------
+
+inline bool BlockingStream::isInterrupted()
+{
+    return interrupted;
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl::io */ } /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_IO_BLOCKINGSTREAM_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/io/DataStream.cc
===================================================================
--- src/hu/varadiistvan/scpl/io/DataStream.cc	(revision 10)
+++ src/hu/varadiistvan/scpl/io/DataStream.cc	(revision 10)
@@ -0,0 +1,119 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+//------------------------------------------------------------------------------
+
+#include "DataStream.h"
+
+//------------------------------------------------------------------------------
+
+using hu::varadiistvan::scpl::io::DataStream;
+
+using std::string;
+using std::min;
+
+//------------------------------------------------------------------------------
+
+size_t DataStream::readLength()
+{
+    size_t length = 0;
+
+    uint8_t d = 0;
+    do {
+        d = readU8();
+        length <<= 7;
+        length |= d&0x7f;
+    } while( (d&0x80)==0x80 );
+
+    return length;
+}
+
+//------------------------------------------------------------------------------
+
+string DataStream::readString()
+{
+    size_t length = readLength();
+    if (!*this) return "";
+
+    char* buffer = new char[length];
+    if (read(buffer, length)) {
+        string str(buffer, length);
+        delete buffer;
+        return str;
+    } else {
+        delete buffer;
+        return "";
+    }
+}
+
+//------------------------------------------------------------------------------
+
+size_t DataStream::readString(char* dest, size_t capacity)
+{
+    size_t length = readLength();
+    size_t destLength = 0;
+    if (*this && length>0) {
+        size_t destLength = min(length, capacity - 1);
+        if (read(dest, destLength)) {
+            if (destLength<length) {
+                if (!skip(length - destLength)) {
+                    length = destLength = 0;
+                }
+            }
+        } else {
+            length = destLength = 0;
+        }
+    } else {
+        length = 0;
+    }
+
+    dest[destLength] = '\0';
+
+    return length;
+}
+
+//------------------------------------------------------------------------------
+
+bool DataStream::writeLength(size_t length)
+{
+    do {
+        uint8_t x = length&0x7f;
+        length >>= 7;
+        if (length>0) x |= 0x80;
+        if (!writeU8(x)) return false;
+    } while(length>0);
+    return true;
+}
+
+//------------------------------------------------------------------------------
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/io/DataStream.h
===================================================================
--- src/hu/varadiistvan/scpl/io/DataStream.h	(revision 10)
+++ src/hu/varadiistvan/scpl/io/DataStream.h	(revision 10)
@@ -0,0 +1,444 @@
+// Copyright (c) 2013 by István Váradi
+
+// This file is part of VSCPL, a simple cross-platform utility library
+
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+
+// 1. Redistributions of source code must retain the above copyright notice, this
+//    list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+//    this list of conditions and the following disclaimer in the documentation
+//    and/or other materials provided with the distribution.
+
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// The views and conclusions contained in the software and documentation are those
+// of the authors and should not be interpreted as representing official policies,
+// either expressed or implied, of the FreeBSD Project.
+
+#ifndef HU_VARADIISTVAN_SCPL_IO_DATASTREAM_H
+#define HU_VARADIISTVAN_SCPL_IO_DATASTREAM_H
+//------------------------------------------------------------------------------
+
+#include "BlockingStream.h"
+
+#include <string>
+
+#include <cstring>
+
+#include <inttypes.h>
+
+//------------------------------------------------------------------------------
+
+namespace hu { namespace varadiistvan { namespace scpl { namespace io {
+
+//------------------------------------------------------------------------------
+
+/**
+ * A blocking stream with extra functions to read and write values of
+ * basic data types. The values are read and written in host
+ * byte-order, so this stream does not work properly between machines
+ * of different endianness.
+ *
+ * The reading functions return the value read and you can check of
+ * error or interruption only by calling the appropriate
+ * functions. The purpose of this behaviour is that the data could be
+ * read item-by-item without having to check for the stream's
+ * health all the time. Such checks are needed only, if some decision
+ * is made, based on the data. In case of an error, the read functions
+ * return some well-define default value, typically 0.
+ *
+ * The writing functions return a boolean value indicating success or
+ * failure, but writing can be handled the same way as reading from
+ * the point of view of error checking.
+ */
+class DataStream : public BlockingStream
+{
+public:
+    /**
+     * Construct the stream.
+     */
+    DataStream(BufferedStream& stream);
+
+    /**
+     * Template for simple, type-specific reading.
+     */
+    template <typename T> T readT(T defaultValue = 0);
+
+    /**
+     * Read a signed, 8-bit value
+     */
+    int8_t readS8();
+
+    /**
+     * Read an unsigned, 8-bit value
+     */
+    uint8_t readU8();
+
+    /**
+     * Read a signed, 16-bit value
+     */
+    int16_t readS16();
+
+    /**
+     * Read an unsigned, 16-bit value
+     */
+    uint16_t readU16();
+
+    /**
+     * Read a signed, 32-bit value
+     */
+    int32_t readS32();
+
+    /**
+     * Read an unsigned, 32-bit value
+     */
+    uint32_t readU32();
+
+    /**
+     * Read a signed, 64-bit value
+     */
+    int64_t readS64();
+
+    /**
+     * Read an unsigned, 64-bit value
+     */
+    uint64_t readU64();
+
+    /**
+     * Read a float value.
+     */
+    float readFloat();
+
+    /**
+     * Read a double value.
+     */
+    double readDouble();
+
+    /**
+     * Read a long double value.
+     */
+    long double readLongDouble();
+
+    /**
+     * Read a length value. This is a of at most 32 bits, represented
+     * by a variable number of bytes for space efficiency.
+     *
+     * @see writeLength()
+     */
+    size_t readLength();
+
+    /**
+     * Read a string.
+     */
+    std::string readString();
+
+    /**
+     * Read a string into the given buffer. If the string is too large
+     * for the buffer, its end will be discarded. A trailing 0 is
+     * added in cases!
+     *
+     * @return the actual length of the string.
+     */
+    size_t readString(char* dest, size_t capacity);
+
+    /**
+     * Write a signed, 8-bit value
+     */
+    bool writeS8(int8_t x);
+
+    /**
+     * Write an unsigned, 8-bit value
+     */
+    bool writeU8(uint8_t x);
+
+    /**
+     * Write a signed, 16-bit value
+     */
+    bool writeS16(int16_t x);
+
+    /**
+     * Write an unsigned, 16-bit value
+     */
+    bool writeU16(uint16_t x);
+
+    /**
+     * Write a signed, 32-bit value
+     */
+    bool writeS32(int32_t x);
+
+    /**
+     * Write an unsigned, 32-bit value
+     */
+    bool writeU32(uint32_t x);
+
+    /**
+     * Write a signed, 64-bit value
+     */
+    bool writeS64(int64_t x);
+
+    /**
+     * Write an unsigned, 64-bit value
+     */
+    bool writeU64(uint64_t x);
+
+    /**
+     * Write a float value.
+     */
+    bool writeFloat(float x);
+
+    /**
+     * Write a double value.
+     */
+    bool writeDouble(double x);
+
+    /**
+     * Write a long double value.
+     */
+    bool writeLongDouble(long double x);
+
+    /**
+     * Write a length value. This a 32-bit value written as a sequence
+     * of bytes of variable length. A bytes's lower 7 bits contain
+     * parts of the value. The MSB indicates if another byte is left.
+     */
+    bool writeLength(size_t length);
+
+    /**
+     * Write a string. First the string's length is written as a
+     * length (see writeLength()), then the characters of the string
+     * without the trailing 0.
+     */
+    bool writeString(const char* s, size_t length);
+
+    /**
+     * Write a string. First the string's length is written as a
+     * length (see writeLength()), then the characters of the string
+     * without the trailing 0.
+     */
+    bool writeString(const std::string& s);
+
+    /**
+     * Write a string. First the string's length is written as a
+     * length (see writeLength()), then the characters of the string
+     * without the trailing 0.
+     */
+    bool writeString(const char* s);
+};
+
+//------------------------------------------------------------------------------
+// Inline definitions
+//------------------------------------------------------------------------------
+
+inline DataStream::DataStream(BufferedStream& stream) :
+    BlockingStream(stream)
+{
+}
+
+//------------------------------------------------------------------------------
+
+template <typename T> T DataStream::readT(T defaultValue)
+{
+    T value = defaultValue;
+    read(&value, sizeof(value));
+    return value;
+}
+
+//------------------------------------------------------------------------------
+
+inline int8_t DataStream::readS8()
+{
+    return readT<int8_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline uint8_t DataStream::readU8()
+{
+    return readT<uint8_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline int16_t DataStream::readS16()
+{
+    return readT<int16_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline uint16_t DataStream::readU16()
+{
+    return readT<uint16_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline int32_t DataStream::readS32()
+{
+    return readT<int32_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline uint32_t DataStream::readU32()
+{
+    return readT<uint32_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline int64_t DataStream::readS64()
+{
+    return readT<int64_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline uint64_t DataStream::readU64()
+{
+    return readT<uint64_t>(0);
+}
+
+//------------------------------------------------------------------------------
+
+inline float DataStream::readFloat()
+{
+    return readT<float>(0.0);
+}
+
+//------------------------------------------------------------------------------
+
+inline double DataStream::readDouble()
+{
+    return readT<double>(0.0);
+}
+
+//------------------------------------------------------------------------------
+
+inline long double DataStream::readLongDouble()
+{
+    return readT<long double>(0.0);
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeS8(int8_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeU8(uint8_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeS16(int16_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeU16(uint16_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeS32(int32_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeU32(uint32_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeS64(int64_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeU64(uint64_t x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeFloat(float x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeDouble(double x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeLongDouble(long double x)
+{
+    return write(&x, sizeof(x));
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeString(const char* s, size_t length)
+{
+    if (!writeLength(length)) return false;
+    else return write(s, length);
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeString(const std::string& s)
+{
+    return writeString(s.c_str(), s.length());
+}
+
+//------------------------------------------------------------------------------
+
+inline bool DataStream::writeString(const char* s)
+{
+    return writeString(s, strlen(s));
+}
+
+//------------------------------------------------------------------------------
+
+} /* namespace hu::varadiistvan::scpl::io */ } /* namespace hu::varadiistvan::scpl */ } /* namespace hu::varadiistvan */ } /* namespace hu */
+
+//------------------------------------------------------------------------------
+#endif // HU_VARADIISTVAN_SCPL_IO_DATASTREAM_H
+
+// Local Variables:
+// mode: C++
+// c-basic-offset: 4
+// indent-tabs-mode: nil
+// End:
Index: src/hu/varadiistvan/scpl/io/Makefile.am
===================================================================
--- src/hu/varadiistvan/scpl/io/Makefile.am	(revision 8)
+++ src/hu/varadiistvan/scpl/io/Makefile.am	(revision 10)
@@ -1,3 +1,5 @@
 SUBDIRS=
+
+INCLUDES = -I$(top_builddir)/src
 
 if TARGET_API_POSIX
@@ -12,5 +14,7 @@
 noinst_LTLIBRARIES=libvscpl_io.la
 
-libvscpl_io_la_SOURCES=
+libvscpl_io_la_SOURCES=\
+        BlockingStream.cc       \
+        DataStream.cc
 
 if TARGET_API_POSIX
@@ -35,3 +39,5 @@
         LocalSocket.h           \
         LocalAcceptor.h         \
-        LocalServerSocket.h
+        LocalServerSocket.h     \
+        BlockingStream.h        \
+        DataStream.h
