<!-- This comment will put IE 6, 7 and 8 in quirks mode --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>ICU 4.4.1: CheckedArrayByteSink Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="search/search.css" rel="stylesheet" type="text/css"/> <script type="text/javaScript" src="search/search.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body onload='searchBox.OnSelectItem(0);'> <!-- Generated by Doxygen 1.6.2-20100208 --> <script type="text/javascript"><!-- var searchBox = new SearchBox("searchBox", "search",false,'Search'); --></script> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="modules.html"><span>Modules</span></a></li> <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="files.html"><span>Files</span></a></li> <li> <div id="MSearchBox" class="MSearchBoxInactive"> <img id="MSearchSelect" src="search/search.png" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" alt=""/> <input type="text" id="MSearchField" value="Search" accesskey="S" onfocus="searchBox.OnSearchFieldFocus(true)" onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a> </div> </li> </ul> </div> <div class="tabs"> <ul> <li><a href="annotated.html"><span>Data Structures</span></a></li> <li><a href="classes.html"><span>Data Structure Index</span></a></li> <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Data Fields</span></a></li> </ul> </div> </div> <div class="contents"> <h1>CheckedArrayByteSink Class Reference</h1><!-- doxytag: class="CheckedArrayByteSink" --><!-- doxytag: inherits="ByteSink" --> <p>Implementation of <a class="el" href="classByteSink.html" title="A ByteSink can be filled with bytes.">ByteSink</a> that writes to a flat byte array, with bounds-checking: This sink will not write more than capacity bytes to outbuf. <a href="#_details">More...</a></p> <p><code>#include <<a class="el" href="bytestream_8h_source.html">bytestream.h</a>></code></p> <div class="dynheader"> Inheritance diagram for CheckedArrayByteSink:</div> <div class="dynsection"> <div class="center"> <img src="classCheckedArrayByteSink.png" usemap="#CheckedArrayByteSink_map" alt=""/> <map id="CheckedArrayByteSink_map" name="CheckedArrayByteSink_map"> <area href="classByteSink.html" alt="ByteSink" shape="rect" coords="0,56,144,80"/> <area href="classUMemory.html" alt="UMemory" shape="rect" coords="0,0,144,24"/> </map> </div> </div> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCheckedArrayByteSink.html#a8911bf2ecf8d6e4845b65e31936dfdb5">CheckedArrayByteSink</a> (char *outbuf, int32_t capacity)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Constructs a <a class="el" href="classByteSink.html" title="A ByteSink can be filled with bytes.">ByteSink</a> that will write to outbuf[0..capacity-1]. <a href="#a8911bf2ecf8d6e4845b65e31936dfdb5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCheckedArrayByteSink.html#ace4a9f8d0ac6f44f6cfbab126cec36fc">Append</a> (const char *bytes, int32_t n)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Append "bytes[0,n-1]" to this. <a href="#ace4a9f8d0ac6f44f6cfbab126cec36fc"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">virtual char * </td><td class="memItemRight" valign="bottom"><a class="el" href="classCheckedArrayByteSink.html#ac9b54c8bd9002d867648feb39b82a61c">GetAppendBuffer</a> (int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. <a href="#ac9b54c8bd9002d867648feb39b82a61c"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">int32_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCheckedArrayByteSink.html#a83068a3fcf59cc7af120de540b423371">NumberOfBytesWritten</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of bytes actually written to the sink. <a href="#a83068a3fcf59cc7af120de540b423371"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classCheckedArrayByteSink.html#adb0ed4a2592e3c8e09fff38d2fe94981">Overflowed</a> () const </td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes. <a href="#adb0ed4a2592e3c8e09fff38d2fe94981"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Implementation of <a class="el" href="classByteSink.html" title="A ByteSink can be filled with bytes.">ByteSink</a> that writes to a flat byte array, with bounds-checking: This sink will not write more than capacity bytes to outbuf. </p> <p>If more than capacity bytes are <a class="el" href="classCheckedArrayByteSink.html#ace4a9f8d0ac6f44f6cfbab126cec36fc" title="Append "bytes[0,n-1]" to this.">Append()</a>ed, then excess bytes are ignored, and <a class="el" href="classCheckedArrayByteSink.html#adb0ed4a2592e3c8e09fff38d2fe94981" title="Returns true if any bytes were discarded, i.e., if there was an attempt to write...">Overflowed()</a> will return true. Overflow does not cause a runtime error. </p> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000036">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="bytestream_8h_source.html#l00142">142</a> of file <a class="el" href="bytestream_8h_source.html">bytestream.h</a>.</p> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a8911bf2ecf8d6e4845b65e31936dfdb5"></a><!-- doxytag: member="CheckedArrayByteSink::CheckedArrayByteSink" ref="a8911bf2ecf8d6e4845b65e31936dfdb5" args="(char *outbuf, int32_t capacity)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">CheckedArrayByteSink::CheckedArrayByteSink </td> <td>(</td> <td class="paramtype">char * </td> <td class="paramname"> <em>outbuf</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>capacity</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Constructs a <a class="el" href="classByteSink.html" title="A ByteSink can be filled with bytes.">ByteSink</a> that will write to outbuf[0..capacity-1]. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>outbuf</em> </td><td>buffer to write to </td></tr> <tr><td valign="top"></td><td valign="top"><em>capacity</em> </td><td>size of the buffer </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000043">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="ace4a9f8d0ac6f44f6cfbab126cec36fc"></a><!-- doxytag: member="CheckedArrayByteSink::Append" ref="ace4a9f8d0ac6f44f6cfbab126cec36fc" args="(const char *bytes, int32_t n)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual void CheckedArrayByteSink::Append </td> <td>(</td> <td class="paramtype">const char * </td> <td class="paramname"> <em>bytes</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>n</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Append "bytes[0,n-1]" to this. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>bytes</em> </td><td>the pointer to the bytes </td></tr> <tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>the number of bytes; must be non-negative </td></tr> </table> </dd> </dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000044">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Implements <a class="el" href="classByteSink.html#a1f04f7474f4822c29b3a20fde509a3d8">ByteSink</a>.</p> </div> </div> <a class="anchor" id="ac9b54c8bd9002d867648feb39b82a61c"></a><!-- doxytag: member="CheckedArrayByteSink::GetAppendBuffer" ref="ac9b54c8bd9002d867648feb39b82a61c" args="(int32_t min_capacity, int32_t desired_capacity_hint, char *scratch, int32_t scratch_capacity, int32_t *result_capacity)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">virtual char* CheckedArrayByteSink::GetAppendBuffer </td> <td>(</td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>min_capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>desired_capacity_hint</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">char * </td> <td class="paramname"> <em>scratch</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t </td> <td class="paramname"> <em>scratch_capacity</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int32_t * </td> <td class="paramname"> <em>result_capacity</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [virtual]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns a writable buffer for appending and writes the buffer's capacity to *result_capacity. </p> <p>For details see the base class documentation. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>min_capacity</em> </td><td>required minimum capacity of the returned buffer; must be non-negative </td></tr> <tr><td valign="top"></td><td valign="top"><em>desired_capacity_hint</em> </td><td>desired capacity of the returned buffer; must be non-negative </td></tr> <tr><td valign="top"></td><td valign="top"><em>scratch</em> </td><td>default caller-owned buffer </td></tr> <tr><td valign="top"></td><td valign="top"><em>scratch_capacity</em> </td><td>capacity of the scratch buffer </td></tr> <tr><td valign="top"></td><td valign="top"><em>result_capacity</em> </td><td>pointer to an integer which will be set to the capacity of the returned buffer </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>a buffer with *result_capacity>=min_capacity </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000045">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Reimplemented from <a class="el" href="classByteSink.html#afbff3e7aca11c652464153b955071201">ByteSink</a>.</p> </div> </div> <a class="anchor" id="a83068a3fcf59cc7af120de540b423371"></a><!-- doxytag: member="CheckedArrayByteSink::NumberOfBytesWritten" ref="a83068a3fcf59cc7af120de540b423371" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int32_t CheckedArrayByteSink::NumberOfBytesWritten </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns the number of bytes actually written to the sink. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>number of bytes written to the buffer </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000046">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="bytestream_8h_source.html#l00181">181</a> of file <a class="el" href="bytestream_8h_source.html">bytestream.h</a>.</p> </div> </div> <a class="anchor" id="adb0ed4a2592e3c8e09fff38d2fe94981"></a><!-- doxytag: member="CheckedArrayByteSink::Overflowed" ref="adb0ed4a2592e3c8e09fff38d2fe94981" args="() const " --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="umachine_8h.html#a349ef00011f20ccd1d3b424445681aa5">UBool</a> CheckedArrayByteSink::Overflowed </td> <td>(</td> <td class="paramname"></td> <td> ) </td> <td> const<code> [inline]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Returns true if any bytes were discarded, i.e., if there was an attempt to write more than 'capacity' bytes. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>TRUE if more than 'capacity' bytes were <a class="el" href="classCheckedArrayByteSink.html#ace4a9f8d0ac6f44f6cfbab126cec36fc" title="Append "bytes[0,n-1]" to this.">Append()</a>ed </dd></dl> <dl class="stable"><dt><b><a class="el" href="stable.html#_stable000047">Stable:</a></b></dt><dd>ICU 4.2 </dd></dl> <p>Definition at line <a class="el" href="bytestream_8h_source.html#l00188">188</a> of file <a class="el" href="bytestream_8h_source.html">bytestream.h</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li><a class="el" href="bytestream_8h_source.html">bytestream.h</a></li> </ul> </div> <!--- window showing the filter options --> <div id="MSearchSelectWindow" onmouseover="return searchBox.OnSearchSelectShow()" onmouseout="return searchBox.OnSearchSelectHide()" onkeydown="return searchBox.OnSearchSelectKey(event)"> <a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark"> </span>Friends</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark"> </span>Defines</a></div> <!-- iframe showing the search results (closed by default) --> <div id="MSearchResultsWindow"> <iframe src="" frameborder="0" name="MSearchResults" id="MSearchResults"> </iframe> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.2-20100208 </small></address> </body> </html>