factor/library/io/string-streams.facts

24 lines
1.4 KiB
Plaintext
Raw Normal View History

2006-01-18 00:34:26 -05:00
USING: help io strings ;
2006-01-17 02:43:38 -05:00
2006-08-16 21:55:53 -04:00
HELP: <string-writer>
2006-01-17 02:43:38 -05:00
{ $values { "stream" "an output stream" } }
2006-01-18 00:34:26 -05:00
{ $description "Creates an output stream that collects text into a delegate string buffer. The contents of the buffer can be recovered by executing " { $link >string } ", and indeed all other sequence operations are permitted by virtue of the delegation." } ;
2006-01-17 02:43:38 -05:00
2006-08-16 21:55:53 -04:00
HELP: string-out
2006-01-17 02:43:38 -05:00
{ $values { "quot" "a quotation" } { "str" "a string" } }
2006-01-18 00:34:26 -05:00
{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to a new string writer. The accumulated string is output when the quotation returns." } ;
2006-01-17 02:43:38 -05:00
2006-08-16 21:55:53 -04:00
HELP: <string-reader>
2006-01-17 02:43:38 -05:00
{ $values { "str" "a string" } { "stream" "an input stream" } }
2006-01-18 00:34:26 -05:00
{ $description "Creates a new stream for reading " { $snippet "str" } " from beginning to end." }
{ $notes "The implementation exploits the ability of string buffers to respond to the input stream protocol by reading characters from the end of the buffer." } ;
2006-01-17 02:43:38 -05:00
2006-08-16 21:55:53 -04:00
HELP: string-in
2006-01-17 02:43:38 -05:00
{ $values { "str" "a string" } { "quot" "a quotation" } }
2006-01-18 00:34:26 -05:00
{ $description "Calls the quotation in a new dynamic scope with " { $link stdio } " rebound to an input stream reading " { $snippet "str" } " from beginning to end. The accumulated string is output when the quotation returns." } ;
2006-01-17 02:43:38 -05:00
2006-08-16 21:55:53 -04:00
HELP: contents
2006-01-17 02:43:38 -05:00
{ $values { "stream" "an input stream" } { "str" "a string" } }
2006-01-18 00:34:26 -05:00
{ $description "Reads the contents of a stream into a string." }
2006-01-17 02:43:38 -05:00
$io-error ;