Package org.w3c.epubcheck.util.url
Class URLUtils
- java.lang.Object
-
- org.w3c.epubcheck.util.url.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.Stringdecode(java.lang.String string)static io.mola.galimatias.URLdocURL(io.mola.galimatias.URL url)static java.lang.StringencodePath(java.lang.String string)static java.lang.StringgetDataURLType(io.mola.galimatias.URL url)Returns the MIME type of a `data:` URL.static booleanisAbsoluteURLString(java.lang.String string)static booleanisPathRelativeSchemeLessURLString(java.lang.String string)static booleanisRemote(io.mola.galimatias.URL test, io.mola.galimatias.URL local)Test if a URL is "remote" compared to a another URL.static booleanisSameOrigin(io.mola.galimatias.URL urlA, io.mola.galimatias.URL urlB)static io.mola.galimatias.URLnormalize(io.mola.galimatias.URL url)static java.io.FiletoFile(io.mola.galimatias.URL url)static java.lang.StringtoFilePath(io.mola.galimatias.URL url)static io.mola.galimatias.URLtoURL(java.io.File file)
-
-
-
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 testlocal- 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.
-
-