SourcePro® API Reference Guide

Product Documentation:
   SourcePro
Documentation Home
List of all members | Public Member Functions
RWHttpRequestStreamBody Class Reference

Encapsulates reading an HTTP message body from an std::istream. More...

#include <rw/http/RWHttpRequestStreamBody.h>

Inheritance diagram for RWHttpRequestStreamBody:
RWHttpRequestBody

Public Member Functions

 RWHttpRequestStreamBody ()
 
 RWHttpRequestStreamBody (const RWHttpRequestStreamBody &streamBody)
 
 RWHttpRequestStreamBody (std::istream *istr, int length=-1)
 
virtual ~RWHttpRequestStreamBody ()
 
virtual RWHttpRequestBodyclone () const
 
virtual int getContentLength () const
 
virtual RWCString getNextChunk (size_t size)
 
std::istream * getStream (void) const
 
virtual bool isValid () const
 
void setStream (std::istream *istrm, int length=-1)
 
- Public Member Functions inherited from RWHttpRequestBody
 RWHttpRequestBody ()
 
virtual ~RWHttpRequestBody ()
 

Detailed Description

RWHttpRequestStreamBody defines how to read a streamed message body.

Constructor & Destructor Documentation

RWHttpRequestStreamBody::RWHttpRequestStreamBody ( )
inline

Constructs a default RWHttpRequestStreamBody object.

RWHttpRequestStreamBody::RWHttpRequestStreamBody ( const RWHttpRequestStreamBody streamBody)
inline

Copy constructor.

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 destructor.

Member Function Documentation

virtual RWHttpRequestBody* RWHttpRequestStreamBody::clone ( ) const
virtual

Creates a copy of the RWHttpRequestStreamBody on the heap and returns a pointer to the newly allocated memory.

Implements RWHttpRequestBody.

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.

Copyright © 2021 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.