ICU 4.2.1
|
Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not write more than capacity bytes to outbuf. More...
#include <bytestream.h>
Public Member Functions | |
CheckedArrayByteSink (char *outbuf, int32_t capacity) | |
Constructs a ByteSink that will write to outbuf[0..capacity-1]. More... | |
virtual void | Append (const char *bytes, int32_t n) |
Append "bytes[0,n-1]" to this. More... | |
virtual char * | GetAppendBuffer (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity) |
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. More... | |
int32_t | NumberOfBytesWritten () const |
Returns the number of bytes actually written to the sink. More... | |
UBool | Overflowed () const |
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes. More... | |
![]() | |
ByteSink () | |
Default constructor. More... | |
virtual | ~ByteSink () |
Virtual destructor. More... | |
virtual void | Flush () |
Flush internal buffers. More... | |
Additional Inherited Members | |
![]() | |
static void * | operator new (size_t size) |
Override for ICU4C C++ memory management. More... | |
static void * | operator new[] (size_t size) |
Override for ICU4C C++ memory management. More... | |
static void | operator delete (void *p) |
Override for ICU4C C++ memory management. More... | |
static void | operator delete[] (void *p) |
Override for ICU4C C++ memory management. More... | |
static void * | operator new (size_t, void *ptr) |
Override for ICU4C C++ memory management for STL. More... | |
static void | operator delete (void *, void *) |
Override for ICU4C C++ memory management for STL. More... | |
Implementation of ByteSink that writes to a flat byte array, with bounds-checking: This sink will not write more than capacity bytes to outbuf.
If more than capacity bytes are Append()ed, then excess bytes are ignored, and Overflowed() will return true. Overflow does not cause a runtime error.
Definition at line 142 of file bytestream.h.
CheckedArrayByteSink::CheckedArrayByteSink | ( | char * | outbuf, |
int32_t | capacity | ||
) |
|
virtual |
|
virtual |
Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity.
For details see the base class documentation.
min_capacity | required minimum capacity of the returned buffer; must be non-negative |
desired_capacity_hint | desired capacity of the returned buffer; must be non-negative |
scratch | default caller-owned buffer |
scratch_capacity | capacity of the scratch buffer |
result_capacity | pointer to an integer which will be set to the capacity of the returned buffer |
Reimplemented from ByteSink.
|
inline |
Returns the number of bytes actually written to the sink.
Definition at line 181 of file bytestream.h.
|
inline |
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes.
Definition at line 188 of file bytestream.h.