License:
BSD style: see license.txt

Version:
Mar 2004: Initial release

author:
Kris

  • class Conduit : tango.io.model.IConduit.IConduit;
  • Conduit abstract base-class, implementing interface IConduit. Only the conduit-specific read(), write(), and bufferSize() need to be implemented for a concrete conduit implementation. See FileConduit for an example.

    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 char[] toString ();
  • Return the name of this conduit

  • abstract uint bufferSize ();
  • Return a preferred size for buffering conduit I/O

  • abstract uint read (void[] dst);
  • Read from conduit into a target array. The provided dst will be populated with content from the conduit.

    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 uint write (void[] src);
  • Write to conduit from a source array. The provided src content will be written to the conduit.

    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 void detach ();
  • Disconnect this conduit

  • bool isAlive ();
  • Is the conduit alive? Default behaviour returns true

  • final IConduit conduit ();
  • Return the host. This is part of the Stream interface

  • InputStream clear ();
  • clear any buffered input

  • OutputStream flush ();
  • Write buffered output

  • final void close ();
  • Close this conduit

    Remarks:
    Both input and output are detached, and are no longer usable



  • final InputStream input ();
  • Return the current input stream

  • final OutputStream output ();
  • Return the current output stream

  • final void error (char[] msg);
  • Throw an IOException, with the provided message

  • final OutputStream copy (InputStream src);
  • Transfer the content of another conduit to this one. Returns the dst OutputStream, or throws IOException on failure.

  • final 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



  • static void[] load (InputStream src, 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



  • static uint transfer (InputStream src, OutputStream dst, uint max = -1u);
  • Low-level data transfer , where max represents the maximum number of bytes to transfer , and tmp represents space for buffering the transfer . Throws IOException on failure.

  • class InputFilter : tango.io.model.IConduit.InputStream;
  • Base class for input stream filtering

  • this(InputStream host);
  • Attach to the provided stream

  • IConduit conduit ();
  • Return the hosting conduit

  • uint read (void[] dst);
  • Read from conduit into a target array. The provided dst will be populated with content from the conduit.

    Returns the number of bytes read , which may be less than requested in dst. Eof is returned whenever an end-of-flow condition arises.



  • InputStream clear ();
  • Clear any buffered content

  • 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



  • void close ();
  • Close the input

  • class OutputFilter : tango.io.model.IConduit.OutputStream;
  • Base class for output stream filtering

  • this(OutputStream host);
  • Attach to the provided stream

  • IConduit conduit ();
  • Return the hosting conduit

  • uint write (void[] src);
  • Write to conduit from a source array. The provided src content will be written to the conduit.

    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.



  • OutputStream flush ();
  • Emit/purge buffered content

  • OutputStream copy (InputStream src);
  • Transfer the content of another conduit to this one. Returns a reference to this class, or throws IOException on failure.

  • void close ();
  • Close the output

    Copyright (c) 2004 Kris Bell. All rights reserved :: page rendered by CandyDoc