IConduit

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 File & 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.

Members

Functions

detach
void detach()

Release external resources.

error
void error(const(char[]) msg)

Throw a generic IO exception with the provided msg.

toString
immutable(char)[] toString()

Return the name of this conduit.

Interfaces

Seek
interface Seek

All streams now support seek(), so this is used to signal a seekable conduit instead.

Truncate
interface Truncate

Indicates the conduit supports resize/truncation.

Properties

bufferSize
size_t bufferSize [@property getter]

Return a preferred size for buffering conduit I/O.

isAlive
bool isAlive [@property getter]

Is the conduit alive?

Inherited Members

From InputStream

read
size_t read(void[] dst)

Read from stream into a target array. The provided dst will be populated with content from the stream.

load
void[] load(size_t max)

Load the bits from a stream, and return them all in an array. The optional max value indicates the maximum number of bytes to be read.

input
InputStream input [@property getter]

Return the upstream source.

From OutputStream

write
size_t write(const(void)[] src)

Write to stream from a source array. The provided src content will be written to the stream.

copy
OutputStream copy(InputStream src, size_t max)

Transfer the content of another stream to this one. Returns a reference to this class, and throws IOException on failure.

output
OutputStream output [@property getter]

Return the upstream sink.

Meta