Package org.apache.ibatis.io
Class DefaultVFS
- java.lang.Object
- 
- org.apache.ibatis.io.VFS
- 
- org.apache.ibatis.io.DefaultVFS
 
 
- 
- 
Field Summary- 
Fields inherited from class org.apache.ibatis.io.VFSIMPLEMENTATIONS, USER_IMPLEMENTATIONS
 
- 
 - 
Constructor SummaryConstructors Constructor Description DefaultVFS()
 - 
Method SummaryModifier and Type Method Description protected java.net.URLfindJarForResource(java.net.URL url)Attempts to deconstruct the given URL to find a JAR file containing the resource referenced by the URL.protected java.lang.StringgetPackagePath(java.lang.String packageName)Converts a Java package name to a path that can be looked up with a call toClassLoader.getResources(String).protected booleanisJar(java.net.URL url)Returns true if the resource located at the given URL is a JAR file.protected booleanisJar(java.net.URL url, byte[] buffer)Returns true if the resource located at the given URL is a JAR file.booleanisValid()Return true if theVFSimplementation is valid for the current environment.java.util.List<java.lang.String>list(java.net.URL url, java.lang.String path)Recursively list the full resource path of all the resources that are children of the resource identified by a URL.protected java.util.List<java.lang.String>listResources(java.util.jar.JarInputStream jar, java.lang.String path)List the names of the entries in the givenJarInputStreamthat begin with the specifiedpath.- 
Methods inherited from class org.apache.ibatis.io.VFSaddImplClass, getClass, getInstance, getMethod, getResources, invoke, list
 
- 
 
- 
- 
- 
Method Detail- 
isValidpublic boolean isValid() Description copied from class:VFSReturn true if theVFSimplementation is valid for the current environment.
 - 
listpublic java.util.List<java.lang.String> list(java.net.URL url, java.lang.String path) throws java.io.IOExceptionDescription copied from class:VFSRecursively list the full resource path of all the resources that are children of the resource identified by a URL.- Specified by:
- listin class- VFS
- Parameters:
- url- The URL that identifies the resource to list.
- path- The path to the resource that is identified by the URL. Generally, this is the value passed to- VFS.getResources(String)to get the resource URL.
- Returns:
- A list containing the names of the child resources.
- Throws:
- java.io.IOException- If I/O errors occur
 
 - 
listResourcesprotected java.util.List<java.lang.String> listResources(java.util.jar.JarInputStream jar, java.lang.String path) throws java.io.IOExceptionList the names of the entries in the givenJarInputStreamthat begin with the specifiedpath. Entries will match with or without a leading slash.- Parameters:
- jar- The JAR input stream
- path- The leading path to match
- Returns:
- The names of all the matching entries
- Throws:
- java.io.IOException- If I/O errors occur
 
 - 
findJarForResourceprotected java.net.URL findJarForResource(java.net.URL url) throws java.net.MalformedURLExceptionAttempts to deconstruct the given URL to find a JAR file containing the resource referenced by the URL. That is, assuming the URL references a JAR entry, this method will return a URL that references the JAR file containing the entry. If the JAR cannot be located, then this method returns null.- Parameters:
- url- The URL of the JAR entry.
- Returns:
- The URL of the JAR file, if one is found. Null if not.
- Throws:
- java.net.MalformedURLException
 
 - 
getPackagePathprotected java.lang.String getPackagePath(java.lang.String packageName) Converts a Java package name to a path that can be looked up with a call toClassLoader.getResources(String).- Parameters:
- packageName- The Java package name to convert to a path
 
 - 
isJarprotected boolean isJar(java.net.URL url) Returns true if the resource located at the given URL is a JAR file.- Parameters:
- url- The URL of the resource to test.
 
 - 
isJarprotected boolean isJar(java.net.URL url, byte[] buffer)Returns true if the resource located at the given URL is a JAR file.- Parameters:
- url- The URL of the resource to test.
- buffer- A buffer into which the first few bytes of the resource are read. The buffer must be at least the size of- JAR_MAGIC. (The same buffer may be reused for multiple calls as an optimization.)
 
 
- 
 
-