<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Class StringStream - Class StringStream</title> <link href="faldoc.css" rel="stylesheet" type="text/css"/> <link href="tabs.css" rel="stylesheet" type="text/css"/> </head> <body class="faldoc_body"> <div class="navitop"> <div class="tabs"> <ul> <li><a href="./index.html"><span>Main</span></a></li> <li><a href="./pages.html"><span>Related pages</span></a></li> <li><a href="./groups.html"><span>Groups</span></a></li> <li><a href="./funset.html"><span>Function sets</span></a></li> <li><a href="./classes.html"><span>Classes</span></a></li> <li><a href="./objects.html"><span>Objects</span></a></li> <li><a href="./functions.html"><span>All functions</span></a></li> <li><a href="./globals.html"><span>Globals</span></a></li> </ul> </div> </div> <hr/> <h1 class="faldoc_title">Class StringStream</h1> <p class="faldoc_brief">Memory based stream. </p> <p class="faldoc_funcdecl"> <b>class</b> StringStream( [buffer] ) \ <b>from</b> <a href="./class_Stream.html">Stream</a> </p> <p class="faldoc_brief"><a href="#more">more...</a></p> <h2 class="faldoc_title">Summary</h2> <table class="faldoc_list"> <tr><td><a href="#closeToString">closeToString()</a></td><td>Close the stream and returns its contents. </td></tr> <tr><td><a href="#getString">getString()</a></td><td>Returns the data currently stored in the stream. </td></tr> </table> <h3 class="faldoc_title">Inherited properties</h3> <table class="faldoc_list"> <tr><td><a href="./class_Stream.html#encoding">encoding</a> from Stream </td><td>Name of the set encoding, if given, for text operations</td></tr> <tr><td><a href="./class_Stream.html#eolMode">eolMode</a> from Stream </td><td>Mode of EOL conversion in text operations.</td></tr> </table> <h3 class="faldoc_title">Inherited methods</h3> <table class="faldoc_list"> <tr><td><a href="./class_Stream.html#clone">clone</a> from Stream </td><td>Clone the stream handle. </td></tr> <tr><td><a href="./class_Stream.html#close">close</a> from Stream </td><td>Closes the stream. </td></tr> <tr><td><a href="./class_Stream.html#eof">eof</a> from Stream </td><td>Checks if the last read operation hit the end of the file. </td></tr> <tr><td><a href="./class_Stream.html#errorDescription">errorDescription</a> from Stream </td><td>Returns a system specific textual description of the last error. </td></tr> <tr><td><a href="./class_Stream.html#flush">flush</a> from Stream </td><td>Flushes a stream. </td></tr> <tr><td><a href="./class_Stream.html#getBuffering">getBuffering</a> from Stream </td><td>Returns the size of I/O buffering active on this stream. </td></tr> <tr><td><a href="./class_Stream.html#grab">grab</a> from Stream </td><td>Grabs binary data from the stream. </td></tr> <tr><td><a href="./class_Stream.html#grabLine">grabLine</a> from Stream </td><td>Grabs a line of text encoded data. </td></tr> <tr><td><a href="./class_Stream.html#grabText">grabText</a> from Stream </td><td>Grabs text encoded data from the stream. </td></tr> <tr><td><a href="./class_Stream.html#isOpen">isOpen</a> from Stream </td><td>Checks if the stream is currently open. </td></tr> <tr><td><a href="./class_Stream.html#lastError">lastError</a> from Stream </td><td>Return the last system error. </td></tr> <tr><td><a href="./class_Stream.html#lastMoved">lastMoved</a> from Stream </td><td>Return the amount of data moved by the last operation. </td></tr> <tr><td><a href="./class_Stream.html#read">read</a> from Stream </td><td>Reads binary data from the stream. </td></tr> <tr><td><a href="./class_Stream.html#readAvailable">readAvailable</a> from Stream </td><td>Checks if data can be read, or wait for available data. </td></tr> <tr><td><a href="./class_Stream.html#readLine">readLine</a> from Stream </td><td>Reads a line of text encoded data. </td></tr> <tr><td><a href="./class_Stream.html#readText">readText</a> from Stream </td><td>Reads text encoded data from the stream. </td></tr> <tr><td><a href="./class_Stream.html#seek">seek</a> from Stream </td><td>Moves the file pointer on seekable streams. </td></tr> <tr><td><a href="./class_Stream.html#seekCur">seekCur</a> from Stream </td><td>Moves the file pointer on seekable streams relative to current position. </td></tr> <tr><td><a href="./class_Stream.html#seekEnd">seekEnd</a> from Stream </td><td>Moves the file pointer on seekable streams relative to end of file. </td></tr> <tr><td><a href="./class_Stream.html#setBuffering">setBuffering</a> from Stream </td><td>Set the buffering state of this stream. </td></tr> <tr><td><a href="./class_Stream.html#setEncoding">setEncoding</a> from Stream </td><td>Set the text encoding and EOL mode for text-based operations. </td></tr> <tr><td><a href="./class_Stream.html#tell">tell</a> from Stream </td><td>Return the current position in a stream. </td></tr> <tr><td><a href="./class_Stream.html#truncate">truncate</a> from Stream </td><td>Resizes a file. </td></tr> <tr><td><a href="./class_Stream.html#write">write</a> from Stream </td><td>Write binary data to a stream. </td></tr> <tr><td><a href="./class_Stream.html#writeAvailable">writeAvailable</a> from Stream </td><td>Checks if data can be written, or wait until it's possible to write. </td></tr> <tr><td><a href="./class_Stream.html#writeText">writeText</a> from Stream </td><td>Write text data to a stream. </td></tr> </table> <a name="more"><h2 class="faldoc_title">Detailed description</h2></a> <p class="faldoc_funcdecl"> <b>class</b> StringStream( [buffer] ) \ <b>from</b> <a href="./class_Stream.html">Stream</a> </p> <table class="faldoc_function"> <tr><td class="faldoc_optparam">buffer</td><td class="faldoc_optparamdesc">The buffer that will be used as stream </td></tr> </table> <br/> <p class="item_brief">Memory based stream. </p> <p class="faldoc_text">The StringStream class inherits from stream. It can be used to provide functions that are supposed to write to streams with a memory buffer; for example, variables may be serialized on a string stream which can be then written completely on a physical stream, or sent over the network, or written in a database blob field. The reverse is of course possible: a string can be read from any source and then used to construct a StringStream, that can be then fed to function expecting streams as parameters. </p> <p class="faldoc_text">Of course, all the methods listed in the Stream class are available also here. </p> <p class="faldoc_text">The StringStream is always available for read and write operations, and supports seek operations. Writing past the end of the stream will cause the StringStream to grow. </p> <p class="faldoc_text"> If the parameter <b>buffer</b> is a numeric value, the constructor preallocates the given size. Writes up to buffer size won't require re-allocation, and the size will be used as a hint to grow the stream buffer sensibly. </p> <p class="faldoc_text">If a string is provided, it is used as initial contents of the StringStream; subsequent reads will return the data contained in the string. </p> <h2 class="faldoc_title">Methods</h2> <h3 class="faldoc_funcname"><a name="closeToString">closeToString()</a></h3> <p class="item_brief">Close the stream and returns its contents. </p> <p class="faldoc_funcdecl">StringStream.closeToString( )</p> <table class="faldoc_function"> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">The stream contents. </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text">Closes the stream and returns the contents of the stream as a string. The object is internally destroyed, and the whole content is transformed into the returned string. In this way, an extra allocation and copy can be spared. </p> </p> <h3 class="faldoc_funcname"><a name="getString">getString()</a></h3> <p class="item_brief">Returns the data currently stored in the stream. </p> <p class="faldoc_funcdecl">StringStream.getString( )</p> <table class="faldoc_function"> <tr><td class="faldoc_funcreturn">Returns:</td><td class="faldoc_funcreturndesc">A copy of the contents of this stream. </td></tr> </table> <p class="faldoc_text"><p class="faldoc_text">The data currently held in the stream is left untouched, and a new copy of the data is returned. </p> </p> <hr/> <div class="navibottom"> <center> <a href="./index.html">Main</a> - <a href="./pages.html">Related pages</a> - <a href="./groups.html">Groups</a> - <a href="./funset.html">Function sets</a> - <a href="./classes.html">Classes</a> - <a href="./objects.html">Objects</a> - <a href="./functions.html">All functions</a> - <a href="./globals.html">Globals</a> </center> </div> </div> <div class="faldoc_signature">Made with <a href="http://www.falconpl.org">faldoc 2.2.0</div> </body> </html>