Class URLUtils

java.lang.Object
org.w3c.epubcheck.util.url.URLUtils

public final class URLUtils extends Object
  • Constructor Details

    • URLUtils

      public URLUtils()
  • Method Details

    • toURL

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

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

      public static 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(String string)
    • isPathRelativeSchemeLessURLString

      public static boolean isPathRelativeSchemeLessURLString(String string)
    • encodePath

      public static String encodePath(String string)
    • decode

      public static String decode(String string)
    • normalize

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

      public static 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.