1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStreamBase and its derived classes
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
10 These enumeration values are returned by various functions in the context
15 wxSTREAM_NO_ERROR
= 0, //!< No error occurred.
16 wxSTREAM_EOF
, //!< EOF reached in Read() or similar.
17 wxSTREAM_WRITE_ERROR
, //!< generic write error on the last write call.
18 wxSTREAM_READ_ERROR
//!< generic read error on the last read call.
24 This class is the base class of most stream related classes in wxWidgets.
25 It must not be used directly.
36 Creates a dummy stream object. It doesn't do anything.
43 virtual ~wxStreamBase();
46 This function returns the last error.
48 wxStreamError
GetLastError() const;
51 Returns the length of the stream in bytes. If the length cannot be
52 determined (this is always the case for socket streams for example),
53 returns ::wxInvalidOffset.
57 virtual wxFileOffset
GetLength() const;
60 This function returns the size of the stream.
61 For example, for a file it is the size of the file.
64 There are streams which do not have size by definition, such as socket
65 streams. In that cases, GetSize() returns 0 so you should always test its
68 virtual size_t GetSize() const;
71 Returns @true if no error occurred on the stream.
75 virtual bool IsOk() const;
78 Returns @true if the stream supports seeking to arbitrary offsets.
80 virtual bool IsSeekable() const;
83 Resets the stream state.
85 By default, resets the stream to good state, i.e. clears any errors.
86 Since wxWidgets 2.9.3 can be also used to explicitly set the state to
87 the specified error (the @a error argument didn't exist in the previous
92 void Reset(wxStreamError error
= wxSTREAM_NO_ERROR
);
95 Returns the opposite of IsOk().
96 You can use this function to test the validity of the stream as if
100 bool DoSomething(wxInputStream& stream)
103 if (!stream.Read(&data, 4))
109 bool operator!() const;
115 It is called when the stream needs to change the current position.
120 One of the ::wxSeekMode enumeration values.
122 @return The new stream position or ::wxInvalidOffset on error.
124 virtual wxFileOffset
OnSysSeek(wxFileOffset pos
, wxSeekMode mode
);
128 It is called when the stream needs to know the real position.
130 @return The current stream position.
132 virtual wxFileOffset
OnSysTell() const;
136 @class wxStreamBuffer
138 wxStreamBuffer is a cache manager for wxStreamBase: it manages a stream buffer
141 Each stream always has one autoinitialized stream buffer, but you may
142 attach more of them to the same stream.
147 @see wxStreamBase, @ref overview_stream
161 Constructor, creates a new stream buffer using @a stream as a parent stream
162 and mode as the IO mode.
167 Can be: wxStreamBuffer::read, wxStreamBuffer::write, wxStreamBuffer::read_write.
169 One stream can have many stream buffers but only one is used internally
170 to pass IO call (e.g. wxInputStream::Read() -> wxStreamBuffer::Read()),
171 but you can call directly wxStreamBuffer::Read without any problems.
172 Note that all errors and messages linked to the stream are stored in the
173 stream, not the stream buffers:
176 streambuffer.Read(...);
177 streambuffer2.Read(...);
178 // This call erases previous error messages set by 'streambuffer'
179 // assuming that both instances are stream buffers for the same stream
184 wxStreamBuffer(wxStreamBase
& stream
, BufMode mode
);
187 Constructor for an input buffer of the specified size.
189 Using it is equivalent to using the constructor above with read mode
190 and calling SetBufferIO() but is more convenient.
195 The size of buffer in bytes.
197 The associated input stream, the buffer will be used in read mode.
199 wxStreamBuffer(size_t bufsize
, wxInputStream
& stream
);
202 Constructor for an output buffer of the specified size.
204 Using it is equivalent to using the constructor above with write mode
205 and calling SetBufferIO() but is more convenient.
210 The size of buffer in bytes.
212 The associated output stream, the buffer will be used in write mode.
214 wxStreamBuffer(size_t bufsize
, wxOutputStream
& stream
);
217 Constructor; creates a new empty stream buffer which won't flush any data
218 to a stream. mode specifies the type of the buffer (read, write, read_write).
220 This stream buffer has the advantage to be stream independent and to work
221 only on memory buffers but it is still compatible with the rest of the
222 wxStream classes. You can write, read to this special stream and it will
223 grow (if it is allowed by the user) its internal buffer.
224 Briefly, it has all functionality of a "normal" stream.
227 The "read_write" mode doesn't currently work for standalone stream buffers.
231 wxStreamBuffer(BufMode mode
);
236 This method initializes the stream buffer with the data of the specified
237 stream buffer. The new stream buffer has the same attributes, size, position
238 and they share the same buffer. This will cause problems if the stream to
239 which the stream buffer belong is destroyed and the newly cloned stream
240 buffer continues to be used, trying to call functions in the (destroyed)
241 stream. It is advised to use this feature only in very local area of the
244 wxStreamBuffer(const wxStreamBuffer
& buffer
);
248 It finalizes all IO calls and frees all internal buffers if necessary.
258 Toggles the fixed flag. Usually this flag is toggled at the same time as
259 @e flushable. This flag allows (when it has the @false value) or forbids
260 (when it has the @true value) the stream buffer to resize dynamically the
265 void Fixed(bool fixed
);
268 Flushes the IO buffer.
273 Toggles the flushable flag.
274 If @a flushable is disabled, no data are sent to the parent stream.
276 void Flushable(bool flushable
);
279 Returns a pointer on the end of the stream buffer.
281 void* GetBufferEnd() const;
284 Returns a pointer on the current position of the stream buffer.
286 void* GetBufferPos() const;
289 Returns the size of the buffer.
291 size_t GetBufferSize() const;
294 Returns a pointer on the start of the stream buffer.
296 void* GetBufferStart() const;
299 Gets a single char from the stream buffer. It acts like the Read() call.
302 You aren't directly notified if an error occurred during the IO call.
306 virtual char GetChar();
309 Returns the amount of available data in the buffer.
311 size_t GetDataLeft();
314 Returns the current position (counted in bytes) in the stream buffer.
316 size_t GetIntPosition() const;
319 Returns the amount of bytes read during the last IO call to the parent stream.
321 size_t GetLastAccess() const;
324 Puts a single char to the stream buffer.
327 You aren't directly notified if an error occurred during the IO call.
331 virtual void PutChar(char c
);
334 Reads a block of the specified size and stores the data in buffer.
335 This function tries to read from the buffer first and if more data has
336 been requested, reads more data from the associated stream and updates
337 the buffer accordingly until all requested data is read.
339 @return It returns the size of the data read. If the returned size is
340 different of the specified size, an error has occurred and
341 should be tested using GetLastError().
343 virtual size_t Read(void* buffer
, size_t size
);
346 Copies data to @a buffer.
347 The function returns when @a buffer is full or when there isn't
348 any more data in the current buffer.
352 size_t Read(wxStreamBuffer
* buffer
);
355 Resets to the initial state variables concerning the buffer.
360 Changes the current position.
361 Parameter @a mode may be one of the following:
363 - @b wxFromStart: The position is counted from the start of the stream.
364 - @b wxFromCurrent: The position is counted from the current position of the stream.
365 - @b wxFromEnd: The position is counted from the end of the stream.
367 @return Upon successful completion, it returns the new offset as
368 measured in bytes from the beginning of the stream.
369 Otherwise, it returns ::wxInvalidOffset.
371 virtual wxFileOffset
Seek(wxFileOffset pos
, wxSeekMode mode
);
374 Specifies which pointers to use for stream buffering.
375 You need to pass a pointer on the start of the buffer end and another
376 on the end. The object will use this buffer to cache stream data.
377 It may be used also as a source/destination buffer when you create an
378 empty stream buffer (See wxStreamBuffer::wxStreamBuffer).
381 When you use this function, you will have to destroy the IO buffers
382 yourself after the stream buffer is destroyed or don't use it anymore.
383 In the case you use it with an empty buffer, the stream buffer will not
384 resize it when it is full.
386 @see wxStreamBuffer(), Fixed(), Flushable()
388 void SetBufferIO(void* start
, void* end
, bool takeOwnership
= false);
391 Destroys or invalidates the previous IO buffer and allocates a new one of the
395 All previous pointers aren't valid anymore.
398 The created IO buffer is growable by the object.
400 @see Fixed(), Flushable()
402 void SetBufferIO(size_t bufsize
);
405 Sets the current position (in bytes) in the stream buffer.
408 Since it is a very low-level function, there is no check on the position:
409 specifying an invalid position can induce unexpected results.
411 void SetIntPosition(size_t pos
);
414 Returns the parent stream of the stream buffer.
415 @deprecated use GetStream() instead
417 wxStreamBase
* Stream();
420 Gets the current position in the stream. This position is calculated from
421 the @e real position in the stream and from the internal buffer position: so
422 it gives you the position in the @e real stream counted from the start of
425 @return Returns the current position in the stream if possible,
426 ::wxInvalidOffset in the other case.
428 virtual wxFileOffset
Tell() const;
431 Truncates the buffer to the current position.
433 @note Truncate() cannot be used to enlarge the buffer. This is
434 usually not needed since the buffer expands automatically.
439 Writes a block of the specified size using data of buffer.
440 The data are cached in a buffer before being sent in one block to the stream.
442 virtual size_t Write(const void* buffer
, size_t size
);
447 size_t Write(wxStreamBuffer
* buffer
);
453 @class wxOutputStream
455 wxOutputStream is an abstract base class which may not be used directly.
456 It is the base class of all streams which provide a Write() function,
457 i.e. which can be used to output data (e.g. to a file, to a socket, etc).
459 If you want to create your own output stream, you'll need to derive from this
460 class and implement the protected OnSysWrite() function only.
465 class wxOutputStream
: public wxStreamBase
469 Creates a dummy wxOutputStream object.
476 virtual ~wxOutputStream();
479 Closes the stream, returning @false if an error occurs.
480 The stream is closed implicitly in the destructor if Close() is not
483 If this stream wraps another stream or some other resource such
484 as a file, then the underlying resource is closed too if it is owned
485 by this stream, or left open otherwise.
487 virtual bool Close();
490 Returns the number of bytes written during the last Write().
491 It may return 0 even if there is no error on the stream if it is
492 only temporarily impossible to write to it.
494 virtual size_t LastWrite() const;
497 Puts the specified character in the output queue and increments the
503 Changes the stream current position.
508 One of wxFromStart, wxFromEnd, wxFromCurrent.
510 @return The new stream position or ::wxInvalidOffset on error.
512 virtual wxFileOffset
SeekO(wxFileOffset pos
, wxSeekMode mode
= wxFromStart
);
515 Returns the current stream position.
517 virtual wxFileOffset
TellO() const;
520 Writes up to the specified amount of bytes using the data of buffer.
521 Note that not all data can always be written so you must check the number
522 of bytes really written to the stream using LastWrite() when this function
525 In some cases (for example a write end of a pipe which is currently full)
526 it is even possible that there is no errors and zero bytes have been written.
527 This function returns a reference on the current object, so the user can
528 test any states of the stream right away.
530 virtual wxOutputStream
& Write(const void* buffer
, size_t size
);
533 Reads data from the specified input stream and stores them
534 in the current stream. The data is read until an error is raised
535 by one of the two streams.
537 wxOutputStream
& Write(wxInputStream
& stream_in
);
540 Writes exactly the specified number of bytes from the buffer.
542 Returns @true if exactly @a size bytes were written. Otherwise, returns
543 @false and LastWrite() should be used to retrieve the exact amount of
544 the data written if necessary.
546 This method uses repeated calls to Write() (which may return writing
547 only part of the data) if necessary.
551 bool WriteAll(const void* buffer
, size_t size
);
555 Internal function. It is called when the stream wants to write data of the
556 specified size @a bufsize into the given @a buffer.
558 It should return the size that was actually wrote (which maybe zero if
559 @a bufsize is zero or if an error occurred; in this last case the internal
560 variable @c m_lasterror should be appropriately set).
562 size_t OnSysWrite(const void* buffer
, size_t bufsize
);
569 wxInputStream is an abstract base class which may not be used directly.
570 It is the base class of all streams which provide a Read() function,
571 i.e. which can be used to read data from a source (e.g. a file, a socket, etc).
573 If you want to create your own input stream, you'll need to derive from this
574 class and implement the protected OnSysRead() function only.
579 class wxInputStream
: public wxStreamBase
583 Creates a dummy input stream.
590 virtual ~wxInputStream();
593 Returns @true if some data is available in the stream right now, so that
594 calling Read() wouldn't block.
596 virtual bool CanRead() const;
599 Returns @true after an attempt has been made to read past the end of the
602 virtual bool Eof() const;
605 Returns the first character in the input queue and removes it,
606 blocking until it appears if necessary.
608 On success returns a value between 0 - 255; on end of file returns @c wxEOF.
613 Returns the last number of bytes read.
615 virtual size_t LastRead() const;
618 Returns the first character in the input queue without removing it.
623 Reads the specified amount of bytes and stores the data in buffer.
624 To check if the call was successful you must use LastRead() to check
625 if this call did actually read @a size bytes (if it didn't, GetLastError()
626 should return a meaningful value).
629 The buffer absolutely needs to have at least the specified size.
631 @return This function returns a reference on the current object, so the
632 user can test any states of the stream right away.
634 virtual wxInputStream
& Read(void* buffer
, size_t size
);
637 Reads data from the input queue and stores it in the specified output stream.
638 The data is read until an error is raised by one of the two streams.
640 @return This function returns a reference on the current object, so the
641 user can test any states of the stream right away.
643 wxInputStream
& Read(wxOutputStream
& stream_out
);
646 Reads exactly the specified number of bytes into the buffer.
648 Returns @true only if the entire amount of data was read, otherwise
649 @false is returned and the number of bytes really read can be retrieved
650 using LastRead(), as with Read().
652 This method uses repeated calls to Read() (which may return after
653 reading less than the requested number of bytes) if necessary.
656 The buffer absolutely needs to have at least the specified size.
660 bool ReadAll(void* buffer
, size_t size
);
663 Changes the stream current position.
665 This operation in general is possible only for seekable streams
666 (see wxStreamBase::IsSeekable()); non-seekable streams support only
667 seeking positive amounts in mode @c wxFromCurrent (this is implemented
668 by reading data and simply discarding it).
673 One of wxFromStart, wxFromEnd, wxFromCurrent.
675 @return The new stream position or ::wxInvalidOffset on error.
677 virtual wxFileOffset
SeekI(wxFileOffset pos
, wxSeekMode mode
= wxFromStart
);
680 Returns the current stream position or ::wxInvalidOffset if it's not
681 available (e.g. socket streams do not have a size nor a current stream
684 virtual wxFileOffset
TellI() const;
687 This function is only useful in read mode.
688 It is the manager of the "Write-Back" buffer. This buffer acts like a
689 temporary buffer where data which has to be read during the next read IO
690 call are put. This is useful when you get a big block of data which you
691 didn't want to read: you can replace them at the top of the input queue
694 Be very careful about this call in connection with calling SeekI() on
695 the same stream. Any call to SeekI() will invalidate any previous call
696 to this method (otherwise you could SeekI() to one position, "unread" a
697 few bytes there, SeekI() to another position and data would be either
700 @return Returns the amount of bytes saved in the Write-Back buffer.
702 size_t Ungetch(const void* buffer
, size_t size
);
705 This function acts like the previous one except that it takes only one
706 character: it is sometimes shorter to use than the generic function.
708 bool Ungetch(char c
);
713 Internal function. It is called when the stream wants to read data of the
714 specified size @a bufsize and wants it to be placed inside @a buffer.
716 It should return the size that was actually read or zero if EOF has been
717 reached or an error occurred (in this last case the internal @c m_lasterror
718 variable should be set accordingly as well).
720 size_t OnSysRead(void* buffer
, size_t bufsize
) = 0;
727 @class wxCountingOutputStream
729 wxCountingOutputStream is a specialized output stream which does not write any
730 data anywhere, instead it counts how many bytes would get written if this were a
731 normal stream. This can sometimes be useful or required if some data gets
732 serialized to a stream or compressed by using stream compression and thus the
733 final size of the stream cannot be known other than pretending to write the stream.
734 One case where the resulting size would have to be known is if the data has
735 to be written to a piece of memory and the memory has to be allocated before
736 writing to it (which is probably always the case when writing to a memory stream).
741 class wxCountingOutputStream
: public wxOutputStream
745 Creates a wxCountingOutputStream object.
747 wxCountingOutputStream();
752 virtual ~wxCountingOutputStream();
755 Returns the current length of the stream.
757 This is the amount of data written to the stream so far, in bytes.
759 virtual wxFileOffset
GetLength() const;
764 @class wxBufferedInputStream
766 This stream acts as a cache. It caches the bytes read from the specified
767 input stream (see wxFilterInputStream).
768 It uses wxStreamBuffer and sets the default in-buffer size to 1024 bytes.
769 This class may not be used without some other stream to read the data
770 from (such as a file stream or a memory stream).
775 @see wxStreamBuffer, wxInputStream, wxBufferedOutputStream
777 class wxBufferedInputStream
: public wxFilterInputStream
781 Constructor using the provided buffer or default.
784 The associated low-level stream.
786 The buffer to use if non-@NULL. Notice that the ownership of this
787 buffer is taken by the stream, i.e. it will delete it. If this
788 parameter is @NULL a default 1KB buffer is used.
790 wxBufferedInputStream(wxInputStream
& stream
,
791 wxStreamBuffer
*buffer
= NULL
);
794 Constructor allowing to specify the size of the buffer.
796 This is just a more convenient alternative to creating a wxStreamBuffer
797 of the given size and using the other overloaded constructor of this
801 The associated low-level stream.
803 The size of the buffer, in bytes.
807 wxBufferedInputStream(wxInputStream
& stream
, size_t bufsize
);
812 virtual ~wxBufferedInputStream();
819 Enumeration values used by wxFilterClassFactory.
821 enum wxStreamProtocolType
823 wxSTREAM_PROTOCOL
, //!< wxFileSystem protocol (should be only one).
824 wxSTREAM_MIMETYPE
, //!< MIME types the stream handles.
825 wxSTREAM_ENCODING
, //!< The HTTP Content-Encodings the stream handles.
826 wxSTREAM_FILEEXT
//!< File extensions the stream handles.
830 @class wxFilterClassFactory
832 Allows the creation of filter streams to handle compression formats such
835 For example, given a filename you can search for a factory that will
836 handle it and create a stream to decompress it:
839 factory = wxFilterClassFactory::Find(filename, wxSTREAM_FILEEXT);
841 stream = factory->NewStream(new wxFFileInputStream(filename));
844 wxFilterClassFactory::Find can also search for a factory by MIME type,
845 HTTP encoding or by wxFileSystem protocol.
846 The available factories can be enumerated using wxFilterClassFactory::GetFirst()
847 and wxFilterClassFactory::GetNext().
852 @see wxFilterInputStream, wxFilterOutputStream, wxArchiveClassFactory,
853 @ref overview_archive
855 class wxFilterClassFactory
: public wxObject
859 Returns @true if this factory can handle the given protocol, MIME type, HTTP
860 encoding or file extension.
862 When using @c wxSTREAM_FILEEXT for the second parameter, the first parameter
863 can be a complete filename rather than just an extension.
865 bool CanHandle(const wxString
& protocol
,
866 wxStreamProtocolType type
= wxSTREAM_PROTOCOL
) const;
869 A static member that finds a factory that can handle a given protocol, MIME
870 type, HTTP encoding or file extension. Returns a pointer to the class
871 factory if found, or @NULL otherwise.
872 It does not give away ownership of the factory.
874 When using @c wxSTREAM_FILEEXT for the second parameter, the first parameter
875 can be a complete filename rather than just an extension.
877 static const wxFilterClassFactory
* Find(const wxString
& protocol
,
878 wxStreamProtocolType type
= wxSTREAM_PROTOCOL
);
882 GetFirst and GetNext can be used to enumerate the available factories.
883 For example, to list them:
887 const wxFilterClassFactory *factory = wxFilterClassFactory::GetFirst();
890 list << factory->GetProtocol() << wxT("\n");
891 factory = factory->GetNext();
895 GetFirst()/GetNext() return a pointer to a factory or @NULL if no more
896 are available. They do not give away ownership of the factory.
898 static const wxFilterClassFactory
* GetFirst();
899 const wxFilterClassFactory
* GetNext() const;
903 Returns the wxFileSystem protocol supported by this factory.
904 Equivalent to @code wxString(*GetProtocols()) @endcode.
906 wxString
GetProtocol() const;
909 Returns the protocols, MIME types, HTTP encodings or file extensions
910 supported by this factory, as an array of null terminated strings.
911 It does not give away ownership of the array or strings.
913 For example, to list the file extensions a factory supports:
917 const wxChar *const *p;
919 for (p = factory->GetProtocols(wxSTREAM_FILEEXT); *p; p++)
920 list << *p << wxT("\n");
923 virtual const wxChar
* const* GetProtocols(wxStreamProtocolType type
= wxSTREAM_PROTOCOL
) const = 0;
927 Create a new input or output stream to decompress or compress a given stream.
929 If the parent stream is passed as a pointer then the new filter stream
930 takes ownership of it. If it is passed by reference then it does not.
932 virtual wxFilterInputStream
* NewStream(wxInputStream
& stream
) const = 0;
933 virtual wxFilterOutputStream
* NewStream(wxOutputStream
& stream
) const = 0;
934 virtual wxFilterInputStream
* NewStream(wxInputStream
* stream
) const = 0;
935 virtual wxFilterOutputStream
* NewStream(wxOutputStream
* stream
) const = 0;
939 Remove the file extension of @a location if it is one of the file
940 extensions handled by this factory.
942 wxString
PopExtension(const wxString
& location
) const;
945 Adds this class factory to the list returned by GetFirst()/GetNext().
947 It is not necessary to do this to use the filter streams. It is usually
948 used when implementing streams, typically the implementation will
949 add a static instance of its factory class.
951 It can also be used to change the order of a factory already in the list,
952 bringing it to the front. This isn't a thread safe operation so can't be
953 done when other threads are running that will be using the list.
955 The list does not take ownership of the factory.
960 Removes this class factory from the list returned by GetFirst()/GetNext().
961 Removing from the list isn't a thread safe operation so can't be done
962 when other threads are running that will be using the list.
964 The list does not own the factories, so removing a factory does not delete it.
972 @class wxFilterOutputStream
974 A filter stream has the capability of a normal stream but it can be placed
975 on top of another stream. So, for example, it can compress, encrypt the data
976 which are passed to it and write them to another stream.
979 The use of this class is exactly the same as of wxOutputStream.
980 Only a constructor differs and it is documented below.
985 @see wxFilterClassFactory, wxFilterInputStream
987 class wxFilterOutputStream
: public wxOutputStream
992 Initializes a "filter" stream.
994 If the parent stream is passed as a pointer then the new filter stream
995 takes ownership of it. If it is passed by reference then it does not.
997 wxFilterOutputStream(wxOutputStream
& stream
);
998 wxFilterOutputStream(wxOutputStream
* stream
);
1005 @class wxFilterInputStream
1007 A filter stream has the capability of a normal stream but it can be placed on
1008 top of another stream. So, for example, it can uncompress or decrypt the data which
1009 are read from another stream and pass it to the requester.
1012 The interface of this class is the same as that of wxInputStream.
1013 Only a constructor differs and it is documented below.
1018 @see wxFilterClassFactory, wxFilterOutputStream
1020 class wxFilterInputStream
: public wxInputStream
1025 Initializes a "filter" stream.
1027 If the parent stream is passed as a pointer then the new filter stream
1028 takes ownership of it. If it is passed by reference then it does not.
1030 wxFilterInputStream(wxInputStream
& stream
);
1031 wxFilterInputStream(wxInputStream
* stream
);
1038 @class wxBufferedOutputStream
1040 This stream acts as a cache. It caches the bytes to be written to the specified
1041 output stream (See wxFilterOutputStream). The data is only written when the
1042 cache is full, when the buffered stream is destroyed or when calling SeekO().
1044 This class may not be used without some other stream to write the data
1045 to (such as a file stream or a memory stream).
1050 @see wxStreamBuffer, wxOutputStream
1052 class wxBufferedOutputStream
: public wxFilterOutputStream
1056 Constructor using the provided buffer or default.
1059 The associated low-level stream.
1061 The buffer to use if non-@NULL. Notice that the ownership of this
1062 buffer is taken by the stream, i.e. it will delete it. If this
1063 parameter is @NULL a default 1KB buffer is used.
1065 wxBufferedOutputStream(wxOutputStream
& stream
,
1066 wxStreamBuffer
*buffer
= NULL
);
1069 Constructor allowing to specify the size of the buffer.
1071 This is just a more convenient alternative to creating a wxStreamBuffer
1072 of the given size and using the other overloaded constructor of this
1076 The associated low-level stream.
1078 The size of the buffer, in bytes.
1082 wxBufferedOutputStream(wxOutputStream
& stream
, size_t bufsize
);
1085 Destructor. Calls Sync() and destroys the internal buffer.
1087 virtual ~wxBufferedOutputStream();
1090 Calls Sync() and changes the stream position.
1092 virtual wxFileOffset
SeekO(wxFileOffset pos
, wxSeekMode mode
= wxFromStart
);
1095 Flushes the buffer and calls Sync() on the parent stream.
1097 virtual void Sync();
1102 @class wxWrapperInputStream
1104 A wrapper input stream is a kind of filter stream which forwards all the
1105 operations to its base stream. This is useful to build utility classes such
1109 The interface of this class is the same as that of wxInputStream.
1110 Only a constructor differs and it is documented below.
1115 @see wxFSInputStream, wxFilterInputStream
1118 class wxWrapperInputStream
: public wxFilterInputStream
1123 Initializes a wrapper stream.
1125 If the parent stream is passed as a pointer then the new wrapper stream
1126 takes ownership of it. If it is passed by reference then it does not.
1128 wxWrapperInputStream(wxInputStream
& stream
);
1129 wxWrapperInputStream(wxInputStream
* stream
);
1134 Default constructor, use InitParentStream() to finish initialization.
1136 This constructor can be used by the derived classes from their own
1137 constructors when the parent stream can't be specified immediately.
1138 The derived class must call InitParentStream() later to do it.
1140 wxWrapperInputStream();
1144 Set up the wrapped stream for an object initialized using the default
1147 The ownership logic is the same as for the non-default constructor,
1148 i.e. this object takes ownership of the stream if it's passed by
1149 pointer but not if it's passed by reference.
1151 void InitParentStream(wxInputStream
& stream
);
1152 void InitParentStream(wxInputStream
* stream
);