[[TOC()]] = Streams = == Buffered == Buffers the flow of data from a upstream input. A downstream neighbour can locate and use this buffer instead of creating another instance of their own. (note that upstream is closer to the source, and downstream is further away) !BufferedInput, !BufferedOutput are streams buffer the flow of data from a upstream output. A downstream neighbour can locate and use this buffer instead of creating another instance of their own. == !DataFile == !DataFileInput, !DataFileOutput composes a seekable file with buffer. A seek causes the buffer to be cleared or flushed. == Data == !DataInput[[br]] A simple way to read binary data from an arbitrary !InputStream, such as a file: {{{ #!d auto input = new DataInput (new File("path")); auto x = input.int32; auto y = input.float64; input.array (new char[10]); input.close; }}} !DataOutput[[br]] A simple way to write binary data to an arbitrary !OutputStream, such as a file: {{{ #!d auto output = new DataOutput (new File("path", File.WriteCreate)); output.int32 (1024); output.float64 (3.14159); output.array ("hello world"); output.flush.close; }}} == Digest == !DigestInput[[br]] Inject a digest filter into an input stream, updating the digest as information flows through it !DigestOutput[[br]] Inject a digest filter into an output stream, updating the digest as information flows through it. Here's an example where we calculate an MD5 digest as a side-effect of copying a file: {{{ #!d auto output = new DigestOutput(new File("output", File.WriteCreate), new Md5); output.copy (new FileInput("input")); Stdout.formatln ("hex digest: {}", output.digest.hexDigest); }}} == Endian == Streams for swapping endian-order. The stream is treated as a set of same-sized elements. Note that partial elements are not mutated !EndianInput and !EndianOutput == Format == Simple way to hook up a text formatter to an arbitrary !OutputStream, such as a file: {{{ #!d auto output = new FormatOutput!(char) (new File("path", File.WriteCreate)); output.formatln ("{} green bottles", 10); output.flush.close; }}} == Greedy == !GreedyOutput[[br]] A conduit filter that ensures its output is written in full !GreedyInput[[br]] A conduit filter that ensures its input is read in full == Lines == !LineInput[[br]] Simple way to hook up a line-tokenizer to an arbitrary !InputStream, such as a file conduit: {{{ #!d auto input = new LineInput (new File("path")); foreach (line; input) ... input.close; }}} == Map == !MapInput!(T) Provides load facilities for a properties stream. That is, a file or other medium containing lines of text with a name=value layout !MapOutput!(T) Provides write facilities on a properties stream. That is, a file or other medium which will contain lines of text with a name=value layout == Snoop == !SnoopInput, !SnoopOutput Streams to expose call behaviour. By default, activity trace is sent to Cerr. This is useful for logging/debugging the stream calls. == !TextFile == !TextFileInput and !TextFileOutput[[br]] Composes a file with line-oriented input == Typed == !TypedInput!(T) and !TypedOutput!(T)[[br]] Streams to expose simple native types as discrete elements. I/O is buffered and should yield fair performance. == !UtfStream == !UtfInput!(T,S) and !UtfOutput!(S,T)[[br]] UTF conversion streams, supporting cross-translation of char, wchar and dchar variants. For supporting endian variations, configure the appropriate !EndianStream upstream of this one (closer to the source)