summaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorArne Juul <arnej@verizonmedia.com>2020-11-18 10:57:33 +0000
committerArne Juul <arnej@verizonmedia.com>2020-11-18 10:57:33 +0000
commitd61feb9983b8f4c950644173eebea53fc82c46eb (patch)
treefc31ca024952cfa01085f3884c429d604d753622 /vespalib
parent4404d0bb08ba41719ebcc55813cfec10e6e48bde (diff)
add helper method to extract the underlying buffer
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/vespa/vespalib/objects/nbostream.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h
index c5b26d786b3..b0823f76d71 100644
--- a/vespalib/src/vespa/vespalib/objects/nbostream.h
+++ b/vespalib/src/vespa/vespalib/objects/nbostream.h
@@ -17,7 +17,7 @@ namespace vespalib {
*/
class nbostream
{
- public:
+public:
using Buffer = Array<char>;
using Alloc = alloc::Alloc;
enum State { ok=0, eof=0x01, oob=0x02};
@@ -170,6 +170,8 @@ public:
}
void swap(Buffer & buf);
void swap(nbostream & os);
+ /** extract the underlying Array<char>; nbostream will be empty afterwards. */
+ Buffer extract_buffer() { Buffer rv; swap(rv); return rv; }
/**
* This flag can be used to tell that a buffer will live at least as long as
* any objects it will be the backing for. In those cases there is no need for