public class ResourceLocator extends Object
通过给与的资源地址获取对应的资源文件或对象
| 限定符和类型 | 字段和说明 |
|---|---|
static Pattern |
PtDoc
路径匹配正则列表
|
static Pattern |
PtDocRes |
static Pattern |
PtPage |
static Pattern |
PtPageRes |
static Pattern |
PtPages |
static Pattern |
PtSign |
static Pattern |
PtSigns |
| 构造器和说明 |
|---|
ResourceLocator(OFDDir ofdDir) |
ResourceLocator(VirtualContainer vc)
通过虚拟容器创建资源加载器
创建资源加载器的同时切换路径至虚拟容器的目录
|
| 限定符和类型 | 方法和说明 |
|---|---|
ResourceLocator |
cd(LinkedList<String> workDir,
String path)
改变目录 Change Directory
路径最后如果是目录也不加 "/"
|
ResourceLocator |
cd(String path)
改变目录 Change Directory
|
ResourceLocator |
cd(VirtualContainer vc)
切换到制定的虚拟容器目录下
|
boolean |
dirExit(LinkedList<String> workDir)
判断路径是否存在
|
boolean |
exist(LinkedList<String> workDir)
判断路径是否存在
|
boolean |
exist(String path)
路径是否存在
|
<R> R |
get(ST_Loc loc,
Function<org.dom4j.Element,R> mapper)
根据路径获取获取对应的资源对象
|
<R> R |
get(String loc,
Function<org.dom4j.Element,R> mapper)
根据路径获取获取对应的资源对象
|
ST_Loc |
getAbsTo(ST_Loc to)
获取以当前路径为基础的容器内绝对路径
|
VirtualContainer |
getContainer(LinkedList<String> workDir)
通过路径获取容器
|
VirtualContainer |
getContainer(String containerPath)
根据路径获取虚拟容器对象
获取的同时会缓存整个容器链路
|
Path |
getFile(ST_Loc stLoc)
获取路径下的文件
|
Path |
getFile(String loc)
获取路径下的文件
|
String |
pwd()
打印工作目录 Print Work Directory
路径最后如果是目录也不加 "/"
|
String |
pwd(List<String> workDir)
打印工作目录 Print Work Directory
|
ResourceLocator |
restore()
还原原有工作区
如果没有保存过工作区,那么不会造成任何影响
|
ResourceLocator |
restWd()
重置工作路径
重置后将回到根路径
|
ResourceLocator |
save()
保存当前工作路径
|
String |
toAbsolutePath(ST_Loc path)
转换路径对象为绝对路径字符串
|
String |
toAbsolutePath(String path)
路径转换为绝对路径
|
String |
toString() |
public static Pattern PtDoc
public static Pattern PtSigns
public static Pattern PtSign
public static Pattern PtPages
public static Pattern PtPage
public static Pattern PtPageRes
public static Pattern PtDocRes
public ResourceLocator(OFDDir ofdDir)
public ResourceLocator(VirtualContainer vc)
vc - 虚拟容器public ResourceLocator save()
public ResourceLocator restore()
如果没有保存过工作区,那么不会造成任何影响
public ResourceLocator restWd()
重置后将回到根路径
public ResourceLocator cd(VirtualContainer vc)
vc - 虚拟容器public ResourceLocator cd(String path)
path - 路径位置ErrorPathException - 路径不存在public ResourceLocator cd(LinkedList<String> workDir, String path)
路径最后如果是目录也不加 "/"
path - 路径位置workDir - 已有工作目录ErrorPathException - 路径不存在public boolean exist(String path)
path - 末端路径public boolean exist(LinkedList<String> workDir)
workDir - 路径集合public boolean dirExit(LinkedList<String> workDir)
workDir - 工作路径public String pwd()
路径最后如果是目录也不加 "/"
public String pwd(List<String> workDir)
workDir - 工作目录public <R> R get(ST_Loc loc, Function<org.dom4j.Element,R> mapper) throws FileNotFoundException, org.dom4j.DocumentException
R - 映射对象loc - 路径地址mapper - 对象映射构造器FileNotFoundException - 文件不存在org.dom4j.DocumentException - 文件解析异常public <R> R get(String loc, Function<org.dom4j.Element,R> mapper) throws FileNotFoundException, org.dom4j.DocumentException
R - 映射对象loc - 路径地址mapper - 对象映射构造器FileNotFoundException - 文件不存在org.dom4j.DocumentException - 文件解析异常public Path getFile(ST_Loc stLoc) throws FileNotFoundException
stLoc - 路径FileNotFoundException - 文件或路径不存在public Path getFile(String loc) throws FileNotFoundException
loc - 路径FileNotFoundException - 文件或路径不存在public VirtualContainer getContainer(LinkedList<String> workDir) throws FileNotFoundException
workDir - 路径序列FileNotFoundException - 路径不存在public VirtualContainer getContainer(String containerPath) throws FileNotFoundException
获取的同时会缓存整个容器链路
containerPath - 容器目录FileNotFoundException - 路径不存在Copyright © 2024. All rights reserved.