| 构造器和说明 |
|---|
VirtualContainer(Path fullDir)
通过完整路径构造一个虚拟容器
|
VirtualContainer(Path parent,
String dirName)
创建一个虚拟容器
|
| 限定符和类型 | 方法和说明 |
|---|---|
VirtualContainer |
addRaw(String fileName,
InputStream in)
向虚拟容器中直接加入流类型资源
根据提供文件名称创建文件
输入流内容将直接写入文件内,不做检查
若文件已经存在,那么将会覆盖原文件!
|
void |
clean()
删除整个虚拟容器
|
void |
close() |
boolean |
exist(String fileName)
判断文件或对象是否存在
|
boolean |
exit(String fileName)
已过时。
|
void |
flush()
将缓存中的对象写入到文件系统中
|
VirtualContainer |
flushContainerByName(String name)
从缓存中刷新指定容器到文件系统中
|
VirtualContainer |
flushFileByName(String name)
从缓存将指定对象写入到文件系统中
|
ST_Loc |
getAbsLoc()
获取在容器中的绝对路径
|
<R extends VirtualContainer> |
getContainer(String name,
Function<Path,R> mapper)
获取虚拟容器
|
String |
getContainerName()
获取虚拟容器的名称
|
Path |
getContainerPath()
获取虚拟容器所处的文件系统路径
|
Path |
getFile(String fileName)
获取容器中的文件对象
|
org.dom4j.Element |
getObj(String fileName)
通过文件名获取元素对象
|
VirtualContainer |
getParent()
获取该容器所属容器
|
String |
getSysAbsPath()
获取当前容器完整路径
|
<R extends VirtualContainer> |
obtainContainer(String name,
Function<Path,R> mapper)
获取一个虚拟容器对象
如果容器存在,那么取出元素
如果容器不存在,那么创建一个新的对象
|
VirtualContainer |
putFile(Path file)
向虚拟容器中加入文件
|
Path |
putFileWithPath(Path file)
向虚拟容器中加入文件,并获取文件在容器中的绝对路径
|
VirtualContainer |
putObj(String fileName,
org.dom4j.Element element)
向虚拟容器加入对象
|
protected VirtualContainer |
setParent(VirtualContainer parent)
设置所属容器
|
public VirtualContainer(Path fullDir) throws IllegalArgumentException
fullDir - 容器完整路径IllegalArgumentException - 参数错误public VirtualContainer(Path parent, String dirName) throws IllegalArgumentException
parent - 根目录dirName - 新建目录的名称IllegalArgumentException - 参数异常public String getContainerName()
public String getSysAbsPath()
public VirtualContainer putFile(Path file) throws IOException
file - 文件路径对象IOException - IO异常public Path putFileWithPath(Path file) throws IOException
file - 文件路径对象IOException - IO异常public VirtualContainer addRaw(String fileName, InputStream in) throws IOException
根据提供文件名称创建文件
输入流内容将直接写入文件内,不做检查
若文件已经存在,那么将会覆盖原文件!
fileName - 文件名称in - 输入流,流的关闭应由调用者负责IOException - 文件复制异常public VirtualContainer putObj(String fileName, org.dom4j.Element element)
fileName - 文件名element - 元素对象public org.dom4j.Element getObj(String fileName) throws FileNotFoundException, org.dom4j.DocumentException
fileName - 文件名FileNotFoundException - 文件不存在org.dom4j.DocumentException - 元素序列化异常public Path getFile(String fileName) throws FileNotFoundException
fileName - 文件名称FileNotFoundException - 文件不存在public <R extends VirtualContainer> R obtainContainer(String name, Function<Path,R> mapper)
如果容器存在,那么取出元素
如果容器不存在,那么创建一个新的对象
R - 容器子类name - 容器名称mapper - 容器构造器引用public <R extends VirtualContainer> R getContainer(String name, Function<Path,R> mapper) throws FileNotFoundException
R - 容器子类name - 容器名称mapper - 容器构造器引用FileNotFoundException - 文件不存在public VirtualContainer getParent()
protected VirtualContainer setParent(VirtualContainer parent)
parent - 容器public Path getContainerPath()
@Deprecated public boolean exit(String fileName)
exist(String)fileName - 文件名称public boolean exist(String fileName)
fileName - 文件名称public void clean()
public void flush()
throws IOException
IOException - 文件读写IO异常public VirtualContainer flushContainerByName(String name) throws IOException
name - 容器名称IOException - 写入文件IO异常public VirtualContainer flushFileByName(String name) throws IOException
name - 文件名称IOException - 写入文件IO异常public ST_Loc getAbsLoc()
public void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2023. All rights reserved.