当前位置: 首页 > wzjs >正文

开发网站步骤app推广方式

开发网站步骤,app推广方式,微信公众平台小程序怎么发布,做婚纱的网站Resource Resource 接口为处理和访问不同类型资源(如文件、URL、输入流等)提供了统一的 API,支持资源的存在性检查、读取、转换等操作。 public interface Resource extends InputStreamSource {boolean exists();default boolean isReadable…

Resource

Resource 接口为处理和访问不同类型资源(如文件、URL、输入流等)提供了统一的 API,支持资源的存在性检查、读取、转换等操作。

public interface Resource extends InputStreamSource {boolean exists();default boolean isReadable() {return exists();}default boolean isOpen() {return false;}default boolean isFile() {return false;}URL getURL() throws IOException;URI getURI() throws IOException;File getFile() throws IOException;default ReadableByteChannel readableChannel() throws IOException {return Channels.newChannel(getInputStream());}default byte[] getContentAsByteArray() throws IOException {return FileCopyUtils.copyToByteArray(getInputStream());}default String getContentAsString(Charset charset) throws IOException {return FileCopyUtils.copyToString(new InputStreamReader(getInputStream(), charset));}long contentLength() throws IOException;long lastModified() throws IOException;Resource createRelative(String relativePath) throws IOException;@NullableString getFilename();String getDescription();}
public interface InputStreamSource {InputStream getInputStream() throws IOException;
}
实现类描述
UrlResource用于封装 java.net.URL,可以访问任何通过 URL 访问的资源,如文件、HTTPS、FTP 等。
ClassPathResource用于从类路径加载资源,支持使用类加载器或特定类来加载资源。
FileSystemResource基于 java.io.File 的实现,支持文件系统路径,采用 Java NIO API 进行操作。
PathResource基于 java.nio.file.Path 的实现,采用 NIO API,支持文件和 URL 解析,且实现了 WritableResource 接口。
ServletContextResource用于 ServletContext 资源,解析相对路径并在 Web 应用的根目录下查找资源。
InputStreamResource封装已打开的 InputStream,适用于流式访问已打开的资源,避免多次读取。
ByteArrayResource基于给定字节数组的实现,通过 ByteArrayInputStream 来加载内容,适合加载内存中的数据。

ResourceLoader

ResourceLoader 接口用于资源加载策略,通常在 Spring 应用中用于加载文件、类路径或其他类型的资源。它的子接口和实现类则为其功能扩展,支持不同类型的应用上下文或资源解析需求。|

public interface ResourceLoader {/** Pseudo URL prefix for loading from the class path: "classpath:". */String CLASSPATH_URL_PREFIX = ResourceUtils.CLASSPATH_URL_PREFIX;Resource getResource(String location);@NullableClassLoader getClassLoader();}

DefaultResourceLoader

DefaultResourceLoader 是 Spring 中用于加载各种类型资源的默认实现,支持通过类路径、文件系统、URL 等方式加载,并允许扩展协议解析器。

// Direct Known Subclasses:
// AbstractApplicationContext, ClassRelativeResourceLoader, FileSystemResourceLoader, ServletContextResourceLoader
public class DefaultResourceLoader implements ResourceLoader {@Nullableprivate ClassLoader classLoader;private final Set<ProtocolResolver> protocolResolvers = new LinkedHashSet<>(4);private final Map<Class<?>, Map<Resource, ?>> resourceCaches = new ConcurrentHashMap<>(4);public DefaultResourceLoader() {}public DefaultResourceLoader(@Nullable ClassLoader classLoader) {this.classLoader = classLoader;}public void addProtocolResolver(ProtocolResolver resolver) {Assert.notNull(resolver, "ProtocolResolver must not be null");this.protocolResolvers.add(resolver);}@SuppressWarnings("unchecked")public <T> Map<Resource, T> getResourceCache(Class<T> valueType) {return (Map<Resource, T>) this.resourceCaches.computeIfAbsent(valueType, key -> new ConcurrentHashMap<>());}public void clearResourceCaches() {this.resourceCaches.clear();}@Overridepublic Resource getResource(String location) {Assert.notNull(location, "Location must not be null");for (ProtocolResolver protocolResolver : getProtocolResolvers()) {Resource resource = protocolResolver.resolve(location, this);if (resource != null) {return resource;}}if (location.startsWith("/")) {return getResourceByPath(location);}else if (location.startsWith(CLASSPATH_URL_PREFIX)) {return new ClassPathResource(location.substring(CLASSPATH_URL_PREFIX.length()), getClassLoader());}else {try {// Try to parse the location as a URL...URL url = ResourceUtils.toURL(location);return (ResourceUtils.isFileURL(url) ? new FileUrlResource(url) : new UrlResource(url));}catch (MalformedURLException ex) {// No URL -> resolve as resource path.return getResourceByPath(location);}}}protected Resource getResourceByPath(String path) {return new ClassPathContextResource(path, getClassLoader());}protected static class ClassPathContextResource extends ClassPathResource implements ContextResource {public ClassPathContextResource(String path, @Nullable ClassLoader classLoader) {super(path, classLoader);}@Overridepublic String getPathWithinContext() {return getPath();}@Overridepublic Resource createRelative(String relativePath) {String pathToUse = StringUtils.applyRelativePath(getPath(), relativePath);return new ClassPathContextResource(pathToUse, getClassLoader());}}
}

ResourcePatternResolver

ResourcePatternResolverResourceLoader 的扩展接口,提供了通过模式(如 Ant 风格路径)解析位置并返回 Resource 对象的功能。它支持 classpath*: 前缀来获取类路径和模块路径中所有匹配的资源。

// "classpath:META-INF/config.xml" 只匹配 第一个 META-INF/config.xml
// "classpath*:META-INF/config.xml" 匹配 所有 JAR 包 和 所有 META-INF 目录 下的 config.xml// PathMatchingResourcePatternResolver
public interface ResourcePatternResolver extends ResourceLoader {String CLASSPATH_ALL_URL_PREFIX = "classpath*:";Resource[] getResources(String locationPattern) throws IOException;}

ResourceLoaderAware

ResourceLoaderAware 接口允许对象在 Spring 容器中获取并使用 ResourceLoader 来加载资源。

public interface ResourceLoaderAware {void setResourceLoader(ResourceLoader resourceLoader);
}

·

http://www.dtcms.com/wzjs/242400.html

相关文章:

  • 大学生javascript心得体会西安网站seo厂家
  • 海宁网站制作百度广告推广平台
  • 怎么做自助提卡网站明星百度指数排行
  • 做一家网站需要多少钱广州全网推广
  • 网站建设考虑哪些因素百度营销后台
  • 怎么用手机做网站教程中国seo公司
  • 有没有帮别人做网站网络广告策划书
  • 购物网站源码宁阳网站seo推广
  • 行业网站建设哪家好网店seo
  • 重庆seo网站运营搜索引擎优化理解
  • 有那些专门做财务分析的网站学生网页设计模板
  • 郑州网站制作工作室免费换友情链接
  • 做私彩网站多少钱网站推广优化价格
  • 合理的网站结构电商网站建设步骤
  • 唐山网站建设自主开发线上推广的方式
  • 网站评价及优化分析报告必应搜索引擎怎么样
  • 常熟市做网站公司今日新闻头条新闻今天
  • dw代码做网站百度数据指数
  • 婺源做网站淘宝宝贝排名查询
  • 常州外贸集团 网站建设seo1域名查询
  • 专业网站建设制网站推广的营销策划方案
  • win10建设本地网站公司网站制作流程
  • 发布页全部页面设计seo搜索引擎优化主要做什么
  • 网站如何管理批量关键词排名查询工具
  • 怎么建设一个淘宝客网站谁知道企业网站建设方案论文
  • 什么网站做一手项目好网页制作成品
  • 河南化工厂福州排名seo公司
  • 电脑网站滚动字幕怎么做如何做线上营销
  • 做网站后端信息发布推广平台
  • 专业郑州做网站百度统计数据分析