Java Doc for ResourceUtils.java in  » J2EE » spring-framework-2.0.6 » org » springframework » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.util.ResourceUtils

ResourceUtils
abstract public class ResourceUtils (Code)
Utility methods for resolving resource locations to files in the file system. Mainly for internal use within the framework.

Consider using Spring's Resource abstraction in the core package for handling all kinds of file resources in a uniform manner. org.springframework.core.io.ResourceLoader 's getResource method can resolve any location to a org.springframework.core.io.Resource object, which in turn allows to obtain a java.io.File in the file system through its getFile() method.

The main reason for these utility methods for resource location handling is to support Log4jConfigurer , which must be able to resolve resource locations before the logging system has been initialized. Spring' Resource abstraction in the core package, on the other hand, already expects the logging system to be available.
author:
   Juergen Hoeller
since:
   1.1.5
See Also:   org.springframework.core.io.Resource
See Also:   org.springframework.core.io.ClassPathResource
See Also:   org.springframework.core.io.FileSystemResource
See Also:   org.springframework.core.io.UrlResource
See Also:   org.springframework.core.io.ResourceLoader



Field Summary
final public static  StringCLASSPATH_URL_PREFIX
    
final public static  StringFILE_URL_PREFIX
    
final public static  StringJAR_URL_SEPARATOR
    
final public static  StringURL_PROTOCOL_FILE
    
final public static  StringURL_PROTOCOL_JAR
    
final public static  StringURL_PROTOCOL_WSJAR
    
final public static  StringURL_PROTOCOL_ZIP
    


Method Summary
public static  URLextractJarFileURL(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  FilegetFile(String resourceLocation)
     Resolve the given resource location to a java.io.File, i.e.
public static  FilegetFile(URL resourceUrl)
     Resolve the given resource URL to a java.io.File, i.e.
public static  FilegetFile(URL resourceUrl, String description)
     Resolve the given resource URL to a java.io.File, i.e.
public static  URLgetURL(String resourceLocation)
     Resolve the given resource location to a java.net.URL.
public static  booleanisJarURL(URL url)
     Determine whether the given URL points to a resource in a jar file, that is, has protocol "jar", "zip" or "wsjar".
public static  booleanisUrl(String resourceLocation)
     Return whether the given resource location is a URL: either a special "classpath" pseudo URL or a standard URL.

Field Detail
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_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"





Method Detail
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



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" or "wsjar".

"zip" and "wsjar" are used by BEA WebLogic Server and IBM WebSphere, respectively, but can be treated like jar files.
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



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.