类 LocalFileSystem
- java.lang.Object
-
- me.insidezhou.southernquiet.filesystem.driver.LocalFileSystem
-
- 所有已实现的接口:
FileSystem
public class LocalFileSystem extends java.lang.Object implements FileSystem
基于操作系统本地文件系统的驱动.
-
-
字段概要
-
从接口继承的字段 me.insidezhou.southernquiet.filesystem.FileSystem
PATH_SEPARATOR, PATH_SEPARATOR_STRING
-
-
构造器概要
构造器 构造器 说明 LocalFileSystem(FrameworkAutoConfiguration.LocalFileSystemProperties properties)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidcopy(java.lang.String source, java.lang.String destination, boolean replaceExisting)复制文件或目录,PathMeta保持不变。voidcreateDirectory(java.lang.String path)创建目录。voiddelete(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)获取目录下子目录。booleanexists(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)获取目录下文件。PathMetameta(java.lang.String path)获取路径的元信息。voidmove(java.lang.String source, java.lang.String destination, boolean replaceExisting)移动文件或目录,PathMeta保持不变。java.io.InputStreamopenReadStream(java.lang.String path)用流的方式读取文件内容,调用方负责流的关闭。java.io.OutputStreamopenWriteStream(java.lang.String path)用流的方式写入文件内容,调用方负责流的关闭。voidput(java.lang.String path, java.io.InputStream stream)如果文件未存在,则创建;否则替换。voidput(java.lang.String path, java.lang.CharSequence txt)如果文件未存在,则创建;否则替换。voidtouchCreation(java.lang.String path)刷新文件或目录的PathMeta.getCreationTime()。voidtouchLastAccess(java.lang.String path)刷新文件或目录的PathMeta.getLastAccessTime()。voidtouchLastModified(java.lang.String path)刷新文件或目录的PathMeta.getLastModifiedTime()。-
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
从接口继承的方法 me.insidezhou.southernquiet.filesystem.FileSystem
copy, directories, directories, directories, files, files, files, move, read, read
-
-
-
-
构造器详细资料
-
LocalFileSystem
public LocalFileSystem(FrameworkAutoConfiguration.LocalFileSystemProperties properties)
-
-
方法详细资料
-
createDirectory
public void createDirectory(java.lang.String path)
从接口复制的说明:FileSystem创建目录。目录已存在则忽略。- 指定者:
createDirectory在接口中FileSystem- 参数:
path- 路径
-
put
public void put(java.lang.String path, java.io.InputStream stream) throws InvalidFileException从接口复制的说明:FileSystem如果文件未存在,则创建;否则替换。- 指定者:
put在接口中FileSystem- 参数:
path- 要写入的路径stream- 输入流- 抛出:
InvalidFileException- 无效文件
-
put
public void put(java.lang.String path, java.lang.CharSequence txt) throws InvalidFileException从接口复制的说明:FileSystem如果文件未存在,则创建;否则替换。- 指定者:
put在接口中FileSystem- 参数:
path- 要写入的路径txt- 输入文本- 抛出:
InvalidFileException- 无效文件
-
exists
public boolean exists(java.lang.String path)
从接口复制的说明:FileSystem检查路径是否存在。- 指定者:
exists在接口中FileSystem- 参数:
path- 路径
-
openReadStream
public java.io.InputStream openReadStream(java.lang.String path) throws InvalidFileException从接口复制的说明:FileSystem用流的方式读取文件内容,调用方负责流的关闭。- 指定者:
openReadStream在接口中FileSystem- 参数:
path- 路径- 抛出:
InvalidFileException- 无效文件
-
openWriteStream
public java.io.OutputStream openWriteStream(java.lang.String path) throws InvalidFileException从接口复制的说明:FileSystem用流的方式写入文件内容,调用方负责流的关闭。- 当文件不存在时会自动创建。
- 以Append的方式写入。
- 指定者:
openWriteStream在接口中FileSystem- 参数:
path- 路径- 抛出:
InvalidFileException- 无效文件
-
move
public void move(java.lang.String source, java.lang.String destination, boolean replaceExisting) throws FileSystemException从接口复制的说明:FileSystem移动文件或目录,PathMeta保持不变。- 指定者:
move在接口中FileSystem- 参数:
source- 源路径destination- 目标路径replaceExisting- 如果true,替换现存的文件,否则忽略移动。- 抛出:
PathNotFoundException- 源路径不存在FileSystemException- 文件系统操作失败
-
copy
public void copy(java.lang.String source, java.lang.String destination, boolean replaceExisting) throws FileSystemException从接口复制的说明:FileSystem复制文件或目录,PathMeta保持不变。- 指定者:
copy在接口中FileSystem- 参数:
source- 源路径destination- 目标路径replaceExisting- 如果true,替换现存的文件,否则忽略复制。- 抛出:
PathNotFoundException- 源路径不存在FileSystemException- 文件系统操作失败
-
delete
public void delete(java.lang.String path)
从接口复制的说明:FileSystem删除文件或目录。- 指定者:
delete在接口中FileSystem- 参数:
path- 路径
-
touchCreation
public void touchCreation(java.lang.String path)
从接口复制的说明:FileSystem刷新文件或目录的PathMeta.getCreationTime()。- 指定者:
touchCreation在接口中FileSystem- 参数:
path- 路径
-
touchLastModified
public void touchLastModified(java.lang.String path)
从接口复制的说明:FileSystem刷新文件或目录的PathMeta.getLastModifiedTime()。- 指定者:
touchLastModified在接口中FileSystem- 参数:
path- 路径
-
touchLastAccess
public void touchLastAccess(java.lang.String path)
从接口复制的说明:FileSystem刷新文件或目录的PathMeta.getLastAccessTime()。- 指定者:
touchLastAccess在接口中FileSystem- 参数:
path- 路径
-
meta
public PathMeta meta(java.lang.String path)
从接口复制的说明:FileSystem获取路径的元信息。- 指定者:
meta在接口中FileSystem- 参数:
path- 路径- 返回:
- 路径不存在时,返回null。
-
directories
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
从接口复制的说明:FileSystem获取目录下子目录。- 指定者:
directories在接口中FileSystem- 参数:
path- 目录路径search- 以contains方式查找目录名。如果为空,返回所有结果。recursive- 如果true,则递归搜索所有子目录。offset- 开始位置索引。小于0则忽略。limit- 数量限制。小于0则忽略。sort- 排序选项。选项之间是互斥的。- 抛出:
PathNotFoundException- 目录不存在
-
files
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
从接口复制的说明:FileSystem获取目录下文件。- 指定者:
files在接口中FileSystem- 参数:
path- 目录路径search- 以contains方式查找文件名。如果为空,返回所有结果。recursive- 如果true,则递归搜索所有子目录。offset- 开始位置索引。小于0则忽略。limit- 数量限制。小于0则忽略。sort- 排序选项。选项之间是互斥的。- 抛出:
PathNotFoundException- 目录不存在
-
-