Package net.sf.saxon.lib

## Class StandardUnparsedTextResolver

- java.lang.Object
- - net.sf.saxon.lib.StandardUnparsedTextResolver

- All Implemented Interfaces:
    `UnparsedTextURIResolver`

      public class StandardUnparsedTextResolver
      extends java.lang.Object
      implements UnparsedTextURIResolver

  Default implementation of the UnparsedTextURIResolver, used if no other implementation is nominated to the Configuration. This implementation * handles anything that the java URL class will handle, plus the `classpath` * URI scheme defined in the Spring framework, and the `data` URI scheme defined in * RFC 2397.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.lang.String` | `inferStreamEncoding​(java.io.InputStream is, Logger err)` | Try to detect the encoding from the start of the input stream
    `java.io.Reader` | `resolve​(java.net.URI absoluteURI, java.lang.String encoding, Configuration config)` | Resolve the URI passed to the XSLT unparsed-text() function, after resolving against the base URI.
    `void` | `setDebugging​(boolean debug)` | Set debugging on or off.

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

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

- - ### Constructor Detail

    - #### StandardUnparsedTextResolver

          public StandardUnparsedTextResolver()

  - ### Method Detail

    - #### setDebugging

          public void setDebugging​(boolean debug)

      Set debugging on or off. In debugging mode, information is written to System.err to trace the process of deducing an encoding.
      Parameters:
        `debug` - set to true to enable debugging

    - #### resolve

          public java.io.Reader resolve​(java.net.URI absoluteURI,
                                        java.lang.String encoding,
                                        Configuration config)
                                 throws XPathException

      Resolve the URI passed to the XSLT unparsed-text() function, after resolving against the base URI.
      Specified by:
        `resolve` in interface `UnparsedTextURIResolver`
      Parameters:
        `absoluteURI` - the absolute URI obtained by resolving the supplied URI against the base URI
        `encoding` - the encoding requested in the call of unparsed-text(), if any. Otherwise null.
        `config` - The configuration. Provided in case the URI resolver needs it.
      Returns:
        a Reader, which Saxon will use to read the unparsed text. After the text has been read, the close() method of the Reader will be called.
      Throws:
        `XPathException` - if any failure occurs
      Since:
        8.9

    - #### inferStreamEncoding

          public static java.lang.String inferStreamEncoding​(java.io.InputStream is,
                                                             Logger err)
                                                      throws java.io.IOException

      Try to detect the encoding from the start of the input stream
      Parameters:
        `is` - the input stream
        `err` - logger to be used for diagnostics, or null
      Returns:
        the inferred encoding, defaulting to UTF-8
      Throws:
        `java.io.IOException` - if it isn't possible to mark the current position on the input stream and read ahead