diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-02-16 03:35:41 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-02-16 03:35:41 +0000 |
| commit | 255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67 (patch) | |
| tree | 0d207452a5e819d5ee5710e37ed3943c38fff9bf /src/stream.cpp | |
| parent | 7d7bd049ed6815d3d2bac03331ff56102d224580 (diff) | |
| download | libbu++-255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67.tar.gz libbu++-255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67.tar.bz2 libbu++-255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67.tar.xz libbu++-255bd27d4e26d2e5cef9ad4d57bb9c18bc986c67.zip | |
Added MemBuf docs and a new readAll function to the base stream class.
More helpers never really hurt.
Diffstat (limited to '')
| -rw-r--r-- | src/stream.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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() | |||
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | Bu::String Bu::Stream::readAll() | ||
| 34 | { | ||
| 35 | Bu::String sRet; | ||
| 36 | char buf[4096]; | ||
| 37 | |||
| 38 | while( !isEos() ) | ||
| 39 | { | ||
| 40 | int iRead = read( buf, 4096 ); | ||
| 41 | if( iRead == 0 ) | ||
| 42 | return sRet; | ||
| 43 | sRet.append( buf, iRead ); | ||
| 44 | } | ||
| 45 | |||
| 46 | return sRet; | ||
| 47 | } | ||
| 48 | |||
| 33 | Bu::size Bu::Stream::write( const Bu::String &sBuf ) | 49 | Bu::size Bu::Stream::write( const Bu::String &sBuf ) |
| 34 | { | 50 | { |
| 35 | return write( sBuf.getStr(), sBuf.getSize() ); | 51 | return write( sBuf.getStr(), sBuf.getSize() ); |
