new PIChunkStream::extract() method
This commit is contained in:
@@ -115,7 +115,16 @@ void PIChunkStream::readAll() {
|
||||
|
||||
|
||||
PIChunkStream::~PIChunkStream() {
|
||||
}
|
||||
|
||||
|
||||
bool PIChunkStream::extract(PIByteArray & data) {
|
||||
if (data.size_s() < 4) return false;
|
||||
data >> tmp_data;
|
||||
if (tmp_data.size_s() < 4) return false;
|
||||
data_ = &tmp_data;
|
||||
_init();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public:
|
||||
//! Add data to this chunk strean with ID "id" and value "data"
|
||||
template <typename T> PIChunkStream & add(int id, const T & data) {*this << ChunkConst<T>(id, data); return *this;}
|
||||
|
||||
//! Extract %PIByteArray from "data" and set it current stream. Returns if has data to read.
|
||||
bool extract(PIByteArray & data);
|
||||
|
||||
void setSource(const PIByteArray & data);
|
||||
void setSource(PIByteArray * data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user