3 //=============================================================================
5 * @file HttpCharStream.h
7 * @author Krishnakumar B <kitty@cs.wustl.edu>
9 //=============================================================================
11 #ifndef _ACEXML_HTTPCHARSTREAM_H_
12 #define _ACEXML_HTTPCHARSTREAM_H_
14 #include /**/ "ace/pre.h"
15 #include "ACEXML/common/ACEXML_Export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ACEXML/common/CharStream.h"
22 #include "ACEXML/common/URL_Addr.h"
23 #include "ACEXML/common/Mem_Map_Stream.h"
26 * @class ACEXML_HttpCharStream
28 * An implementation of ACEXML_CharStream for reading input from a URL.
30 class ACEXML_Export ACEXML_HttpCharStream
: public ACEXML_CharStream
33 /// Default constructor.
34 ACEXML_HttpCharStream ();
37 virtual ~ACEXML_HttpCharStream ();
40 int open (const ACEXML_Char
*url
);
43 * Returns the available ACEXML_Char in the buffer. -1
44 * if the object is not initialized properly.
46 virtual int available ();
49 * Close this stream and release all resources used by it.
54 * Read the next ACEXML_Char. Return -1 if we are not able to
55 * return an ACEXML_Char, 0 if EOS is reached, or 1 if succeed.
57 virtual int get (ACEXML_Char
& ch
);
60 * Read the next batch of ACEXML_Char strings
62 virtual int read (ACEXML_Char
*str
, size_t len
);
65 * Peek the next ACEXML_Char in the CharStream. Return the
66 * character if succeess, -1 if EOS is reached.
71 * Resets the file pointer to the beginning of the stream.
73 virtual void rewind ();
76 * Determine the encoding of the file.
78 virtual int determine_encoding ();
81 * Get the encoding of the file
83 virtual const ACEXML_Char
* getEncoding ();
86 * Get the systemId for the underlying CharStream
88 virtual const ACEXML_Char
* getSystemId ();
92 #if defined (ACE_USES_WCHAR)
94 * Read the next character from the stream taking into account the
95 * encoding of the file.
97 int get_i (ACEXML_Char
& ch
);
100 * Read the next character from the stream taking into account the
101 * encoding of the file. Subsequent call to get() returns this
106 #endif /* ACE_USES_WCHAR */
109 * Send a HTTP/1.1 request to fetch the contents of the URL.
114 * Fetch the URL and save it in backing store.
116 int get_url (size_t& len
);
120 ACEXML_URL_Addr
* url_addr_
;
122 ACEXML_Mem_Map_Stream
* stream_
;
124 Connector
* connector_
;
128 ACE_OFF_T data_offset_
;
130 ACEXML_Char
* encoding_
;
134 #include /**/ "ace/post.h"
136 #endif /* _ACEXML_HTTPCHARSTREAM_H_ */