5 #include <libutl/Stream.h> 6 #include <libutl/Vector.h> 52 init(
nullptr, size,
true, increment);
64 init(array, size, owner, increment);
73 virtual size_t read(
byte_t* array,
size_t maxBytes,
size_t minBytes =
size_t_max);
75 virtual void write(
const byte_t* array,
size_t num);
95 char* copyString()
const;
113 if (_writePos > _array.size())
115 _array.grow(_writePos);
141 _array.reserve(size, increment);
148 void truncate(
size_t size);
157 void set(
byte_t* array,
size_t size,
bool owner =
true,
size_t increment =
size_t_max);
163 _array.setOwner(owner);
170 _array.setIncrement(increment);
MemStream(size_t size, size_t increment=size_t_max)
Constructor.
virtual void close()
Close the stream.
void deInit()
De-initialize UTL++.
#define UTL_CLASS_DECL(DC, BC)
Declaration of standard UTL++ functionality for a non-template class.
unsigned char byte_t
Unsigned character.
void seekg(size_t pos)
Seek the "get pointer" to the given position.
void seekp(size_t pos)
Seek the "put pointer" to the given position.
void setOwner(bool owner)
Set ownership flag.
const size_t size_t_max
Maximum size_t value.
size_t tellg() const
Get the position of the "get pointer".
MemStream(byte_t *array, size_t size, bool owner=true, size_t increment=size_t_max)
Constructor.
void reserve(size_t size, size_t increment=size_t_max)
Reserve allocation space.
constexpr size_t KB(size_t n)
Convert size in kilobytes to size in bytes.
void setIncrement(size_t increment)
Set the growth increment.
size_t tellp() const
Get the position of the "put pointer".
size_t arraySize() const
Get size of allocated array.
void init()
Initialize UTL++.
#define ASSERTD
Do an assertion in DEBUG mode only.