Class URLUtils


  • public final class URLUtils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      URLUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String decode​(java.lang.String string)  
      static io.mola.galimatias.URL docURL​(io.mola.galimatias.URL url)  
      static java.lang.String encodePath​(java.lang.String string)  
      static java.lang.String getDataURLType​(io.mola.galimatias.URL url)
      Returns the MIME type of a `data:` URL.
      static boolean isAbsoluteURLString​(java.lang.String string)  
      static boolean isPathRelativeSchemeLessURLString​(java.lang.String string)  
      static boolean isRemote​(io.mola.galimatias.URL test, io.mola.galimatias.URL local)
      Test if a URL is "remote" compared to a another URL.
      static boolean isSameOrigin​(io.mola.galimatias.URL urlA, io.mola.galimatias.URL urlB)  
      static io.mola.galimatias.URL normalize​(io.mola.galimatias.URL url)  
      static java.io.File toFile​(io.mola.galimatias.URL url)  
      static java.lang.String toFilePath​(io.mola.galimatias.URL url)  
      static io.mola.galimatias.URL toURL​(java.io.File file)  
      • Methods inherited from class java.lang.Object

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

      • URLUtils

        public URLUtils()
    • Method Detail

      • toURL

        public static io.mola.galimatias.URL toURL​(java.io.File file)
      • toFile

        public static java.io.File toFile​(io.mola.galimatias.URL url)
      • toFilePath

        public static java.lang.String toFilePath​(io.mola.galimatias.URL url)
      • docURL

        public static io.mola.galimatias.URL docURL​(io.mola.galimatias.URL url)
      • isSameOrigin

        public static boolean isSameOrigin​(io.mola.galimatias.URL urlA,
                                           io.mola.galimatias.URL urlB)
      • isRemote

        public static boolean isRemote​(io.mola.galimatias.URL test,
                                       io.mola.galimatias.URL local)
        Test if a URL is "remote" compared to a another URL. A URL is considered remote if it is not same origin as the test URL **and** it is not a `data` URL. Note that this relation is not defined in the URL standard, but is useful in EPUB (to test for remote resources compared to container URLs).
        Parameters:
        test - the URL to test
        local - the URL it is tested against
        Returns:
        `true` if and only if `test` is remote compared to `local`.
      • isAbsoluteURLString

        public static boolean isAbsoluteURLString​(java.lang.String string)
      • isPathRelativeSchemeLessURLString

        public static boolean isPathRelativeSchemeLessURLString​(java.lang.String string)
      • encodePath

        public static java.lang.String encodePath​(java.lang.String string)
      • decode

        public static java.lang.String decode​(java.lang.String string)
      • normalize

        public static io.mola.galimatias.URL normalize​(io.mola.galimatias.URL url)
      • getDataURLType

        public static java.lang.String getDataURLType​(io.mola.galimatias.URL url)
        Returns the MIME type of a `data:` URL.
        Parameters:
        url - a URL, can be `null`.
        Returns:
        the MIME type declared in the data URL (can be an empty string), or `null` if `url` is not a data URL.