## 接口的使用
org.springframework.core.io.Resource

- 使用Resource的程序包
  程序包 | 说明
  --- | ---
  org.springframework.core.codec | `Encoder` and `Decoder` abstractions to convert between a reactive stream of bytes and Java objects.
  org.springframework.core.io | Generic abstraction for (file-based) resources, used throughout the framework.
  org.springframework.core.io.buffer | Generic abstraction for working with byte buffer implementations.
  org.springframework.core.io.support | Support classes for Spring's resource abstraction.
  org.springframework.core.type.classreading | Support classes for reading annotation and class-level metadata.

- - ### org.springframework.core.codec中Resource的使用

    返回Resource的org.springframework.core.codec中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Resource` | ResourceDecoder.`decodeDataBuffer(DataBuffer dataBuffer, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)`

    返回变量类型为Resource的类型的org.springframework.core.codec中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `reactor.core.publisher.Flux<Resource>` | ResourceDecoder.`decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)`

    参数类型为Resource的org.springframework.core.codec中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected reactor.core.publisher.Flux<DataBuffer>` | ResourceEncoder.`encode(Resource resource, DataBufferFactory dataBufferFactory, ResolvableType type, MimeType mimeType, Map<String,Object> hints)`

  - ### org.springframework.core.io中Resource的使用

    org.springframework.core.io中Resource的子接口
    限定符和类型 | 接口和说明
    --- | ---
    `interface` | `ContextResource` Extended interface for a resource that is loaded from an enclosing 'context', e.g. from a `ServletContext` but also from plain classpath paths or relative file system paths (specified without an explicit prefix, hence applying relative to the local `ResourceLoader`'s context).
    `interface` | `WritableResource` Extended interface for a resource that supports writing to it.

    实现Resource的org.springframework.core.io中的类
    限定符和类型 | 类和说明
    --- | ---
    `class` | `AbstractFileResolvingResource` Abstract base class for resources which resolve URLs into File references, such as `UrlResource` or `ClassPathResource`.
    `class` | `AbstractResource` Convenience base class for `Resource` implementations, pre-implementing typical behavior.
    `class` | `ByteArrayResource` `Resource` implementation for a given byte array.
    `class` | `ClassPathResource` `Resource` implementation for class path resources.
    `protected static class` | `DefaultResourceLoader.ClassPathContextResource` ClassPathResource that explicitly expresses a context-relative path through implementing the ContextResource interface.
    `class` | `DescriptiveResource` Simple `Resource` implementation that holds a resource description but does not point to an actually readable resource.
    `class` | `FileSystemResource` `Resource` implementation for `java.io.File` handles.
    `class` | `FileUrlResource` Subclass of `UrlResource` which assumes file resolution, to the degree of implementing the `WritableResource` interface for it.
    `class` | `InputStreamResource` `Resource` implementation for a given `InputStream`.
    `class` | `PathResource` `Resource` implementation for `java.nio.file.Path` handles.
    `class` | `UrlResource` `Resource` implementation for `java.net.URL` locators.
    `class` | `VfsResource` JBoss VFS based `Resource` implementation.

    返回Resource的org.springframework.core.io中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `Resource` | AbstractResource.`createRelative(String relativePath)` This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.
    `Resource` | ClassPathResource.`createRelative(String relativePath)` This implementation creates a ClassPathResource, applying the given path relative to the path of the underlying resource of this descriptor.
    `Resource` | DefaultResourceLoader.ClassPathContextResource.`createRelative(String relativePath)`
    `Resource` | FileSystemResource.`createRelative(String relativePath)` This implementation creates a FileSystemResource, applying the given path relative to the path of the underlying file of this resource descriptor.
    `Resource` | FileUrlResource.`createRelative(String relativePath)`
    `Resource` | PathResource.`createRelative(String relativePath)` This implementation creates a PathResource, applying the given path relative to the path of the underlying file of this resource descriptor.
    `Resource` | Resource.`createRelative(String relativePath)` Create a resource relative to this resource.
    `Resource` | UrlResource.`createRelative(String relativePath)` This implementation creates a `UrlResource`, applying the given path relative to the path of the underlying URL of this resource descriptor.
    `Resource` | VfsResource.`createRelative(String relativePath)`
    `Resource` | DefaultResourceLoader.`getResource(String location)`
    `Resource` | ResourceLoader.`getResource(String location)` Return a Resource handle for the specified resource location.
    `protected Resource` | ClassRelativeResourceLoader.`getResourceByPath(String path)`
    `protected Resource` | DefaultResourceLoader.`getResourceByPath(String path)` Return a Resource handle for the resource at the given path.
    `protected Resource` | FileSystemResourceLoader.`getResourceByPath(String path)` Resolve resource paths as file system paths.
    `Resource` | ProtocolResolver.`resolve(String location, ResourceLoader resourceLoader)` Resolve the given location against the given resource loader if this implementation's protocol matches.

    返回变量类型为Resource的类型的org.springframework.core.io中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `<T> Map<Resource,T>` | DefaultResourceLoader.`getResourceCache(Class<T> valueType)` Obtain a cache for the given value type, keyed by `Resource`.

  - ### org.springframework.core.io.buffer中Resource的使用

    参数类型为Resource的org.springframework.core.io.buffer中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `static reactor.core.publisher.Flux<DataBuffer>` | DataBufferUtils.`read(Resource resource, DataBufferFactory dataBufferFactory, int bufferSize)` Read the given `Resource` into a `Flux` of `DataBuffer`s.
    `static reactor.core.publisher.Flux<DataBuffer>` | DataBufferUtils.`read(Resource resource, long position, DataBufferFactory dataBufferFactory, int bufferSize)` Read the given `Resource` into a `Flux` of `DataBuffer`s starting at the given position.

  - ### org.springframework.core.io.support中Resource的使用

    返回Resource的org.springframework.core.io.support中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Resource` | PathMatchingResourcePatternResolver.`convertClassLoaderURL(URL url)` Convert the given URL as returned from the ClassLoader into a `Resource`.
    `protected Resource[]` | PathMatchingResourcePatternResolver.`findAllClassPathResources(String location)` Find all class location resources with the given location via the ClassLoader.
    `Resource` | LocalizedResourceHelper.`findLocalizedResource(String name, String extension, Locale locale)` Find the most specific localized resource for the given name, extension and locale: The file will be searched with locations in the following order, similar to `java.util.ResourceBundle`'s search order: [name]_[language]_[country]_[variant][extension] [name]_[language]_[country][extension] [name]_[language][extension] [name][extension] If none of the specific files can be found, a resource descriptor for the default location will be returned.
    `protected Resource[]` | PathMatchingResourcePatternResolver.`findPathMatchingResources(String locationPattern)` Find all resources that match the given location pattern via the Ant-style PathMatcher.
    `Resource` | EncodedResource.`getResource()` Return the `Resource` held by this `EncodedResource`.
    `Resource` | ResourceRegion.`getResource()` Return the underlying `Resource` for this `ResourceRegion`
    `Resource` | PathMatchingResourcePatternResolver.`getResource(String location)`
    `Resource[]` | PathMatchingResourcePatternResolver.`getResources(String locationPattern)`
    `Resource[]` | ResourcePatternResolver.`getResources(String locationPattern)` Resolve the given location pattern into Resource objects.
    `protected Resource` | PathMatchingResourcePatternResolver.`resolveRootDirResource(Resource original)` Resolve the specified resource for path matching.

    返回变量类型为Resource的类型的org.springframework.core.io.support中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindAllClassPathResources(String path)` Find all class location resources with the given path via the ClassLoader.
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindMatchingFileSystemResources(File rootDir, String subPattern)` Find all resources in the file system that match the given location pattern via the Ant-style PathMatcher.
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindPathMatchingFileResources(Resource rootDirResource, String subPattern)` Find all resources in the file system that match the given location pattern via the Ant-style PathMatcher.
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindPathMatchingJarResources(Resource rootDirResource, URL rootDirURL, String subPattern)` Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher.

    参数类型为Resource的org.springframework.core.io.support中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindPathMatchingFileResources(Resource rootDirResource, String subPattern)` Find all resources in the file system that match the given location pattern via the Ant-style PathMatcher.
    `protected Set<Resource>` | PathMatchingResourcePatternResolver.`doFindPathMatchingJarResources(Resource rootDirResource, URL rootDirURL, String subPattern)` Find all resources in jar files that match the given location pattern via the Ant-style PathMatcher.
    `static void` | PropertiesLoaderUtils.`fillProperties(Properties props, Resource resource)` Fill the given properties from the given resource (in ISO-8859-1 encoding).
    `protected boolean` | PathMatchingResourcePatternResolver.`isJarResource(Resource resource)` Return whether the given resource handle indicates a jar resource that the `doFindPathMatchingJarResources` method can handle.
    `static Properties` | PropertiesLoaderUtils.`loadProperties(Resource resource)` Load properties from the given resource (in ISO-8859-1 encoding).
    `protected Resource` | PathMatchingResourcePatternResolver.`resolveRootDirResource(Resource original)` Resolve the specified resource for path matching.
    `void` | PropertiesLoaderSupport.`setLocation(Resource location)` Set a location of a properties file to be loaded.
    `void` | PropertiesLoaderSupport.`setLocations(Resource... locations)` Set locations of properties files to be loaded.

    类型变量类型为Resource的org.springframework.core.io.support中的方法参数
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | PathMatchingResourcePatternResolver.`addAllClassLoaderJarRoots(ClassLoader classLoader, Set<Resource> result)` Search all `URLClassLoader` URLs for jar file references and add them to the given set of resources in the form of pointers to the root of the jar file content.
    `protected void` | PathMatchingResourcePatternResolver.`addClassPathManifestEntries(Set<Resource> result)` Determine jar file references from the "java.class.path." manifest property and add them to the given set of resources in the form of pointers to the root of the jar file content.

    参数类型为Resource的org.springframework.core.io.support中的构造器
    构造器和说明
    `EncodedResource(Resource resource)` Create a new `EncodedResource` for the given `Resource`, not specifying an explicit encoding or `Charset`.
    `EncodedResource(Resource resource, Charset charset)` Create a new `EncodedResource` for the given `Resource`, using the specified `Charset`.
    `EncodedResource(Resource resource, String encoding)` Create a new `EncodedResource` for the given `Resource`, using the specified `encoding`.
    `ResourcePropertySource(Resource resource)` Create a PropertySource based on Properties loaded from the given resource.
    `ResourcePropertySource(String name, Resource resource)` Create a PropertySource having the given name based on Properties loaded from the given encoded resource.
    `ResourceRegion(Resource resource, long position, long count)` Create a new `ResourceRegion` from a given `Resource`.

  - ### org.springframework.core.type.classreading中Resource的使用

    返回Resource的org.springframework.core.type.classreading中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `Resource` | MetadataReader.`getResource()` Return the resource reference for the class file.

    参数类型为Resource的org.springframework.core.type.classreading中的方法
    限定符和类型 | 方法和说明
    --- | ---
    `MetadataReader` | CachingMetadataReaderFactory.`getMetadataReader(Resource resource)`
    `MetadataReader` | MetadataReaderFactory.`getMetadataReader(Resource resource)` Obtain a MetadataReader for the given resource.
    `MetadataReader` | SimpleMetadataReaderFactory.`getMetadataReader(Resource resource)`