Class ReaderFactory


  • public class ReaderFactory
    extends java.lang.Object
    A factory to create a reader and streams for parsing. You can override it to resolve the URL, implement a cache or use another encoding as UFT-8.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReaderFactory()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.io.Reader create​(java.net.URL url)
      Create a Reader for the given URL.
      java.io.InputStream openStream​(java.net.URL url)
      Open an InputStream for the given URL.
      java.io.InputStream openStream​(java.net.URL baseURL, java.lang.String urlStr, java.lang.String relativeUrlStr)
      Open an InputStream for the given URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReaderFactory

        public ReaderFactory()
    • Method Detail

      • openStream

        public java.io.InputStream openStream​(java.net.URL url)
                                       throws java.io.IOException
        Open an InputStream for the given URL.
        Parameters:
        url - the url, not null
        Returns:
        the stream, never null
        Throws:
        java.io.IOException - If any I/O error occur on reading the URL.
      • openStream

        public java.io.InputStream openStream​(java.net.URL baseURL,
                                              java.lang.String urlStr,
                                              java.lang.String relativeUrlStr)
                                       throws java.io.IOException
        Open an InputStream for the given URL. This is used for inlining images via data-uri.
        Parameters:
        baseURL - the URL of the top less file
        urlStr - the absolute or relative URL that should be open
        relativeUrlStr - relative URL of the less script
        Returns:
        the stream, never null
        Throws:
        java.io.IOException - If any I/O error occur on reading the URL.
      • create

        public java.io.Reader create​(java.net.URL url)
                              throws java.io.IOException
        Create a Reader for the given URL.
        Parameters:
        url - the url, not null
        Returns:
        the reader, never null
        Throws:
        java.io.IOException - If any I/O error occur on reading the URL.