public class ClassPathResource extends AbstractResource
| 限定符 | 构造器和说明 |
|---|---|
|
ClassPathResource(java.lang.String path)
Create a new ClassPathResource for ClassLoader usage.
|
|
ClassPathResource(java.lang.String path,
java.lang.Class clazz)
Create a new ClassPathResource for Class usage.
|
|
ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader)
Create a new ClassPathResource for ClassLoader usage.
|
protected |
ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader,
java.lang.Class clazz)
Create a new ClassPathResource with optional ClassLoader and Class.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(java.lang.Object obj)
compares the underlying class path locations.
|
java.lang.ClassLoader |
getClassLoader()
Return the ClassLoader that this resource will be obtained from.
|
java.io.File |
getFile()
This implementation returns a File reference for the underlying class path
resource, provided that it refers to a file in the file system.
|
protected java.io.File |
getFile2Check()
This implementation determines the underlying File
(or jar file, in case of a resource in a jar/zip).
|
java.io.InputStream |
getInputStream()
This implementation opens an InputStream for the given class path resource.
|
java.io.OutputStream |
getOutputStream() |
java.lang.String |
getPath()
Return the path for this resource (as resource path within the class path).
|
java.lang.String |
getResourceLocation() |
java.lang.String |
getResourceName()
returns the name of the file that this class path
resource refers to.
|
java.net.URL |
getURL()
This implementation returns a URL for the underlying class path resource.
|
int |
hashCode() |
exists, getURI, isReadable, lastModified, toStringpublic ClassPathResource(java.lang.String path)
The thread context class loader will be used for loading the resource.
path - the absolute path within the class pathpublic ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader)
path - the absolute path within the classpathclassLoader - the class loader to load the resource with,
or null for the thread context class loaderpublic ClassPathResource(java.lang.String path,
java.lang.Class clazz)
path - relative or absolute path within the class pathclazz - the class to load resources withprotected ClassPathResource(java.lang.String path,
java.lang.ClassLoader classLoader,
java.lang.Class clazz)
path - relative or absolute path within the classpathclassLoader - the class loader to load the resource with, if anyclazz - the class to load resources with, if anypublic final java.lang.String getPath()
public final java.lang.ClassLoader getClassLoader()
public java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic java.net.URL getURL()
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getFile()
throws java.io.IOException
java.io.IOExceptionprotected java.io.File getFile2Check()
throws java.io.IOException
getFile2Check 在类中 AbstractResourcejava.io.IOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systempublic java.lang.String getResourceName()
public java.lang.String getResourceLocation()
public boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Objectpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOExceptionCopyright © 2024. All Rights Reserved.