License:
BSD style: see license.txt
Version:
Initial release: March 2004
Outback release: December 2006
author:
Kris
- interface
IConduit
: tango.io.model.IConduit.InputStream, tango.io.model.IConduit.OutputStream;
- Conduits provide virtualized access to external content, and
represent things like files or Internet connections. Conduits
expose a pair of streams, are modelled by tango.io.model.
IConduit
,
and are implemented via classes such as FileConduit & SocketConduit.
Additional kinds of conduit are easy to construct: one either
subclasses tango.io.device.Conduit, or implements tango.io.model.
IConduit
.
A conduit typically reads and writes from/to an IBuffer in large
chunks, typically the entire buffer. Alternatively, one can invoke
input.read(dst[]) and/or output.write(src[]) directly.
- abstract InputStream
input
();
- Return the
input
stream
- abstract OutputStream
output
();
- Return the
output
stream
- abstract uint
bufferSize
();
- Return a preferred size for buffering conduit I/O
- abstract char[]
toString
();
- Return the name of this conduit
- abstract bool
isAlive
();
- Is the conduit alive?
- abstract void
detach
();
- Release external resources
- abstract void
error
(char[] msg);
- Throw a generic IO exception with the provided msg
- interface
Seek
;
- Models the ability to seek within a conduit
- enum
Anchor
;
- The anchor positions supported by seek()
- abstract long
seek
(long offset, Anchor anchor = cast(Anchor)0);
- Move the file position to the given offset from the
provided anchor point, and return adjusted position.
- interface
ISelectable
;
- Describes how to make an IO entity usable with selectors
- typedef
Handle
;
- opaque OS file-handle
- abstract Handle
fileHandle
();
- Models a handle-oriented device.
TODO:
figure out how to avoid exposing this in the general
case
- interface
IOStream
;
- The common attributes of streams
-
Eof
- the End-of-Flow identifer
- abstract IConduit
conduit
();
- Return the host
conduit
- abstract void
close
();
- Close the input
- interface
InputStream
: tango.io.model.IConduit.IOStream;
- The Tango input stream
- abstract uint
read
(void[] dst);
- Read from stream into a target array. The provided dst
will be populated with content from the stream.
Returns the number of bytes
read
, which may be less than
requested in dst. Eof is returned whenever an end-of-flow
condition arises.
- abstract void[]
load
(void[] dst = null);
- Load the bits from a stream, and return them all in an
array. The dst array can be provided as an option, which
will be expanded as necessary to consume the input.
Returns an array representing the content, and throws
IOException on error
- abstract InputStream
clear
();
- Clear any buffered content
- interface
OutputStream
: tango.io.model.IConduit.IOStream;
- The Tango output stream
- abstract uint
write
(void[] src);
- Write to stream from a source array. The provided src
content will be written to the stream.
Returns the number of bytes written from src, which may
be less than the quantity provided. Eof is returned when
an end-of-flow condition arises.
- abstract OutputStream
copy
(InputStream src);
- Transfer the content of another stream to this one. Returns
a reference to this class, and throws IOException on failure.
- abstract OutputStream
flush
();
- Purge buffered content
|