summaryrefslogtreecommitdiff
path: root/lib/common/IOStream.cpp
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2009-04-02 13:58:11 +0200
committerReinhard Tartler <siretart@tauware.de>2009-04-02 13:58:11 +0200
commita84d45498bd861c9225080232948a99c2e317bb8 (patch)
tree8f1f5fb7bf7ffbf6f24cf4a4fd6888a235dbcc08 /lib/common/IOStream.cpp
parent25db897553a0db0f912602b375029e724f51556e (diff)
Import upstream version 0.11~rc3~r2491
Diffstat (limited to 'lib/common/IOStream.cpp')
-rw-r--r--lib/common/IOStream.cpp36
1 files changed, 23 insertions, 13 deletions
diff --git a/lib/common/IOStream.cpp b/lib/common/IOStream.cpp
index 3c7be561..fc9d0bc3 100644
--- a/lib/common/IOStream.cpp
+++ b/lib/common/IOStream.cpp
@@ -29,19 +29,6 @@ IOStream::IOStream()
// --------------------------------------------------------------------------
//
// Function
-// Name: IOStream::IOStream(const IOStream &)
-// Purpose: Copy constructor (exceptions)
-// Created: 2003/07/31
-//
-// --------------------------------------------------------------------------
-IOStream::IOStream(const IOStream &rToCopy)
-{
- THROW_EXCEPTION(CommonException, NotSupported)
-}
-
-// --------------------------------------------------------------------------
-//
-// Function
// Name: IOStream::~IOStream()
// Purpose: Destructor
// Created: 2003/07/31
@@ -238,4 +225,27 @@ bool IOStream::CopyStreamTo(IOStream &rCopyTo, int Timeout, int BufferSize)
return true; // completed
}
+// --------------------------------------------------------------------------
+//
+// Function
+// Name: IOStream::Flush(int Timeout)
+// Purpose: Read and discard all remaining data in stream.
+// Useful for protocol streams which must be flushed
+// to avoid breaking the protocol.
+// Created: 2008/08/20
+//
+// --------------------------------------------------------------------------
+void IOStream::Flush(int Timeout)
+{
+ char buffer[4096];
+ while(StreamDataLeft())
+ {
+ Read(buffer, sizeof(buffer), Timeout);
+ }
+}
+
+void IOStream::Write(const char *pBuffer)
+{
+ Write(pBuffer, strlen(pBuffer));
+}