#include <bytestream.h>
Inheritance diagram for icu::CheckedArrayByteSink:
Public Member Functions | |
CheckedArrayByteSink (char *outbuf, int32_t capacity) | |
Constructs a ByteSink that will write to outbuf[0. | |
virtual | ~CheckedArrayByteSink () |
Destructor. | |
virtual CheckedArrayByteSink & | Reset () |
Returns the sink to its original state, without modifying the buffer. | |
virtual void | Append (const char *bytes, int32_t n) |
Append "bytes[0,n-1]" to this. | |
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. | |
int32_t | NumberOfBytesWritten () const |
Returns the number of bytes actually written to the sink. | |
UBool | Overflowed () const |
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes. | |
int32_t | NumberOfBytesAppended () const |
Returns the number of bytes appended to the sink. |
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 143 of file bytestream.h.
icu::CheckedArrayByteSink::CheckedArrayByteSink | ( | char * | outbuf, | |
int32_t | capacity | |||
) |
virtual icu::CheckedArrayByteSink::~CheckedArrayByteSink | ( | ) | [virtual] |
virtual void icu::CheckedArrayByteSink::Append | ( | const char * | bytes, | |
int32_t | n | |||
) | [virtual] |
Append "bytes[0,n-1]" to this.
bytes | the pointer to the bytes | |
n | the number of bytes; must be non-negative |
Implements icu::ByteSink.
virtual char* icu::CheckedArrayByteSink::GetAppendBuffer | ( | int32_t | min_capacity, | |
int32_t | desired_capacity_hint, | |||
char * | scratch, | |||
int32_t | scratch_capacity, | |||
int32_t * | result_capacity | |||
) | [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 icu::ByteSink.
int32_t icu::CheckedArrayByteSink::NumberOfBytesAppended | ( | ) | const [inline] |
Returns the number of bytes appended to the sink.
If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten() else they return the same number.
Definition at line 211 of file bytestream.h.
int32_t icu::CheckedArrayByteSink::NumberOfBytesWritten | ( | ) | const [inline] |
Returns the number of bytes actually written to the sink.
Definition at line 196 of file bytestream.h.
UBool icu::CheckedArrayByteSink::Overflowed | ( | ) | const [inline] |
Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes.
Definition at line 203 of file bytestream.h.
virtual CheckedArrayByteSink& icu::CheckedArrayByteSink::Reset | ( | ) | [virtual] |
Returns the sink to its original state, without modifying the buffer.
Useful for reusing both the buffer and the sink for multiple streams. Resets the state to NumberOfBytesWritten()=NumberOfBytesAppended()=0 and Overflowed()=FALSE.