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

org.apache.fop.apps.io

## Class InternalResourceResolver

- java.lang.Object
- - org.apache.fop.apps.io.InternalResourceResolver

-     public class InternalResourceResolver
      extends Object

  This object holds the base URI from which to resolve URIs against as well as the resolver for resource acquisition. It also does some URI sanitization of common URI syntactical errors. This class takes in a `ResourceResolver` and delegates all relevant URIs to it.

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static URI` | `cleanURI(String uriStr)` Performs some sanitation for some of the most common URI syntax mistakes.
    `URI` | `getBaseURI()` Returns the base URI from which to resolve all URIs against.
    `static URI` | `getBaseURI(String base)` Performs some sanitation for some of the most common URI syntax mistakes but returns a directory URI rather than a file URI.
    `OutputStream` | `getOutputStream(URI uri)` Returns the OutputStream for a given URI.
    `org.apache.xmlgraphics.io.Resource` | `getResource(String stringUri)` Retrieve a resource given a URI in String form.
    `org.apache.xmlgraphics.io.Resource` | `getResource(URI uri)` Retrieve a resource given a URI in String form.
    `URI` | `resolveFromBase(URI uri)` Resolves a URI against the base URI.

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

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

- - ### Method Detail

    - #### getBaseURI

          public URI getBaseURI()

      Returns the base URI from which to resolve all URIs against.
      Returns:
        the base URI

    - #### getResource

          public org.apache.xmlgraphics.io.Resource getResource(String stringUri)
                                                         throws IOException,
                                                                URISyntaxException

      Retrieve a resource given a URI in String form. This also does some syntactical sanitaion on the URI.
      Parameters:
        `stringUri` - the URI in String form
      Returns:
        the resource
      Throws:
        `IOException` - if an I/O error occurred
        `URISyntaxException` - if the URI syntax was invalid

    - #### getResource

          public org.apache.xmlgraphics.io.Resource getResource(URI uri)
                                                         throws IOException

      Retrieve a resource given a URI in String form.
      Parameters:
        `uri` - the resource URI
      Returns:
        the resource
      Throws:
        `IOException` - if an I/O error occurred

    - #### getOutputStream

          public OutputStream getOutputStream(URI uri)
                                       throws IOException

      Returns the OutputStream for a given URI.
      Parameters:
        `uri` - the URI for the inteded stream
      Returns:
        the output stream
      Throws:
        `IOException` - if an I/O error occurrred

    - #### resolveFromBase

          public URI resolveFromBase(URI uri)

      Resolves a URI against the base URI.
      Parameters:
        `uri` - the URI that requires resolution
      Returns:
        the resolved URI

    - #### cleanURI

          public static URI cleanURI(String uriStr)
                              throws URISyntaxException

      Performs some sanitation for some of the most common URI syntax mistakes.
      Parameters:
        `uriStr` - the URI in String form
      Returns:
        a valid URI
      Throws:
        `URISyntaxException` - if the given String was too erroneous to validate

    - #### getBaseURI

          public static URI getBaseURI(String base)
                                throws URISyntaxException

      Performs some sanitation for some of the most common URI syntax mistakes but returns a directory URI rather than a file URI.
      Parameters:
        `base` - the directory URI in String form
      Returns:
        the directory URI
      Throws:
        `URISyntaxException` - if the given String was too erroneous to validate

Copyright © 2025 Apache Software Foundation. All rights reserved.