wxInputStream Class Reference
[Streams]

#include <wx/stream.h>

Inheritance diagram for wxInputStream:

wxStreamBase wxFFileInputStream wxFileInputStream wxFilterInputStream wxMemoryInputStream wxSocketInputStream wxStringInputStream wxArchiveInputStream wxBufferedInputStream wxZlibInputStream wxTarInputStream wxZipInputStream

List of all members.


Detailed Description

wxInputStream is an abstract base class which may not be used directly.

Library:  wxBase

Category:  Streams

Public Member Functions

 wxInputStream ()
virtual ~wxInputStream ()
virtual bool CanRead () const
virtual bool Eof () const
int GetC ()
virtual size_t LastRead () const
virtual char Peek ()
virtual wxInputStreamRead (void *buffer, size_t size)
wxInputStreamRead (wxOutputStream &stream_out)
virtual wxFileOffset SeekI (wxFileOffset pos, wxSeekMode mode=wxFromStart)
virtual wxFileOffset TellI () const
size_t Ungetch (const void *buffer, size_t size)
bool Ungetch (char c)

Constructor & Destructor Documentation

wxInputStream::wxInputStream (  ) 

Creates a dummy input stream.

virtual wxInputStream::~wxInputStream (  )  [virtual]

Destructor.


Member Function Documentation

virtual bool wxInputStream::CanRead (  )  const [virtual]

Returns true if some data is available in the stream right now, so that calling Read() wouldn't block.

virtual bool wxInputStream::Eof (  )  const [virtual]

Returns true after an attempt has been made to read past the end of the stream.

int wxInputStream::GetC (  ) 

Returns the first character in the input queue and removes it, blocking until it appears if necessary.

On success returns a value between 0 - 255; on end of file returns wxEOF.

virtual size_t wxInputStream::LastRead (  )  const [virtual]

Returns the last number of bytes read.

virtual char wxInputStream::Peek (  )  [virtual]

Returns the first character in the input queue without removing it.

virtual wxInputStream& wxInputStream::Read ( void *  buffer,
size_t  size 
) [virtual]

Reads the specified amount of bytes and stores the data in buffer.

Warning:
The buffer absolutely needs to have at least the specified size.
Returns:
This function returns a reference on the current object, so the user can test any states of the stream right away.

wxInputStream& wxInputStream::Read ( wxOutputStream stream_out  ) 

Reads data from the input queue and stores it in the specified output stream. The data is read until an error is raised by one of the two streams.

Returns:
This function returns a reference on the current object, so the user can test any states of the stream right away.

virtual wxFileOffset wxInputStream::SeekI ( wxFileOffset  pos,
wxSeekMode  mode = wxFromStart 
) [virtual]

Changes the stream current position.

Parameters:
pos Offset to seek to.
mode One of wxFromStart, wxFromEnd, wxFromCurrent.
Returns:
The new stream position or wxInvalidOffset on error.

virtual wxFileOffset wxInputStream::TellI (  )  const [virtual]

Returns the current stream position.

size_t wxInputStream::Ungetch ( const void *  buffer,
size_t  size 
)

This function is only useful in read mode. It is the manager of the "Write-Back" buffer. This buffer acts like a temporary buffer where data which has to be read during the next read IO call are put. This is useful when you get a big block of data which you didn't want to read: you can replace them at the top of the input queue by this way.

Be very careful about this call in connection with calling SeekI() on the same stream. Any call to SeekI() will invalidate any previous call to this method (otherwise you could SeekI() to one position, "unread" a few bytes there, SeekI() to another position and data would be either lost or corrupted).

Returns:
Returns the amount of bytes saved in the Write-Back buffer.

bool wxInputStream::Ungetch ( char  c  ) 

This function acts like the previous one except that it takes only one character: it is sometimes shorter to use than the generic function.



wxWidgets logo

[ top ]