# wxBufferedOutputStream Class Reference
[Streams]

`#include <wx/stream.h>`

Inheritance diagram for wxBufferedOutputStream:
[legend]

## Detailed Description

This stream acts as a cache.

It caches the bytes to be written to the specified output stream (See wxFilterOutputStream). The data is only written when the cache is full, when the buffered stream is destroyed or when calling SeekO().

This class may not be used without some other stream to write the data to (such as a file stream or a memory stream).

##

Library: wxBase

Category: Streams

See also:
  wxStreamBuffer, wxOutputStream

## Public Member Functions
| wxBufferedOutputStream (wxOutputStream &stream, wxStreamBuffer *buffer=NULL)
| Constructor using the provided buffer or default.
| wxBufferedOutputStream (wxOutputStream &stream, size_t bufsize)
| Constructor allowing to specify the size of the buffer.
virtual | ~wxBufferedOutputStream ()
| Destructor.
virtual wxFileOffset | SeekO (wxFileOffset pos, wxSeekMode mode=wxFromStart)
| Calls Sync() and changes the stream position.
virtual void | Sync ()
| Flushes the buffer and calls Sync() on the parent stream.

List of all members.

## Constructor & Destructor Documentation

wxBufferedOutputStream::wxBufferedOutputStream | ( | wxOutputStream & | stream,
|  | wxStreamBuffer * | buffer = `NULL` |
| ) |  |  |

Constructor using the provided buffer or default.

Parameters:

  | stream | The associated low-level stream.
  | buffer | The buffer to use if non-NULL. Notice that the ownership of this buffer is taken by the stream, i.e. it will delete it. If this parameter is NULL a default 1KB buffer is used.

wxBufferedOutputStream::wxBufferedOutputStream | ( | wxOutputStream & | stream,
|  | size_t | bufsize |
| ) |  |  |

Constructor allowing to specify the size of the buffer.

This is just a more convenient alternative to creating a wxStreamBuffer of the given size and using the other overloaded constructor of this class.

Parameters:

  | stream | The associated low-level stream.
  | bufsize | The size of the buffer, in bytes.

Since:
  2.9.0

virtual wxBufferedOutputStream::~wxBufferedOutputStream | ( |  | ) | `[virtual]`

Destructor.

Calls Sync() and destroys the internal buffer.

## Member Function Documentation

virtual wxFileOffset wxBufferedOutputStream::SeekO | ( | wxFileOffset | pos,
|  | wxSeekMode | mode = `wxFromStart` |
| ) |  |  | `[virtual]`

Calls Sync() and changes the stream position.

Reimplemented from wxOutputStream.

virtual void wxBufferedOutputStream::Sync | ( |  | ) | `[virtual]`

Flushes the buffer and calls Sync() on the parent stream.

|  | [ top ]