libdap
Updated for version 3.17.0
|
output buffer for a chunked stream This performs buffered output encoding the data in the stream using the simple chunking protocol defined for DAP4's binary data transmission. Each block of data is prefixed by four bytes: A CHUNK TYPE byte followed by three bytes that are the CHUNK SIZE. There are three CHUNK TYPES: data, end and error, indicated by the code values 0x00, 0x01 and 0x02. The size of a chunk is limited to 2^24 data bytes + 4 bytes for the chunk header. More...
#include <chunked_ostream.h>
Public Member Functions | |
chunked_outbuf (std::ostream &os, unsigned int buf_size) | |
Protected Member Functions | |
int_type | data_chunk () |
Write out the contents of the buffer as a chunk. | |
int_type | end_chunk () |
Send an end chunk. | |
int_type | err_chunk (const std::string &msg) |
Send an error chunk While building up the next chunk, send an error chunk, ignoring the data currently write buffer. The buffer is left in a consistent state. | |
virtual int_type | overflow (int c) |
Virtual method called when the internal buffer would overflow. When the internal buffer fills, this method is called by the byte that would cause that overflow. The buffer pointers have been set so that there is actually space for one more character, so c can really be sent. Put c into the buffer and send it, prefixing the buffer contents with a chunk header. | |
virtual int_type | sync () |
Synchronize the stream with its data sink. | |
virtual std::streamsize | xsputn (const char *s, std::streamsize num) |
Write bytes to the chunked stream Write the bytes in s to the chunked stream. | |
Protected Attributes | |
bool | d_big_endian |
unsigned int | d_buf_size |
char * | d_buffer |
std::ostream & | d_os |
Friends | |
class | chunked_ostream |
output buffer for a chunked stream This performs buffered output encoding the data in the stream using the simple chunking protocol defined for DAP4's binary data transmission. Each block of data is prefixed by four bytes: A CHUNK TYPE byte followed by three bytes that are the CHUNK SIZE. There are three CHUNK TYPES: data, end and error, indicated by the code values 0x00, 0x01 and 0x02. The size of a chunk is limited to 2^24 data bytes + 4 bytes for the chunk header.
Definition at line 53 of file chunked_ostream.h.
std::streambuf::int_type libdap::chunked_outbuf::data_chunk | ( | ) | [protected] |
Write out the contents of the buffer as a chunk.
Definition at line 54 of file chunked_ostream.cc.
std::streambuf::int_type libdap::chunked_outbuf::end_chunk | ( | ) | [protected] |
Send an end chunk.
This is like calling flush_chunk(), but it sends a chunk header with a type of CHUNK_END (instead of CHUNK_DATA). Whatever is in the buffer is written out, but the stream is can be used to send more chunks.
Definition at line 108 of file chunked_ostream.cc.
std::streambuf::int_type libdap::chunked_outbuf::err_chunk | ( | const std::string & | m | ) | [protected] |
Send an error chunk While building up the next chunk, send an error chunk, ignoring the data currently write buffer. The buffer is left in a consistent state.
msg | The error message to include in the error chunk |
Definition at line 150 of file chunked_ostream.cc.
std::streambuf::int_type libdap::chunked_outbuf::overflow | ( | int | c | ) | [protected, virtual] |
Virtual method called when the internal buffer would overflow. When the internal buffer fills, this method is called by the byte that would cause that overflow. The buffer pointers have been set so that there is actually space for one more character, so c
can really be sent. Put c
into the buffer and send it, prefixing the buffer contents with a chunk header.
c | The last character to add to the buffer before sending the next chunk. |
c
. Definition at line 205 of file chunked_ostream.cc.
std::streambuf::int_type libdap::chunked_outbuf::sync | ( | ) | [protected, virtual] |
Synchronize the stream with its data sink.
Definition at line 328 of file chunked_ostream.cc.
std::streamsize libdap::chunked_outbuf::xsputn | ( | const char * | s, |
std::streamsize | num | ||
) | [protected, virtual] |
Write bytes to the chunked stream Write the bytes in s
to the chunked stream.
s | |
num |
Definition at line 247 of file chunked_ostream.cc.