Encapsulates reading an HTTP message body from an std::istream.
More...
#include <rw/http/RWHttpRequestStreamBody.h>
RWHttpRequestStreamBody defines how to read a streamed message body.
RWHttpRequestStreamBody::RWHttpRequestStreamBody |
( |
| ) |
|
|
inline |
RWHttpRequestStreamBody::RWHttpRequestStreamBody |
( |
std::istream * |
istr, |
|
|
int |
length = -1 |
|
) |
| |
|
inline |
Constructs an RWHttpRequestStreamBody from a stream, where length is the length of the stream. If the length is not set, the stream is invalid.
virtual RWHttpRequestStreamBody::~RWHttpRequestStreamBody |
( |
| ) |
|
|
virtual |
virtual int RWHttpRequestStreamBody::getContentLength |
( |
| ) |
const |
|
virtual |
Returns the total length of the body object, if known. Returns -1
if the Content-Length
cannot be determined.
- Note
- An RWHttpRequestError exception is thrown if data without a
Content-Length
is sent to a server with version less than HTTP/1.1.
Implements RWHttpRequestBody.
virtual RWCString RWHttpRequestStreamBody::getNextChunk |
( |
size_t |
size | ) |
|
|
virtual |
Reads and returns the next size bytes from the body as an RWCString. If size bytes are not available, the remainder of the string is returned. Returns an empty string when no more data can be read.
Implements RWHttpRequestBody.
std::istream * RWHttpRequestStreamBody::getStream |
( |
void |
| ) |
const |
|
inline |
Returns the underlying stream.
virtual bool RWHttpRequestStreamBody::isValid |
( |
| ) |
const |
|
virtual |
Returns true
if the pointer to the stream is not null and the associated stream object's std::istream::good()
returns true.
Implements RWHttpRequestBody.
void RWHttpRequestStreamBody::setStream |
( |
std::istream * |
istrm, |
|
|
int |
length = -1 |
|
) |
| |
|
inline |
Assigns the underlying stream to istrm.