+/**
+ @class wxInputStream
+
+ wxInputStream is an abstract base class which may not be used directly.
+ It is the base class of all streams which provide a Read() function,
+ i.e. which can be used to read data from a source (e.g. a file, a socket, etc).
+
+ If you want to create your own input stream, you'll need to derive from this
+ class and implement the protected OnSysRead() function only.
+
+ @library{wxbase}
+ @category{streams}
+*/
+class wxInputStream : public wxStreamBase
+{
+public:
+ /**
+ Creates a dummy input stream.
+ */
+ wxInputStream();
+
+ /**
+ Destructor.
+ */
+ virtual ~wxInputStream();
+
+ /**
+ Returns @true if some data is available in the stream right now, so that
+ calling Read() wouldn't block.
+ */
+ virtual bool CanRead() const;
+
+ /**
+ Returns @true after an attempt has been made to read past the end of the
+ stream.
+ */
+ virtual bool Eof() const;
+
+ /**
+ 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 @c wxEOF.
+ */
+ int GetC();
+
+ /**
+ Returns the last number of bytes read.
+ */
+ virtual size_t LastRead() const;
+
+ /**
+ Returns the first character in the input queue without removing it.
+ */
+ virtual char Peek();
+
+ /**
+ Reads the specified amount of bytes and stores the data in buffer.
+ To check if the call was successfull you must use LastRead() to check
+ if this call did actually read @a size bytes (if it didn't, GetLastError()
+ should return a meaningful value).
+
+ @warning
+ The buffer absolutely needs to have at least the specified size.
+
+ @return This function returns a reference on the current object, so the
+ user can test any states of the stream right away.
+ */
+ virtual wxInputStream& Read(void* buffer, size_t size);
+
+ /**
+ 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.
+
+ @return This function returns a reference on the current object, so the
+ user can test any states of the stream right away.
+ */
+ wxInputStream& Read(wxOutputStream& stream_out);
+
+ /**
+ Changes the stream current position.
+
+ @param pos
+ Offset to seek to.
+ @param mode
+ One of wxFromStart, wxFromEnd, wxFromCurrent.
+
+ @return The new stream position or ::wxInvalidOffset on error.
+ */
+ virtual wxFileOffset SeekI(wxFileOffset pos, wxSeekMode mode = wxFromStart);
+
+ /**
+ Returns the current stream position.
+ */
+ virtual wxFileOffset TellI() const;
+
+ /**
+ 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).
+
+ @return Returns the amount of bytes saved in the Write-Back buffer.
+ */
+ size_t Ungetch(const void* buffer, size_t size);
+
+ /**
+ This function acts like the previous one except that it takes only one
+ character: it is sometimes shorter to use than the generic function.
+ */
+ bool Ungetch(char c);
+
+protected:
+
+ /**
+ Internal function. It is called when the stream wants to read data of the
+ specified size @a bufsize and wants it to be placed inside @a buffer.
+
+ It should return the size that was actually read or zero if EOF has been
+ reached or an error occurred (in this last case the internal @c m_lasterror
+ variable should be set accordingly as well).
+ */
+ size_t OnSysRead(void* buffer, size_t bufsize);
+};
+
+
+
+
+/**
+ @class wxCountingOutputStream
+
+ 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}
+*/
+class wxCountingOutputStream : public wxOutputStream
+{
+public:
+ /**
+ Creates a wxCountingOutputStream object.
+ */
+ wxCountingOutputStream();
+
+ /**
+ Destructor.
+ */
+ virtual ~wxCountingOutputStream();
+
+ /**
+ Returns the current size of the stream.
+ */
+ size_t GetSize() const;
+};
+
+
+/**
+ @class wxBufferedInputStream
+
+ This stream acts as a cache. It caches the bytes read from the specified
+ input stream (see wxFilterInputStream).
+ It uses wxStreamBuffer and sets the default in-buffer size to 1024 bytes.
+ This class may not be used without some other stream to read the data
+ from (such as a file stream or a memory stream).
+
+ @library{wxbase}
+ @category{streams}
+
+ @see wxStreamBuffer, wxInputStream, wxBufferedOutputStream
+*/
+class wxBufferedInputStream : public wxFilterInputStream
+{
+public:
+ /**
+ Constructor using the provided buffer or default.
+
+ @param stream
+ The associated low-level stream.
+ @param 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.
+ */
+ wxBufferedInputStream(wxInputStream& stream,
+ wxStreamBuffer *buffer = NULL);
+
+ /**
+ 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.
+
+ @param stream
+ The associated low-level stream.
+ @param bufsize
+ The size of the buffer, in bytes.
+
+ @since 2.9.0
+ */
+ wxBufferedInputStream(wxInputStream& stream, size_t bufsize);
+
+ /**
+ Destructor.
+ */
+ virtual ~wxBufferedInputStream();
+};
+
+
+
+
+/**
+ Enumeration values used by wxFilterClassFactory.
+*/
+enum wxStreamProtocolType
+{
+ wxSTREAM_PROTOCOL, //!< wxFileSystem protocol (should be only one).
+ wxSTREAM_MIMETYPE, //!< MIME types the stream handles.
+ wxSTREAM_ENCODING, //!< The HTTP Content-Encodings the stream handles.
+ wxSTREAM_FILEEXT //!< File extensions the stream handles.
+};