class CheckedArrayByteSink
Defined at line 180 of file ../../third_party/icu/default/source/common/unicode/bytestream.h
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.
ICU 4.2
Public Methods
void CheckedArrayByteSink (char * outbuf, int32_t capacity)
Constructs a ByteSink that will write to outbuf[0..capacity-1].
Parameters
void ~CheckedArrayByteSink ()
Destructor.
ICU 4.2
CheckedArrayByteSink & Reset ()
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.
Returns
*this
ICU 4.6
void Append (const char * bytes, int32_t n)
Append "bytes[0,n-1]" to this.
Parameters
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. For details see the base class documentation.
Parameters
Returns
a buffer with *result_capacity>=min_capacity
ICU 4.2
int32_t NumberOfBytesWritten ()
Returns the number of bytes actually written to the sink.
Returns
number of bytes written to the buffer
ICU 4.2
Defined at line 233 of file ../../third_party/icu/default/source/common/unicode/bytestream.h
UBool Overflowed ()
Returns true if any bytes were discarded, i.e., if there was an
attempt to write more than 'capacity' bytes.
Returns
true if more than 'capacity' bytes were Append()ed
ICU 4.2
Defined at line 240 of file ../../third_party/icu/default/source/common/unicode/bytestream.h
int32_t NumberOfBytesAppended ()
Returns the number of bytes appended to the sink.
If Overflowed() then NumberOfBytesAppended()>NumberOfBytesWritten()
else they return the same number.
Returns
number of bytes written to the buffer
ICU 4.6
Defined at line 248 of file ../../third_party/icu/default/source/common/unicode/bytestream.h