Class ResourceLocator
java.lang.Object
org.ofdrw.reader.ResourceLocator
资源定位器
通过给与的资源地址获取对应的资源文件或对象
- Since:
- 2020-04-08 20:05:14
- Author:
- 权观宇
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription改变目录 Change Directorycd(LinkedList<String> workDir, String path) 改变目录 Change Directorycd(VirtualContainer vc) 切换到制定的虚拟容器目录下booleandirExit(LinkedList<String> workDir) 判断路径是否存在boolean路径是否存在booleanexist(LinkedList<String> workDir) 判断路径是否存在<R> R根据路径获取获取对应的资源对象<R> R根据路径获取获取对应的资源对象获取以当前路径为基础的容器内绝对路径getContainer(String containerPath) 根据路径获取虚拟容器对象getContainer(LinkedList<String> workDir) 通过路径获取容器获取路径下的文件获取路径下的文件pwd()打印工作目录 Print Work Directory打印工作目录 Print Work Directoryrestore()还原原有工作区restWd()重置工作路径save()保存当前工作路径toAbsolutePath(String path) 路径转换为绝对路径toAbsolutePath(ST_Loc path) 转换路径对象为绝对路径字符串toString()
-
Field Details
-
PtDoc
路径匹配正则列表 -
PtSigns
-
PtSign
-
PtPages
-
PtPage
-
PtPageRes
-
PtDocRes
-
-
Constructor Details
-
ResourceLocator
-
ResourceLocator
通过虚拟容器创建资源加载器 创建资源加载器的同时切换路径至虚拟容器的目录- Parameters:
vc- 虚拟容器
-
-
Method Details
-
save
-
restore
-
toAbsolutePath
-
toAbsolutePath
-
restWd
-
cd
-
cd
改变目录 Change Directory- Parameters:
path- 路径位置- Returns:
- this
- Throws:
ErrorPathException- 路径不存在
-
cd
改变目录 Change Directory路径最后如果是目录也不加 "/"
- Parameters:
workDir- 已有工作目录path- 路径位置- Returns:
- this
- Throws:
ErrorPathException- 路径不存在
-
exist
-
exist
判断路径是否存在- Parameters:
workDir- 路径集合- Returns:
- true -存在,false - 不存在
-
dirExit
判断路径是否存在- Parameters:
workDir- 工作路径- Returns:
- true -存在,false - 不存在
-
pwd
-
pwd
-
getAbsTo
-
get
public <R> R get(ST_Loc loc, Function<org.dom4j.Element, R> mapper) throws FileNotFoundException, org.dom4j.DocumentException 根据路径获取获取对应的资源对象- Type Parameters:
R- 映射对象- Parameters:
loc- 路径地址mapper- 对象映射构造器- Returns:
- 对象
- Throws:
FileNotFoundException- 文件不存在org.dom4j.DocumentException- 文件解析异常
-
get
public <R> R get(String loc, Function<org.dom4j.Element, R> mapper) throws FileNotFoundException, org.dom4j.DocumentException 根据路径获取获取对应的资源对象- Type Parameters:
R- 映射对象- Parameters:
loc- 路径地址mapper- 对象映射构造器- Returns:
- 对象
- Throws:
FileNotFoundException- 文件不存在org.dom4j.DocumentException- 文件解析异常
-
getFile
获取路径下的文件- Parameters:
stLoc- 路径- Returns:
- 系统文件路径
- Throws:
FileNotFoundException- 文件或路径不存在
-
getFile
获取路径下的文件- Parameters:
loc- 路径- Returns:
- 系统文件路径
- Throws:
FileNotFoundException- 文件或路径不存在
-
getContainer
通过路径获取容器- Parameters:
workDir- 路径序列- Returns:
- 虚拟容器
- Throws:
FileNotFoundException- 路径不存在
-
getContainer
根据路径获取虚拟容器对象获取的同时会缓存整个容器链路
- Parameters:
containerPath- 容器目录- Returns:
- 虚拟容器
- Throws:
FileNotFoundException- 路径不存在
-
toString
-