org.apache.fop.afp.util

## Class AFPResourceAccessor

- java.lang.Object
- - org.apache.fop.afp.util.AFPResourceAccessor

-     public final class AFPResourceAccessor
      extends Object

  Defines an interface through which external resource objects can be accessed.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AFPResourceAccessor(InternalResourceResolver resourceResolver)` Constructor for resource to be accessed via the `FOUserAgent`.
    `AFPResourceAccessor(InternalResourceResolver resourceResolver, String baseURI)` Constructor for resource to be accessed via the `FOUserAgent`.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `InputStream` | `createInputStream(URI uri)` Creates an `InputStream` given a URI.
    `URI` | `resolveURI(String uri)` Returns the resolved URI, given the URI of a resource.

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

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

- - ### Constructor Detail

    - #### AFPResourceAccessor

          public AFPResourceAccessor(InternalResourceResolver resourceResolver,
                                     String baseURI)

      Constructor for resource to be accessed via the `FOUserAgent`. This contructor takes a base URI for resolving font resource URIs. So, if fonts need to be accessed, you can set the `FontManager`'s base URI instead of the one on the `FopFactory`.
      Parameters:
        `resourceResolver` - the resolver of resources
        `baseURI` - the custom base URI to resolve relative URIs against (may be null)

    - #### AFPResourceAccessor

          public AFPResourceAccessor(InternalResourceResolver resourceResolver)

      Constructor for resource to be accessed via the `FOUserAgent`.
      Parameters:
        `resourceResolver` - the resolver of resources

  - ### Method Detail

    - #### createInputStream

          public InputStream createInputStream(URI uri)
                                        throws IOException

      Creates an `InputStream` given a URI.
      Parameters:
        `uri` - the URI of the InputStream
      Returns:
        an InputStream
      Throws:
        `IOException` - if an I/O error occurs while creating the InputStream.

    - #### resolveURI

          public URI resolveURI(String uri)

      Returns the resolved URI, given the URI of a resource.
      Parameters:
        `uri` - the resource URI
      Returns:
        the resolved URI

Copyright © 2023 Apache Software Foundation. All rights reserved.