Add wxInputStream::ReadAll() and wxOutputStream::WriteAll().
Unlike Read() and Write(), these functions always transfer exactly the specified number of bytes or fail. See #12056. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74034 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -537,6 +537,20 @@ public:
|
||||
*/
|
||||
wxOutputStream& Write(wxInputStream& stream_in);
|
||||
|
||||
/**
|
||||
Writes exactly the specified number of bytes from the buffer.
|
||||
|
||||
Returns @true if exactly @a size bytes were written. Otherwise, returns
|
||||
@false and LastWrite() should be used to retrieve the exact amount of
|
||||
the data written if necessary.
|
||||
|
||||
This method uses repeated calls to Write() (which may return writing
|
||||
only part of the data) if necessary.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool WriteAll(const void* buffer, size_t size);
|
||||
|
||||
protected:
|
||||
/**
|
||||
Internal function. It is called when the stream wants to write data of the
|
||||
@@ -629,6 +643,23 @@ public:
|
||||
*/
|
||||
wxInputStream& Read(wxOutputStream& stream_out);
|
||||
|
||||
/**
|
||||
Reads exactly the specified number of bytes into the buffer.
|
||||
|
||||
Returns @true only if the entire amount of data was read, otherwise
|
||||
@false is returned and the number of bytes really read can be retrieved
|
||||
using LastRead(), as with Read().
|
||||
|
||||
This method uses repeated calls to Read() (which may return after
|
||||
reading less than the requested number of bytes) if necessary.
|
||||
|
||||
@warning
|
||||
The buffer absolutely needs to have at least the specified size.
|
||||
|
||||
@since 2.9.5
|
||||
*/
|
||||
bool ReadAll(void* buffer, size_t size);
|
||||
|
||||
/**
|
||||
Changes the stream current position.
|
||||
|
||||
|
Reference in New Issue
Block a user