summaryrefslogtreecommitdiff
path: root/lib/common/IOStream.cpp
diff options
context:
space:
mode:
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));
+}