Rogue Wave Views Foundation Package API Reference Guide |
Rogue Wave Views Documentation Home |
Input stream class. More...
#include <ilog/iurlstr.h>
Inherits std::istream.
Public Types | |
enum | StreamHint { Normal, NoRandomAccess } |
This enumeration defines the possible values for the hint. More... | |
Public Member Functions | |
IlIUrlStream (const char *url, IlBoolean binaryMode=IlFalse) | |
Constructor. More... | |
IlUInt | getBufferLimit () const |
Returns the size limit of the internal buffer. More... | |
const char * | getHeader () const |
Retrieves the header of the remote host response. More... | |
StreamHint | getHints () const |
Returns the hints of the stream. More... | |
void | setBufferLimit (IlUInt sizelimit) |
Sets the size limit of the internal buffer. More... | |
void | setHints (StreamHint hints) |
Sets the hints for this instance. More... | |
Input stream class.
Library: ilog
IlIUrlStream
is a subclass of the standard C++ class istream
that makes it possible for you to access remote files, through usual Internet protocols, and decompress (on the fly) streams that are compressed with the gzip or zip compress utilities.
Instead of creating your stream using a path name, you can provide (in the constructor) a complete and valid URL (Uniform Resource Locator), which is a string that has the following form:
[protocol:][//[user:passwd@]host[:port]]pathname
This indicates that you want to access a path called pathname
on the remote host host
using the transfer protocol protocol
, and the port number port
. Some protocols and servers require that you provide a login name and a password; you can specify those in the fields user
and password
.
Supported protocols are ftp, http, and file. Note that you need to provide a login name and a password when using the ftp protocol.
The API for this class is exactly the same as the istream's
, so you can simply replace istream
by IlIUrlStream
in your code to be able to access remote files.
Constructor.
The constructor initializes this stream by opening the indicated URL for reading. Just as in the regular ifstream
class, you must check that the access has succeeded.
url | The URL to be opened. If no protocol is specified (that is, this string does not start with a xxx: pattern), then a regular file is opened. This makes the replacement of all ifstreams by IlIUrlStreams seamless. |
binaryMode | If set to IlTrue , indicates that the file should be opened in binary mode. The default opens the file in text mode for reading (ios::in ), but if you are running a Windows machine, you may consider setting the 'binary' flag to IlTrue to read binary data. |
IlUInt IlIUrlStream::getBufferLimit | ( | ) | const |
Returns the size limit of the internal buffer.
const char* IlIUrlStream::getHeader | ( | ) | const |
Retrieves the header of the remote host response.
In the case of a file read through http, the header usually contains information on the file size and dates.
StreamHint IlIUrlStream::getHints | ( | ) | const |
Returns the hints of the stream.
void IlIUrlStream::setBufferLimit | ( | IlUInt | sizelimit | ) |
Sets the size limit of the internal buffer.
sizelimit | The new size limit. |
void IlIUrlStream::setHints | ( | StreamHint | hints | ) |
Sets the hints for this instance.
hints | The new stream hints. |
© Copyright 2018, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.