libdap
Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
|
Public Member Functions | |
int | bytes_in_buffer () const |
chunked_inbuf (std::istream &is, int size) | |
Build a chunked input buffer. More... | |
bool | error () const |
std::string | error_message () const |
int_type | read_next_chunk () |
Read a chunk Normally the chunked nature of a chunked_istream/chunked_inbuf is hidden from the caller. This method provides a way to get one chunk from the stream by forcing its read and returning the size. A subsequent call to read() for that number of bytes will return all of the data in the chunk. If there is any data in the chunk_inbuf object's buffer, it is lost. More... | |
bool | twiddle_bytes () const |
Protected Member Functions | |
virtual int_type | underflow () |
Insert new characters into the buffer This specialization of underflow is called when the gptr() is advanced to the end of the input buffer. At that point it calls the underlying I/O stream to read the next chunk of data and transfers the data read to the internal buffer. If an error is found, EOF is returned. If an END chunk with zero bytes is found, an EOF is returned. More... | |
virtual std::streamsize | xsgetn (char *s, std::streamsize num) |
Read a block of data This specialization of xsgetn() reads num bytes and puts them in s first reading from the internal beffer and then from the stream. Any characters read from the last chunk that won't fit in to s are put in the buffer, otherwise all data are read directly into s , bypassing the internal buffer (and the extra copy operation that would imply). If the END chunk is found EOF is not returned and the final read of the underlying stream is not made; the next call to read(), get(), ..., will return EOF. More... | |
Definition at line 42 of file chunked_istream.h.
|
inline |
Build a chunked input buffer.
This reads from a chunked stream, extracting an entire chunk and storing it in a buffer in one operation. If the chunked_inbuf reads a chunk header that indicates the next chunk is going be bigger than its current buffer size, the object will make the buffer larger. This object support 128 characters of 'put back' space. Since DAP4 uses receiver makes right, the buffer must be told if it should 'twiddle' the header size information. In DAP4 the byte order is sent using a one-byte code before the chunked transmission starts.
is | Use this as a data source |
size | The size of the input buffer. This should match the likely chunk size. If it is smaller than a chunk, it will be resized. |
twiddle_bytes | Should the header bytes be twiddled? True if this host and the send use a different byte-order. The sender's byte order must be sent out-of-band. |
Definition at line 98 of file chunked_istream.h.
std::streambuf::int_type libdap::chunked_inbuf::read_next_chunk | ( | ) |
Read a chunk Normally the chunked nature of a chunked_istream/chunked_inbuf is hidden from the caller. This method provides a way to get one chunk from the stream by forcing its read and returning the size. A subsequent call to read() for that number of bytes will return all of the data in the chunk. If there is any data in the chunk_inbuf object's buffer, it is lost.
Definition at line 333 of file chunked_istream.cc.
|
protectedvirtual |
Insert new characters into the buffer This specialization of underflow is called when the gptr() is advanced to the end of the input buffer. At that point it calls the underlying I/O stream to read the next chunk of data and transfers the data read to the internal buffer. If an error is found, EOF is returned. If an END chunk with zero bytes is found, an EOF is returned.
Definition at line 84 of file chunked_istream.cc.
|
protectedvirtual |
Read a block of data This specialization of xsgetn() reads num
bytes and puts them in s
first reading from the internal beffer and then from the stream. Any characters read from the last chunk that won't fit in to s
are put in the buffer, otherwise all data are read directly into s
, bypassing the internal buffer (and the extra copy operation that would imply). If the END chunk is found EOF is not returned and the final read of the underlying stream is not made; the next call to read(), get(), ..., will return EOF.
s | Address of a buffer to hold the data |
num | Number of bytes to read |
s
. Note that this number does not include the bytes read from the last chunk that won't fit into s
so this will never return a number greater than num. Definition at line 179 of file chunked_istream.cc.