public interface FileStorage
| 限定符和类型 | 方法和说明 |
|---|---|
default String[] |
compressionPathStarts()
加载启用压缩算法的起始路径
|
default void |
delete(String filePath)
删除文件
|
void |
delete(String filePath,
boolean compression)
删除文件
|
default boolean |
enable()
是否启用
|
default byte[] |
getData(String filePath)
读取字节内容
|
default InputStream |
getStream(String filePath)
读取文件
|
InputStream |
getStream(String filePath,
boolean compression)
读取文件
|
default String |
getString(String filePath)
读取文件
|
default boolean |
isCompression(String filePath)
判定路径是否启用了压缩
|
default long |
length(String filePath)
获取文件长度(注意:若文件不存在,返回-1, 若配置有压缩,可能返回的长度小于实际内容长度)
|
long |
length(String filePath,
boolean compression)
获取文件长度(注意:若文件不存在,返回-1, 若配置有压缩,可能返回的长度小于实际内容长度)
|
default long |
save(byte[] data,
String filePath)
将字节数组存储到存储器中
|
default long |
save(InputStream inputStream,
String filePath)
存储文件
|
long |
save(InputStream inputStream,
String filePath,
boolean compression)
存储文件
|
default long |
save(String content,
String filePath)
存储文件
|
default boolean |
tryDelete(String filePath) |
default boolean |
tryDelete(String filePath,
boolean compression)
尝试删除文件
|
default boolean enable()
default boolean isCompression(String filePath)
filePath - default String[] compressionPathStarts()
default long save(String content, String filePath) throws IOException
content - filePath - IOExceptiondefault long save(InputStream inputStream, String filePath) throws IOException
inputStream - filePath - IOExceptionlong save(InputStream inputStream, String filePath, boolean compression) throws IOException
inputStream - filePath - IOExceptiondefault long save(byte[] data,
String filePath)
throws IOException
data - filePath - IOExceptiondefault String getString(String filePath) throws IOException
filePath - IOExceptiondefault byte[] getData(String filePath) throws IOException
filePath - IOExceptiondefault InputStream getStream(String filePath) throws IOException
filePath - IOExceptionInputStream getStream(String filePath, boolean compression) throws IOException
filePath - compression - IOExceptiondefault void delete(String filePath) throws IOException
filePath - IOExceptionvoid delete(String filePath, boolean compression) throws IOException
filePath - IOExceptiondefault boolean tryDelete(String filePath, boolean compression)
filePath - default boolean tryDelete(String filePath)
default long length(String filePath) throws IOException
filePath - IOExceptionlong length(String filePath, boolean compression) throws IOException
filePath - IOExceptionCopyright © 2025. All rights reserved.