public class ResourceUtils extends Object
限定符和类型 | 字段和说明 |
---|---|
static String |
CLASSPATH_ALL_URL_PREFIX
Pseudo URL prefix for all matching resources from the class path: "classpath*:"
This differs from ResourceLoader's classpath URL prefix in that it retrieves all matching
resources for a given name (e.g.
|
static String |
CLASSPATH_URL_PREFIX
Pseudo URL prefix for loading from the class path: "classpath:"
|
static String |
CONTEXTPATH_URL_PREFIX
Pseudo URL prefix for loading from the ServletContext relative file path,
e.g.
|
static String |
LOCAL_FILE_URL_PREFIX
Pseudo URL prefix for loading from local file system file path, e.g. file:C:/test.dat
|
构造器和说明 |
---|
ResourceUtils() |
public static final String CONTEXTPATH_URL_PREFIX
org.zollty.util.resource.web.ServletContextResource
,
javax.servlet.ServletContext
,
常量字段值public static final String LOCAL_FILE_URL_PREFIX
public static final String CLASSPATH_URL_PREFIX
public static final String CLASSPATH_ALL_URL_PREFIX
public static Resource getResource(ClassLoader classLoader, String location)
public static Resource getResource(ResourceLoader resourceLoader, String location)
public static FileSystemResource getFileSystemResource(String path)
public static ClassPathResource getClassPathResource(String path)
public static ClassPathResource getClassPathResource(String path, ClassLoader classLoader)
public static UrlResource getUrlResource(String path) throws IOException
IOException
public static Resource[] getResourcesByPathMatchingResolver(String locationPattern) throws IOException
IOException
public static Resource[] getResourcesByPathMatchingResolver(String locationPattern, ClassLoader classLoader) throws IOException
IOException
public static Resource[] getResourcesByPathMatchingResolver(String locationPattern, ResourceLoader resourceLoader) throws IOException
IOException
public static Resource[] getResources(String locationPattern, ResourcePatternResolver resPatternLoader) throws IOException
IOException
public static InputStream getInputStreamFromJar(Class<?> jarClazz, String resourcePath) throws NestedCheckedException
jarClazz
- resourcePath
- 资源文件的相对路径(比如 FS_RQ.xsd,比如 com/zollty/config/FS_RQ.xsd)NestedCheckedException
public static InputStream getInputStreamFromClassPath(ClassLoader classLoader, String resourcePath) throws NestedCheckedException
classLoader
- resourcePath
- 相对路径NestedCheckedException
public static URL getResourceFromJar(Class<?> jarClazz, String resourcePath) throws NestedCheckedException
jarClazz
- resourcePath
- 相对路径NestedCheckedException
public static Properties getProperties(InputStream in)
Copyright © 2018 jretty-org. All rights reserved.