Object
URIs are a crucial part of the Workshop API. This class provides a number of simple methods to improve manipulation of URIs. Wherever possible, these methods should be used to create, manipulate and inspect URIs. In particular there are a number of inconsistencies in the Java Runtime implementation of URI. UNC paths are not handled consistently between URI and java.io.File. Also URIs can be hard to inspect safely for filenames, extensions, etc... The methods below provide safe ways to perform these actions and should be used exclusively.
Object
URIUtil
Constructor Summary |
|
Method Summary |
public static |
|
public static |
|
public static | |
public static | |
public static | |
public static |
|
public static |
|
public static |
|
public static | |
public static | |
public static | |
public static |
|
public static |
|
public static |
|
public static |
|
public static |
|
public static |
|
public static |
|
public static | |
public static boolean |
|
public static boolean |
|
public static boolean | |
public static boolean | |
public static boolean | |
public static | |
public static | |
public static | |
public static |
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public URIUtil()
Method Detail |
public staticChange the scheme of a URIURIchangeScheme(URIuri,StringnewScheme)
public staticcreates a new URI using the specified URI as the parent of the new URIURIcreateFromParent(URIuriParent,StringsName, boolean isDir)
DEPRECATED
public staticCreate a URI encoding the string as appropriateURIcreateURI(StringunencodedUriString)
throwsURISyntaxException
URISyntaxException
DEPRECATED
public staticCreate a URI encoding the strings as appropriateURIcreateURI(StringunencodedScheme,StringunencodedSSP,StringunencodedFragment)
throwsURISyntaxException
URISyntaxException
DEPRECATED
public staticCreate a URI encoding the strings as appropriateURIcreateURI(StringunencodedScheme,StringunencodedSSP)
throwsURISyntaxException
URISyntaxException
DEPRECATED
public staticCreate a URI from an already encoded stringURIcreateURINoEncode(StringencodedUriString)
throwsURISyntaxException
URISyntaxException
DEPRECATED
public staticCreate a URI from an already encoded set of stringsURIcreateURINoEncode(StringencodedScheme,StringencodedSSP,StringencodedFragment)
throwsURISyntaxException
URISyntaxException
DEPRECATED
public staticCreate a URI from an already encoded set of stringsURIcreateURINoEncode(StringencodedScheme,StringencodedSSP)
throwsURISyntaxException
URISyntaxException
public staticStringdecode(Strings)
public staticStringencode(Strings)
public staticConstruct a URI from the given file. This method will canonicalize the file before converting it to a URIURIfromFile(Filef)
public staticCreate a URI from the given string.URIfromString(Stringpath)
public staticGet the file extension for this URI.StringgetExtension(URIuri)
DEPRECATED Please use FileSvc.get().getIFile(uri).getName().
public staticreturns the filename portion of the uriStringgetFilename(URIuri)
public staticThis will return the path portion of the uri as an OS-specific path to the file if the URI points to a file, or just the path if it is not. For instance, on Windows, the leading '/' is trimmed for windows drive letters, and UNC paths are resolved correctly.StringgetFilePath(URIuri)
public staticStringgetInternalPath(URIuri)
public staticreturns the parent path of the URI. if this uri is a directory, it will return the parent of the directory.StringgetParentPath(URIuri)
DEPRECATED Please use FileSvc.get().getIFile(uri).getParentIFile().getURI().
public staticreturns the parent URI of the URI. this is a shortcut for generating a new uri using the parent path.URIgetParentURI(URIuri)
public staticReturn the scheme of this uri.StringgetScheme(URIuri)
public static boolean isAncestor(Determines whether one URI is the parent of anotherURIparent,URIchild)
public static boolean isDirectory(URI uri)
Determines if the given URI is a directory. The standard mechanism is
to check for a trailing "/". This method will attempt to conver the
URI to a file if appropriate and verify this assumption. If the file
is a directory, but doesn't have a "/" it will assert.
public static boolean isFile(URI uri)
Determines if the given URI is a file. This merely means that it is
not a directory.
public static boolean isFileURI(URI uri)
Determine if the given URI represents a file object
public static boolean isUrlURI(URI uri)
Determine if the given URI represents an http or ftp object
public staticNormalize the URI. This is just likeURInormalize(URIuri)
URI.normalize()
however it is consistent with java.io.File in how it constructs URIs
for UNC Paths, preserving the leading double slash and empty authority.
public staticResolve the URI. This is just likeURIresolve(URIbase,URIchild)
URI.resolve(String)
however it is consistent with java.io.File in how it constructs URIs
for UNC Paths, preserving the leading double slash and empty authority.
public staticResolve the URI. This is just likeURIresolve(URIbase,Stringchild)
URI.resolve(String) however
it is consistent with java.io.File in how it constructs URIs for UNC
Paths, preserving the leading double slash and empty authority
DEPRECATED Please use FileSvc.get().getIFile(URI).getFile() if you need a file. Please consider not using the final getFile() if an IFile will suffice.
public staticConverts the given URI into a Java file object.FiletoFile(URIuri)