public class MDIFileUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.io.File |
getFile(java.net.URL url)
Return a File for an URL, replacing percent encoding characters by their equivalent characters.
|
static java.lang.String |
getRelativePath(java.io.File baseDir,
java.io.File file)
Return the path of a File relative to a directory.
|
static java.io.File |
getRelativePath(java.io.File baseDir,
java.lang.String relativePath)
Return the File corresponding to a String-defined path, that can be defined as absolute, or as relative to a
base directory.
|
static boolean |
isFileProtocol(java.net.URL url)
Return true if the protocol is a file protocol.
|
static boolean |
isHTTPProtocol(java.net.URL url)
Return true if the protocol is a http, or https protocol.
|
static boolean |
isRelativeTo(java.io.File baseDir,
java.io.File file)
Return true if a file is relative to a directory (that is: the directory is one of the file ancestors).
|
static java.io.File |
replaceEscapedSequences(java.io.File file,
boolean keepEscapedSpaces)
Replace the percent-encoding escape sequences in a File path by their equivalent characters.
|
static java.lang.String |
replaceEscapedSequences(java.lang.String path,
boolean keepEscapedSpaces)
Replace the percent-encoding escape sequences in a URL path by their equivalent characters.
|
public static boolean isHTTPProtocol(java.net.URL url)
url
- the URLpublic static boolean isFileProtocol(java.net.URL url)
url
- the URLpublic static java.io.File getFile(java.net.URL url)
url
- the URL the URLpublic static java.io.File getRelativePath(java.io.File baseDir, java.lang.String relativePath)
baseDir
- the base directoryrelativePath
- the relative pathpublic static java.lang.String getRelativePath(java.io.File baseDir, java.io.File file)
baseDir
- the base directoryfile
- the Filepublic static boolean isRelativeTo(java.io.File baseDir, java.io.File file)
baseDir
- the directoryfile
- the filepublic static java.io.File replaceEscapedSequences(java.io.File file, boolean keepEscapedSpaces)
file
- the filekeepEscapedSpaces
- allow to keep the escaping of spaces (%20)public static java.lang.String replaceEscapedSequences(java.lang.String path, boolean keepEscapedSpaces)
path
- the pathkeepEscapedSpaces
- allow to keep the escaping of spaces (%20)