| java.lang.Object org.springframework.util.ResourceUtils
Method Summary | |
public static URL | extractJarFileURL(URL jarUrl) Extract the URL for the actual jar file from the given URL
(which may point to a resource in a jar file or to a jar file itself). | public static File | getFile(String resourceLocation) Resolve the given resource location to a java.io.File ,
i.e. | public static File | getFile(URL resourceUrl) Resolve the given resource URL to a java.io.File ,
i.e. | public static File | getFile(URL resourceUrl, String description) Resolve the given resource URL to a java.io.File ,
i.e. | public static File | getFile(URI resourceUri) Resolve the given resource URI to a java.io.File ,
i.e. | public static File | getFile(URI resourceUri, String description) Resolve the given resource URI to a java.io.File ,
i.e. | public static URL | getURL(String resourceLocation) Resolve the given resource location to a java.net.URL . | public static boolean | isJarURL(URL url) Determine whether the given URL points to a resource in a jar file,
that is, has protocol "jar", "zip", "wsjar" or "code-source".
"zip" and "wsjar" are used by BEA WebLogic Server and IBM WebSphere, respectively,
but can be treated like jar files. | public static boolean | isUrl(String resourceLocation) Return whether the given resource location is a URL:
either a special "classpath" pseudo URL or a standard URL. | public static URI | toURI(URL url) Create a URI instance for the given URL, replacing spaces with
"%20" quotes first. |
CLASSPATH_URL_PREFIX | final public static String CLASSPATH_URL_PREFIX(Code) | | Pseudo URL prefix for loading from the class path: "classpath:"
|
FILE_URL_PREFIX | final public static String FILE_URL_PREFIX(Code) | | URL prefix for loading from the file system: "file:"
|
JAR_URL_SEPARATOR | final public static String JAR_URL_SEPARATOR(Code) | | Separator between JAR URL and file path within the JAR
|
URL_PROTOCOL_CODE_SOURCE | final public static String URL_PROTOCOL_CODE_SOURCE(Code) | | URL protocol for an entry from an OC4J jar file: "code-source"
|
URL_PROTOCOL_FILE | final public static String URL_PROTOCOL_FILE(Code) | | URL protocol for a file in the file system: "file"
|
URL_PROTOCOL_JAR | final public static String URL_PROTOCOL_JAR(Code) | | URL protocol for an entry from a jar file: "jar"
|
URL_PROTOCOL_WSJAR | final public static String URL_PROTOCOL_WSJAR(Code) | | URL protocol for an entry from a WebSphere jar file: "wsjar"
|
URL_PROTOCOL_ZIP | final public static String URL_PROTOCOL_ZIP(Code) | | URL protocol for an entry from a zip file: "zip"
|
extractJarFileURL | public static URL extractJarFileURL(URL jarUrl) throws MalformedURLException(Code) | | Extract the URL for the actual jar file from the given URL
(which may point to a resource in a jar file or to a jar file itself).
Parameters: jarUrl - the original URL the URL for the actual jar file throws: MalformedURLException - if no valid jar file URL could be extracted |
getFile | public static File getFile(String resourceLocation) throws FileNotFoundException(Code) | | Resolve the given resource location to a java.io.File ,
i.e. to a file in the file system.
Does not check whether the fil actually exists; simply returns
the File that the given location would correspond to.
Parameters: resourceLocation - the resource location to resolve: either a"classpath:" pseudo URL, a "file:" URL, or a plain file path a corresponding File object throws: FileNotFoundException - if the resource cannot be resolved toa file in the file system |
getFile | public static File getFile(URL resourceUrl) throws FileNotFoundException(Code) | | Resolve the given resource URL to a java.io.File ,
i.e. to a file in the file system.
Parameters: resourceUrl - the resource URL to resolve a corresponding File object throws: FileNotFoundException - if the URL cannot be resolved toa file in the file system |
getFile | public static File getFile(URL resourceUrl, String description) throws FileNotFoundException(Code) | | Resolve the given resource URL to a java.io.File ,
i.e. to a file in the file system.
Parameters: resourceUrl - the resource URL to resolve Parameters: description - a description of the original resource thatthe URL was created for (for example, a class path location) a corresponding File object throws: FileNotFoundException - if the URL cannot be resolved toa file in the file system |
getFile | public static File getFile(URI resourceUri) throws FileNotFoundException(Code) | | Resolve the given resource URI to a java.io.File ,
i.e. to a file in the file system.
Parameters: resourceUri - the resource URI to resolve a corresponding File object throws: FileNotFoundException - if the URL cannot be resolved toa file in the file system |
getFile | public static File getFile(URI resourceUri, String description) throws FileNotFoundException(Code) | | Resolve the given resource URI to a java.io.File ,
i.e. to a file in the file system.
Parameters: resourceUri - the resource URI to resolve Parameters: description - a description of the original resource thatthe URI was created for (for example, a class path location) a corresponding File object throws: FileNotFoundException - if the URL cannot be resolved toa file in the file system |
getURL | public static URL getURL(String resourceLocation) throws FileNotFoundException(Code) | | Resolve the given resource location to a java.net.URL .
Does not check whether the URL actually exists; simply returns
the URL that the given location would correspond to.
Parameters: resourceLocation - the resource location to resolve: either a"classpath:" pseudo URL, a "file:" URL, or a plain file path a corresponding URL object throws: FileNotFoundException - if the resource cannot be resolved to a URL |
isJarURL | public static boolean isJarURL(URL url)(Code) | | Determine whether the given URL points to a resource in a jar file,
that is, has protocol "jar", "zip", "wsjar" or "code-source".
"zip" and "wsjar" are used by BEA WebLogic Server and IBM WebSphere, respectively,
but can be treated like jar files. The same applies to "code-source" URLs on Oracle
OC4J, provided that the path contains a jar separator.
Parameters: url - the URL to check whether the URL has been identified as a JAR URL |
isUrl | public static boolean isUrl(String resourceLocation)(Code) | | Return whether the given resource location is a URL:
either a special "classpath" pseudo URL or a standard URL.
Parameters: resourceLocation - the location String to check whether the location qualifies as a URL See Also: ResourceUtils.CLASSPATH_URL_PREFIX See Also: java.net.URL |
toURI | public static URI toURI(URL url) throws URISyntaxException(Code) | | Create a URI instance for the given URL, replacing spaces with
"%20" quotes first.
Furthermore, this method works on JDK 1.4 as well,
in contrast to the URL.toURI() method.
Parameters: url - the URL to convert into a URI instance the URI instance throws: URISyntaxException - if the URL wasn't a valid URI See Also: java.net.URL.toURI |
|
|