Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.stream
Class Conduit

    java.lang.Object
      com.saxonica.stream.Conduit

    public class Conduit

extends Object

A Conduit is a communication channel from a Producer to a Consumer: the channel is used to pass a sequence of items (and possibly an exception) from the producer to the consumer. This provides a bridge beween a push pipeline and a pull pipeline, which operates by executing the push pipeline and the pull pipeline in different threads.

Constructor Summary
`Conduit()`

Method Summary
`void` | `close()` Interface allowing the consumer to indicate that no more items are required.
`void` | `finish()` Interface allowing the producer to indicate that there are no more items to come.
`boolean` | `isClosed()` Ask whether the conduit has been closed
`Item` | `read()` Interface allowing the consumer to read an Item.
`void` | `signalProducerError(XPathException exception)` Interface allowing the producer to indicate that a dynamic error has occurred.
`void` | `write(Item value)` Interface allowing the producer to write an item.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Conduit

    public Conduit()

Method Detail

### read

    public Item read()
              throws XPathException

  Interface allowing the consumer to read an Item. The method suspends until an item is available, or until the end of the sequence is notified by the producer, or until an exception is notified by the producer.

  Returns:
    the item supplied by the producer; or null to indicate that the end of the sequence has been reached.
  Throws:
    `XPathException` - if the producer signalled an exception

### close

    public void close()

  Interface allowing the consumer to indicate that no more items are required.

### isClosed

    public boolean isClosed()

  Ask whether the conduit has been closed

  Returns:
    true if the consumer has indicated that no more items are required

### write

    public void write(Item value)

  Interface allowing the producer to write an item. The method will suspend if the queue of items waiting to be read exceeds a certain threshold.

  Parameters:
    `value` - The item to be written

### finish

    public void finish()

  Interface allowing the producer to indicate that there are no more items to come. This method MUST be called at the end of the sequence, or the consumer will hang.

### signalProducerError

    public void signalProducerError(XPathException exception)

  Interface allowing the producer to indicate that a dynamic error has occurred. This will be notified to the consumer by means of an exception from the next call on the read() method.

  Parameters:
    `exception` - the error to be signalled

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.