|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.virtual.VFSUtils
public class VFSUtils
VFS Utilities
| Field Summary | |
|---|---|
static String |
CASE_SENSITIVE_QUERY
|
static String |
FILE_PROTOCOL
Constant representing the URL file protocol |
static String |
FORCE_CASE_SENSITIVE_KEY
Key used to force case sensitive path checking in vfsfile |
static String |
FORCE_COPY_KEY
The system no force copy key / query |
static String |
FORCE_NO_REAPER_KEY
Key used to turn off reaper mode in vfszip - forcing synchronous (slower) handling of files |
static String |
FORCE_VFS_JAR_KEY
Key used to force fallback from vfszip (default) to vfsjar |
static String |
IS_TEMP_FILE
The temp marker flag |
static String |
JAR_URL_SEPARATOR
Standard separator for JAR URL |
static String |
NO_REAPER_QUERY
|
static String |
OPTIMIZE_FOR_MEMORY_KEY
Key used to turn on memory optimizations - less cache use at the expense of performance |
static String |
USE_COPY_QUERY
|
static String |
VFS_CACHE_KEY
Key used to determine VFS Cache impl |
static String |
VFS_LINK_INFIX
The link |
static String |
VFS_LINK_NAME
The link name |
static String |
VFS_LINK_PROPERTIES_SUFFIX
The link properties |
static String |
VFS_LINK_TARGET
The link target |
| Constructor Summary | |
|---|---|
VFSUtils()
|
|
| Method Summary | ||
|---|---|---|
static void |
addManifestLocations(VirtualFile file,
List<VirtualFile> paths)
Add manifest paths |
|
protected static VirtualFile |
copy(VirtualFile file,
CopyMechanism mechanism)
Create temp. |
|
static void |
copyStream(InputStream is,
OutputStream os)
Copy input stream to output stream without closing streams. |
|
static void |
copyStreamAndClose(InputStream is,
OutputStream os)
Copy input stream to output stream and close them both |
|
static String |
decode(String path)
Decode the path with UTF-8 encoding.. |
|
static String |
decode(String path,
String encoding)
Decode the path. |
|
static void |
disableCaseSensitive(VFS vfs)
Disable case sensitive for vfs param. |
|
static void |
disableCaseSensitive(VirtualFile file)
Disable case sensitive for file param. |
|
static void |
disableCopy(VFS vfs)
Disable copy for vfs param. |
|
static void |
disableCopy(VirtualFile file)
Disable copy for file param. |
|
static void |
disableNoReaper(VFS vfs)
Disable reaper for vfs param. |
|
static void |
disableNoReaper(VirtualFile file)
Disable reaper for file param. |
|
protected static void |
disableOption(VFS vfs,
String optionName)
Disable option. |
|
protected static void |
disableOption(VirtualFile file,
String optionName)
Disable option. |
|
static void |
enableCaseSensitive(VFS vfs)
Enable case sensitive for vfs param. |
|
static void |
enableCaseSensitive(VirtualFile file)
Enable case sensitive for file param. |
|
static void |
enableCopy(VFS vfs)
Enable copy for vfs param. |
|
static void |
enableCopy(VirtualFile file)
Enable copy for file param. |
|
static void |
enableNoReaper(VFS vfs)
Enable reaper for vfs param. |
|
static void |
enableNoReaper(VirtualFile file)
Enable reaper for file param. |
|
protected static void |
enableOption(VFS vfs,
String optionName)
Enable option. |
|
protected static void |
enableOption(VirtualFile file,
String optionName)
Enable option. |
|
static VirtualFile |
explode(VirtualFile file)
Force explode. |
|
static String |
fixName(String name)
Fix a name (removes any trailing slash) |
|
static URI |
getCompatibleURI(VirtualFile file)
Get spec compatilbe uri from virtual file. |
|
static URL |
getCompatibleURL(VirtualFile file)
Get spec compatilbe url from virtual file. |
|
static String |
getKey(VFSContext context)
Get path key. |
|
static Manifest |
getManifest(VFS archive)
Get a manifest from a virtual file system, assuming the root of the VFS is the root of an archive |
|
static Manifest |
getManifest(VirtualFile archive)
Get a manifest from a virtual file, assuming the virtual file is the root of an archive |
|
static String |
getName(URI uri)
Get the name. |
|
static String |
getOption(VFS vfs,
String key)
Get the option. |
|
static
|
getOption(VFS vfs,
String key,
Class<T> exactType)
Get the option. |
|
static String |
getOption(VirtualFile file,
String key)
Get the option. |
|
static
|
getOption(VirtualFile file,
String key,
Class<T> exactType)
Get the option. |
|
static String |
getPathsString(Collection<VirtualFile> paths)
Get the paths string for a collection of virtual files |
|
static URL |
getRealURL(VirtualFile file)
Get real url. |
|
static String |
getRelativePath(VFSContext context,
URI uri)
Get relative path. |
|
static boolean |
isLink(String name)
Does a vf name contain the VFS link prefix |
|
static boolean |
isNestedFile(VirtualFile file)
Is file handle nested. |
|
static boolean |
isTemporaryFile(VirtualFile file)
Is the virtual file temporary. |
|
static void |
parseLinkProperties(InputStream is,
List<LinkInfo> info,
Properties props)
Parse a properties link file |
|
static Map<String,String> |
parseURLQuery(String query)
Take a URL.getQuery string and parse it into name=value pairs |
|
static List<LinkInfo> |
readLinkInfo(InputStream is,
String name,
Properties props)
Read the link information from the stream based on the type as determined from the name suffix. |
|
static Manifest |
readManifest(VirtualFile manifest)
Read the manifest from given manifest VirtualFile. |
|
static URL |
sanitizeURL(URL url)
Ensure the url is convertible to URI by encoding spaces and percent characters if necessary |
|
static void |
stopCache()
Stop cache. |
|
static String |
stripProtocol(URI uri)
Strip protocol from url string. |
|
static VirtualFile |
temp(VirtualFile file)
Create temp. |
|
static URI |
toURI(URL url)
Deal with urls that may include spaces. |
|
static VirtualFile |
unjar(VirtualFile file)
Unjar. |
|
static VirtualFile |
unpack(VirtualFile file)
Unpack the nested artifact under file param. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String VFS_LINK_INFIX
public static final String VFS_LINK_PROPERTIES_SUFFIX
public static final String VFS_LINK_NAME
public static final String VFS_LINK_TARGET
public static final String FORCE_COPY_KEY
public static final String USE_COPY_QUERY
public static final String FORCE_VFS_JAR_KEY
public static final String FORCE_NO_REAPER_KEY
public static final String NO_REAPER_QUERY
public static final String FORCE_CASE_SENSITIVE_KEY
public static final String CASE_SENSITIVE_QUERY
public static final String OPTIMIZE_FOR_MEMORY_KEY
public static final String VFS_CACHE_KEY
public static final String FILE_PROTOCOL
public static final String JAR_URL_SEPARATOR
public static final String IS_TEMP_FILE
| Constructor Detail |
|---|
public VFSUtils()
| Method Detail |
|---|
public static void stopCache()
public static String getPathsString(Collection<VirtualFile> paths)
paths - the paths
IllegalArgumentException - for null paths
public static void addManifestLocations(VirtualFile file,
List<VirtualFile> paths)
throws IOException
file - the filepaths - the paths to add to
IOException - if there is an error reading the manifest or the
virtual file is closed
IllegalStateException - if the file has no parent
IllegalArgumentException - for a null file or paths
public static Manifest getManifest(VirtualFile archive)
throws IOException
archive - the root the archive
IOException - if there is an error reading the manifest or the
virtual file is closed
IllegalArgumentException - for a null archive
public static Manifest readManifest(VirtualFile manifest)
throws IOException
manifest - the VF to read from
IOException - if problems while opening VF stream occur
public static Manifest getManifest(VFS archive)
throws IOException
archive - the vfs
IOException - if there is an error reading the manifest
IllegalArgumentException - for a null archivepublic static String fixName(String name)
name - the name to fix
IllegalArgumentException - for a null namepublic static String decode(String path)
path - the path to decode
public static String decode(String path,
String encoding)
path - the path to decodeencoding - the encodeing
public static String getName(URI uri)
uri - the uri
public static Map<String,String> parseURLQuery(String query)
query - Possibly empty/null url query string
public static boolean isLink(String name)
name - - the name portion of a virtual file
public static List<LinkInfo> readLinkInfo(InputStream is,
String name,
Properties props)
throws IOException,
URISyntaxException
is - - input stream to the link file contentsname - - the name of the virtual file representing the linkprops - the propertes
IOException - on failure to read/parse the stream
URISyntaxException - for an error parsing a URI
public static void parseLinkProperties(InputStream is,
List<LinkInfo> info,
Properties props)
throws IOException,
URISyntaxException
is - - input stream to the link file contentsinfo - the link infosprops - the propertes
IOException - on failure to read/parse the stream
URISyntaxException - for an error parsing a URI
public static URI toURI(URL url)
throws URISyntaxException
url - the url
URISyntaxException - for any error
public static URL sanitizeURL(URL url)
throws URISyntaxException,
MalformedURLException
url - to be sanitized
URISyntaxException - if URI conversion can't be fixed
MalformedURLException - if an error occurs
public static String getOption(VirtualFile file,
String key)
file - the filekey - the option key
public static String getOption(VFS vfs,
String key)
vfs - the vfskey - the option key
public static <T> T getOption(VirtualFile file,
String key,
Class<T> exactType)
T - exact typefile - the filekey - the option keyexactType - the exact type
public static <T> T getOption(VFS vfs,
String key,
Class<T> exactType)
T - exact typevfs - the vfskey - the option keyexactType - the exact type
protected static void enableOption(VirtualFile file,
String optionName)
file - the fileoptionName - option name
protected static void disableOption(VirtualFile file,
String optionName)
file - the fileoptionName - option name
protected static void enableOption(VFS vfs,
String optionName)
vfs - the vfsoptionName - option name
protected static void disableOption(VFS vfs,
String optionName)
vfs - the vfsoptionName - option namepublic static void enableCopy(VirtualFile file)
file - the filepublic static void disableCopy(VirtualFile file)
file - the filepublic static void enableCopy(VFS vfs)
vfs - the vfspublic static void disableCopy(VFS vfs)
vfs - the vfspublic static void enableNoReaper(VirtualFile file)
file - the filepublic static void disableNoReaper(VirtualFile file)
file - the filepublic static void enableNoReaper(VFS vfs)
vfs - the vfspublic static void disableNoReaper(VFS vfs)
vfs - the vfspublic static void enableCaseSensitive(VirtualFile file)
file - the filepublic static void disableCaseSensitive(VirtualFile file)
file - the filepublic static void enableCaseSensitive(VFS vfs)
vfs - the vfspublic static void disableCaseSensitive(VFS vfs)
vfs - the vfspublic static boolean isTemporaryFile(VirtualFile file)
file - the file
public static VirtualFile unpack(VirtualFile file)
throws IOException,
URISyntaxException
file - the file to unpack
IOException - for any io error
URISyntaxException - for any uri error
public static VirtualFile explode(VirtualFile file)
throws IOException,
URISyntaxException
file - the file to explode
IOException - for any io error
URISyntaxException - for any uri error
public static VirtualFile temp(VirtualFile file)
throws IOException,
URISyntaxException
file - the file to temp
IOException - for any io error
URISyntaxException - for any uri error
public static VirtualFile unjar(VirtualFile file)
throws IOException,
URISyntaxException
file - the file to unjar
IOException - for any io error
URISyntaxException - for any uri error
protected static VirtualFile copy(VirtualFile file,
CopyMechanism mechanism)
throws IOException,
URISyntaxException
file - the file to unpack/explodemechanism - the copy mechanism
IOException - for any io error
URISyntaxException - for any uri error
public static boolean isNestedFile(VirtualFile file)
throws IOException
file - the file handle to check
IOException - for any error
public static void copyStreamAndClose(InputStream is,
OutputStream os)
throws IOException
is - input streamos - output stream
IOException - for any error
public static void copyStream(InputStream is,
OutputStream os)
throws IOException
is - input streamos - output stream
IOException - for any error
public static URL getCompatibleURL(VirtualFile file)
throws Exception
file - the virtual file
Exception - for any error
public static URI getCompatibleURI(VirtualFile file)
throws Exception
file - the virtual file
Exception - for any error
public static URL getRealURL(VirtualFile file)
throws IOException,
URISyntaxException
file - the virtual file
IOException - for any error
URISyntaxException - for any uri syntac error
public static String getRelativePath(VFSContext context,
URI uri)
context - the vfs contexturi - the uri
public static String stripProtocol(URI uri)
uri - the uri
public static String getKey(VFSContext context)
context - the vfs context
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||