| Version: 3.0.2

- Main Page
- Related Pages
- Categories
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
wxCountingOutputStream Class Reference
Streams

`#include <wx/stream.h>`

Inheritance diagram for wxCountingOutputStream:
[legend]

## Detailed Description

wxCountingOutputStream is a specialized output stream which does not write any data anywhere, instead it counts how many bytes would get written if this were a normal stream.

This can sometimes be useful or required if some data gets serialized to a stream or compressed by using stream compression and thus the final size of the stream cannot be known other than pretending to write the stream. One case where the resulting size would have to be known is if the data has to be written to a piece of memory and the memory has to be allocated before writing to it (which is probably always the case when writing to a memory stream).

##

Library: wxBase
Category: Streams

## Public Member Functions
| wxCountingOutputStream ()
| Creates a wxCountingOutputStream object.
virtual | ~wxCountingOutputStream ()
| Destructor.
virtual wxFileOffset | GetLength () const
| Returns the current length of the stream.
Public Member Functions inherited from wxOutputStream
| wxOutputStream ()
| Creates a dummy wxOutputStream object.
virtual | ~wxOutputStream ()
| Destructor.
virtual bool | Close ()
| Closes the stream, returning false if an error occurs.
virtual size_t | LastWrite () const
| Returns the number of bytes written during the last Write().
void | PutC (char c)
| Puts the specified character in the output queue and increments the stream position.
virtual wxFileOffset | SeekO (wxFileOffset pos, wxSeekMode mode=wxFromStart)
| Changes the stream current position.
virtual wxFileOffset | TellO () const
| Returns the current stream position.
virtual wxOutputStream & | Write (const void *buffer, size_t size)
| Writes up to the specified amount of bytes using the data of buffer.
wxOutputStream & | Write (wxInputStream &stream_in)
| Reads data from the specified input stream and stores them in the current stream.
bool | WriteAll (const void *buffer, size_t size)
| Writes exactly the specified number of bytes from the buffer.
Public Member Functions inherited from wxStreamBase
| wxStreamBase ()
| Creates a dummy stream object.
virtual | ~wxStreamBase ()
| Destructor.
wxStreamError | GetLastError () const
| This function returns the last error.
virtual size_t | GetSize () const
| This function returns the size of the stream.
virtual bool | IsOk () const
| Returns true if no error occurred on the stream.
virtual bool | IsSeekable () const
| Returns true if the stream supports seeking to arbitrary offsets.
void | Reset (wxStreamError error=wxSTREAM_NO_ERROR)
| Resets the stream state.
bool | operator! () const
| Returns the opposite of IsOk().

## Additional Inherited Members
Protected Member Functions inherited from wxOutputStream
size_t | OnSysWrite (const void *buffer, size_t bufsize)
| Internal function.

## Constructor & Destructor Documentation

wxCountingOutputStream::wxCountingOutputStream | ( |  | ) |

Creates a wxCountingOutputStream object.

virtual wxCountingOutputStream::~wxCountingOutputStream | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

virtual wxFileOffset wxCountingOutputStream::GetLength | ( |  | ) | const
| virtual

Returns the current length of the stream.

This is the amount of data written to the stream so far, in bytes.

Reimplemented from wxStreamBase.