public class LocalFileSystem extends java.lang.Object implements FileSystem
PATH_SEPARATOR, PATH_SEPARATOR_STRING| Constructor and Description |
|---|
LocalFileSystem(FrameworkAutoConfiguration.LocalFileSystemProperties properties) |
| Modifier and Type | Method and Description |
|---|---|
void |
copy(java.lang.String source,
java.lang.String destination,
boolean replaceExisting)
复制文件或目录,
PathMeta保持不变。 |
void |
createDirectory(java.lang.String path)
创建目录。目录已存在则忽略。
|
void |
delete(java.lang.String path)
删除文件或目录。
|
java.util.stream.Stream<? extends PathMeta> |
directories(java.lang.String path,
java.lang.String search,
boolean recursive,
int offset,
int limit,
PathMetaSort sort)
获取目录下子目录。
|
boolean |
exists(java.lang.String path)
检查路径是否存在。
|
java.util.stream.Stream<? extends PathMeta> |
files(java.lang.String path,
java.lang.String search,
boolean recursive,
int offset,
int limit,
PathMetaSort sort)
获取目录下文件。
|
<M extends PathMeta> |
meta(java.lang.String path)
获取路径的元信息。
|
void |
move(java.lang.String source,
java.lang.String destination,
boolean replaceExisting)
移动文件或目录,
PathMeta保持不变。 |
java.io.InputStream |
openReadStream(java.lang.String path)
用流的方式读取文件内容,调用方负责流的关闭。
|
java.io.OutputStream |
openWriteStream(java.lang.String path)
用流的方式写入文件内容,调用方负责流的关闭。
当文件不存在时会自动创建。
以Append的方式写入。
|
void |
put(java.lang.String path,
java.lang.CharSequence txt)
如果文件未存在,则创建;否则替换。
|
void |
put(java.lang.String path,
java.io.InputStream stream)
如果文件未存在,则创建;否则替换。
|
void |
touchCreation(java.lang.String path)
刷新文件或目录的
PathMeta.getCreationTime()。 |
void |
touchLastAccess(java.lang.String path)
刷新文件或目录的
PathMeta.getLastAccessTime()。 |
void |
touchLastModified(java.lang.String path)
刷新文件或目录的
PathMeta.getLastModifiedTime()。 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcopy, directories, directories, directories, directories, files, files, files, files, move, read, read, sortpublic LocalFileSystem(FrameworkAutoConfiguration.LocalFileSystemProperties properties)
public void createDirectory(java.lang.String path)
FileSystemcreateDirectory in interface FileSystempath - 路径public void put(java.lang.String path,
java.io.InputStream stream)
throws InvalidFileException
FileSystemput in interface FileSystempath - 要写入的路径stream - 输入流InvalidFileException - 无效文件public void put(java.lang.String path,
java.lang.CharSequence txt)
throws InvalidFileException
FileSystemput in interface FileSystempath - 要写入的路径txt - 输入文本InvalidFileException - 无效文件public boolean exists(java.lang.String path)
FileSystemexists in interface FileSystempath - 路径public java.io.InputStream openReadStream(java.lang.String path)
throws InvalidFileException
FileSystemopenReadStream in interface FileSystempath - 路径InvalidFileException - 无效文件public java.io.OutputStream openWriteStream(java.lang.String path)
throws InvalidFileException
FileSystemopenWriteStream in interface FileSystempath - 路径InvalidFileException - 无效文件public void move(java.lang.String source,
java.lang.String destination,
boolean replaceExisting)
throws FileSystemException
FileSystemPathMeta保持不变。move in interface FileSystemsource - 源路径destination - 目标路径replaceExisting - 如果true,替换现存的文件,否则忽略移动。PathNotFoundException - 源路径不存在FileSystemException - 文件系统操作失败public void copy(java.lang.String source,
java.lang.String destination,
boolean replaceExisting)
throws FileSystemException
FileSystemPathMeta保持不变。copy in interface FileSystemsource - 源路径destination - 目标路径replaceExisting - 如果true,替换现存的文件,否则忽略复制。PathNotFoundException - 源路径不存在FileSystemException - 文件系统操作失败public void delete(java.lang.String path)
FileSystemdelete in interface FileSystempath - 路径public void touchCreation(java.lang.String path)
FileSystemPathMeta.getCreationTime()。touchCreation in interface FileSystempath - 路径public void touchLastModified(java.lang.String path)
FileSystemPathMeta.getLastModifiedTime()。touchLastModified in interface FileSystempath - 路径public void touchLastAccess(java.lang.String path)
FileSystemPathMeta.getLastAccessTime()。touchLastAccess in interface FileSystempath - 路径public <M extends PathMeta> M meta(java.lang.String path)
FileSystemmeta in interface FileSystempath - 路径public java.util.stream.Stream<? extends PathMeta> directories(java.lang.String path, java.lang.String search, boolean recursive, int offset, int limit, PathMetaSort sort) throws PathNotFoundException
FileSystemdirectories in interface FileSystempath - 目录路径search - 以contains方式查找目录名。如果为空,返回所有结果。recursive - 如果true,则递归搜索所有子目录。offset - 开始位置索引。小于0则忽略。limit - 数量限制。小于0则忽略。sort - 排序选项。选项之间是互斥的。PathNotFoundException - 目录不存在public java.util.stream.Stream<? extends PathMeta> files(java.lang.String path, java.lang.String search, boolean recursive, int offset, int limit, PathMetaSort sort) throws PathNotFoundException
FileSystemfiles in interface FileSystempath - 目录路径search - 以contains方式查找文件名。如果为空,返回所有结果。recursive - 如果true,则递归搜索所有子目录。offset - 开始位置索引。小于0则忽略。limit - 数量限制。小于0则忽略。sort - 排序选项。选项之间是互斥的。PathNotFoundException - 目录不存在