From 255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 16 Feb 2012 03:35:41 +0000 Subject: Added MemBuf docs and a new readAll function to the base stream class. More helpers never really hurt. --- src/stream.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/stream.cpp') diff --git a/src/stream.cpp b/src/stream.cpp index 028166e..58641cc 100644 --- a/src/stream.cpp +++ b/src/stream.cpp @@ -30,6 +30,22 @@ Bu::String Bu::Stream::readLine() } } +Bu::String Bu::Stream::readAll() +{ + Bu::String sRet; + char buf[4096]; + + while( !isEos() ) + { + int iRead = read( buf, 4096 ); + if( iRead == 0 ) + return sRet; + sRet.append( buf, iRead ); + } + + return sRet; +} + Bu::size Bu::Stream::write( const Bu::String &sBuf ) { return write( sBuf.getStr(), sBuf.getSize() ); -- cgit v1.2.3