Package net.sf.saxon.jaxp

## Class ReceivingDestination

- java.lang.Object
- - net.sf.saxon.s9api.AbstractDestination
  - - net.sf.saxon.jaxp.ReceivingDestination

- All Implemented Interfaces:
    `Destination`

      public class ReceivingDestination
      extends AbstractDestination

  An implementation of `Destination` that simply wraps a supplied `Receiver`

  The supplied `Receiver` will be wrapped in a sequence normalizer unless requested otherwise. Specifically, it is wrapped unless the method `acceptsRawOutput()` returns true.

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.s9api.AbstractDestination

      `helper`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ReceivingDestination​(Receiver target)` | Create a `ReceivingDestination` that wraps a supplied `Receiver`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `acceptsRawOutput()` | Ask whether this receiver accepts raw output, that is, an arbitrary sequence of items not necessarily forming an XML document or element tree.
    `void` | `close()` | Close the destination, allowing resources to be released.
    `Receiver` | `getReceiver​(PipelineConfiguration pipe, SerializationProperties properties)` | Get a `Receiver` to which events may be sent.

    - ### Methods inherited from class net.sf.saxon.s9api.AbstractDestination

      `closeAndNotify, getDestinationBaseURI, onClose, setDestinationBaseURI`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReceivingDestination

          public ReceivingDestination​(Receiver target)

      Create a `ReceivingDestination` that wraps a supplied `Receiver`
      Parameters:
        `target` - the supplied `Receiver`. This must accept a regular event sequence as defined in `RegularSequenceChecker`

  - ### Method Detail

    - #### getReceiver

          public Receiver getReceiver​(PipelineConfiguration pipe,
                                      SerializationProperties properties)

      Get a `Receiver` to which events may be sent. For this implementation, this will be the wrapped `Receiver`.
      Parameters:
        `pipe` - The Saxon configuration. Not used in this implementation.
        `properties` - The required serialization properties (not used)
      Returns:
        the wrapped `Receiver`

    - #### acceptsRawOutput

          public boolean acceptsRawOutput()

      Ask whether this receiver accepts raw output, that is, an arbitrary sequence of items not necessarily forming an XML document or element tree. May be overridden in a subclass.
      Returns:
        false unless one of the following conditions is true:
        1. The `Receiver` is an instance of `SequenceNormalizer`
        2. The `Receiver` implements `ReceiverWithOutputProperties`, and a call on `getOutputProperties(SaxonOutputPropertes.REQUIRE_WELL_FORMED)` returns "no"
        3. The method {#acceptRawOutput()} is implemented in a subclass of `ReceivingDestination`, and returns false.

    - #### close

          public void close()
                     throws SaxonApiException

      Description copied from interface: `Destination`
      Close the destination, allowing resources to be released. Saxon calls this method when it has finished writing to the destination.

      The `close()` method should not cause any adverse effects if it is called more than once. If any other method is called after the `close()` call, the results are undefined. This means that a Destination is not, in general, serially reusable.

      If an `Destination.onClose(net.sf.saxon.s9api.Action)` action has been associated with the destination, this will be called after the destination is closed.

      Throws:
        `SaxonApiException` - if any failure occurs