mirror of
https://github.com/oatpp/oatpp.git
synced 2024-11-27 08:30:07 +08:00
BufferOutputStream: Add reset() method.
This commit is contained in:
parent
c0581f54da
commit
3b66aa7670
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1 @@
|
||||
github: oatpp
|
@ -118,6 +118,13 @@ void BufferOutputStream::setCurrentPosition(v_buff_size position) {
|
||||
m_position = position;
|
||||
}
|
||||
|
||||
void BufferOutputStream::reset(v_buff_size initialCapacity) {
|
||||
delete [] m_data;
|
||||
m_data = new v_char8[initialCapacity];
|
||||
m_capacity = initialCapacity;
|
||||
m_position = 0;
|
||||
}
|
||||
|
||||
oatpp::String BufferOutputStream::toString() {
|
||||
return oatpp::String((const char*) m_data, m_position);
|
||||
}
|
||||
|
@ -115,6 +115,12 @@ public:
|
||||
*/
|
||||
void setCurrentPosition(v_buff_size position);
|
||||
|
||||
/**
|
||||
* Reset stream buffer and its capacity. Also reset write position.
|
||||
* @param initialCapacity
|
||||
*/
|
||||
void reset(v_buff_size initialCapacity = 2048);
|
||||
|
||||
/**
|
||||
* Copy data to &id:oatpp::String;.
|
||||
* @return
|
||||
|
Loading…
Reference in New Issue
Block a user