Package net.sf.saxon.s9api

## Class AbstractDestination

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

- All Implemented Interfaces:
    `Destination`
  Direct Known Subclasses:
    `DOMDestination`, `NullDestination`, `RawDestination`, `ReceivingDestination`, `SAXDestination`, `SchemaValidator`, `Serializer`, `TeeDestination`, `XdmDestination`, `XMLStreamWriterDestination`, `XQueryEvaluator`

      public abstract class AbstractDestination
      extends java.lang.Object
      implements Destination

  An abstract class providing reusable code for implementing the `Destination` interface}

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected DestinationHelper` | `helper` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractDestination()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `closeAndNotify()` | Close the destination and notify all registered listeners that it has been closed.
    `java.net.URI` | `getDestinationBaseURI()` | Get the base URI of the resource being written to this destination
    `void` | `onClose​(Action listener)` | Register a listener to be notified when this destination is closed
    `void` | `setDestinationBaseURI​(java.net.URI baseURI)` | Set the base URI of the resource being written to this destination

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

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

    - ### Methods inherited from interface net.sf.saxon.s9api.Destination

      `close, getReceiver`

- - ### Field Detail

    - #### helper

          protected DestinationHelper helper

  - ### Constructor Detail

    - #### AbstractDestination

          public AbstractDestination()

  - ### Method Detail

    - #### setDestinationBaseURI

          public void setDestinationBaseURI​(java.net.URI baseURI)

      Set the base URI of the resource being written to this destination
      Specified by:
        `setDestinationBaseURI` in interface `Destination`
      Parameters:
        `baseURI` - the base URI to be used

    - #### getDestinationBaseURI

          public java.net.URI getDestinationBaseURI()

      Get the base URI of the resource being written to this destination
      Specified by:
        `getDestinationBaseURI` in interface `Destination`
      Returns:
        the baseURI, or null if none is known

    - #### onClose

          public final void onClose​(Action listener)

      Register a listener to be notified when this destination is closed
      Specified by:
        `onClose` in interface `Destination`
      Parameters:
        `listener` - an object to be notified when writing to the destination is successfully completed

    - #### closeAndNotify

          public void closeAndNotify()
                              throws SaxonApiException

      Close the destination and notify all registered listeners that it has been closed. This method is intended for internal use by Saxon. The method first calls `Destination.close()` to close the destination, then it calls `Consumer.accept(T)` on each of the listeners in turn to notify the fact that it has been closed.
      Specified by:
        `closeAndNotify` in interface `Destination`
      Throws:
        `SaxonApiException` - if the close() method throws `SaxonApiException`.