AFPResourceAccessor (Apache FOP Core 2.11 API)
Date: 2025-04-24

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 © 2025 Apache Software Foundation. All rights reserved.