folly::io::Appender

Append to the end of a buffer chain, growing the chain (by allocating new buffers) in increments of at least growth bytes every time. Won't grow (and push() and ensure() will throw) if growth == 0.

Synopsis

Declared in <folly/io/Cursor.h>

class Appender
    : public Writable<Appender>

Description

TODO(tudorb): add a flavor of Appender that reallocates one IOBuf instead of chaining.

Base Classes

NameDescription
Writable<Appender>Mixin providing write operations for cursor types.

Member Functions

NameDescription
Appender [constructor]Construct an Appender that appends to the end of an IOBuf chain.
append Mark n bytes (must be <= length()) as appended, as per the IOBuf::append() method.
ensure Ensure at least n contiguous bytes available to write. Postcondition: length() >= n.
length Get the amount of writable tailroom of the IOBuf this cursor points to.
operator() Append a StringPiece to the buffer.
printf Append to the end of this buffer, using a printf() style format specifier.
push push overloads
pushAtMost pushAtMost overloads
vprintf Append to the end of this buffer using a printf() style format and va_list.
writableData Get the writable tail of the IOBuf this cursor points to.
write write overloads
writeBE writeBE overloads
writeLE writeLE overloads

Using Declarations

NameDescription
pushAtMost Inherit the base ByteRange and Cursor overloads of pushAtMost.