public class URIUtil
extends java.lang.Object
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
FILE_SCHEMA
File schema.
|
| 构造器和说明 |
|---|
URIUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.lang.String |
convertFileNameToURLString(java.lang.String filePath)
Converts a filename to a valid URL string.
|
static java.net.URL |
getDirectory(java.lang.String filePath)
已过时。
not supported
|
static java.net.URL |
getDirectory(java.net.URL url)
已过时。
not supported
|
static java.lang.String |
getLocalPath(java.lang.String uri)
Checks
uri is file path. |
static java.lang.String |
getRelativePath(java.lang.String base,
java.lang.String resource)
Return the relative path for the given
resource according to
base. |
static boolean |
isValidResourcePath(java.lang.String resourceDir)
Tests whether the input string is a valid resource directory.
|
static java.lang.String |
resolveAbsolutePath(java.lang.String base,
java.lang.String relativePath)
Gets the absolute path for the given
base and
relativePath
. |
public static final java.lang.String FILE_SCHEMA
public static java.lang.String getLocalPath(java.lang.String uri)
uri is file path. If uri is an absolute
uri and refers to a file, removes "file://" and returns the file path. If
uri is relative uri and refers to a file, returns the
uri. For other cases, returns null.
For examples, following uri are supported:
uri - the input uriuri refers to a file. Otherwise
null.public static java.lang.String convertFileNameToURLString(java.lang.String filePath)
filePath - the file namepublic static java.net.URL getDirectory(java.lang.String filePath)
filePath - the file namepublic static java.net.URL getDirectory(java.net.URL url)
url - the url of the file.public static java.lang.String getRelativePath(java.lang.String base,
java.lang.String resource)
resource according to
base. Only handle file system and valid url syntax.
The base value should be directory ONLY and does NOT contain
file name and the format can be:
/ in the end of directory will be striped in the
return value.base - the base directoryresource - the full pathpublic static java.lang.String resolveAbsolutePath(java.lang.String base,
java.lang.String relativePath)
base and
relativePath
.
The base value should be directory ONLY and does NOT contain
file name and the format can be:
base - the base directoryrelativePath - the relative pathpublic static boolean isValidResourcePath(java.lang.String resourceDir)
resourceDir - the resource directorytrue if the input string is a valid resource
directory, false otherwise.java.net.MalformedURLExceptionCopyright © 2008 Actuate Corp. All rights reserved.