The class istream
supports reading content from a specified URL.
class istream : public std::basic_istream< char >
Member Functions
Name |
Description |
---|---|
Closes the stream. |
|
Gets the length of the content obtained from the URL. |
|
Gets the MIME type of the content obtained from the URL. |
|
Gets the last error associated with the stream. |
|
Gets the current value of an option that controls the behaviour of the stream. |
|
Gets the values of all options set on the stream. |
|
Gets the protocol-specific headers obtained from the URL. |
|
Determines whether the stream is open. |
|
Constructs an object of class istream. |
|
Opens the specified URL. |
|
Gets the open timeout of the stream. Sets the open timeout of the stream. |
|
Gets the underlying stream buffer. |
|
Gets the read timeout of the stream. Sets the read timeout of the stream. |
|
Sets an option to control the behaviour of the stream. |
|
Sets options to control the behaviour of the stream. |
Remarks
The class stores an object of class istreambuf
.
Currently supported URL protocols are http
,
https
and file
.
Example
To read the entire content of a resource located by a URL into a string:
urdl::istream is("http://www.boost.org/LICENSE_1_0.txt"); if (is) { std::string content; if (std::getline(is, content, std::char_traits<char>::eof())) { ... } }
Requirements
Header: <urdl/istream.hpp>
Namespace: urdl