类 FileHelper
java.lang.Object
com.ajaxjs.util.io.FileHelper
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidchunkFile(long chunkSize) 对文件按照指定大小进行分片,在文件所在目录生成分片后的文件块儿 使用零拷贝对文件高效的切片和合并voidcopTo()Copy a file or directory to another location.voidCreate a directory.voiddelete()Delete a folder or a file.Read the file text contentlongGet the size of a file or directory.List the contents of a directory.void把多个文件合并为一个文件voidmoveTo()Move a file or directory to another location.byte[]Read the file content in bytes.voidwriteFileContent(String content) 将字符串内容写入文件。
-
构造器详细资料
-
FileHelper
-
FileHelper
-
FileHelper
-
-
方法详细资料
-
getFileContent
Read the file text content- 返回:
- Text content
-
readFileBytes
public byte[] readFileBytes()Read the file content in bytes.- 返回:
- The file content in bytes.
-
writeFileContent
将字符串内容写入文件。- 参数:
content- 要写入的内容- 抛出:
UncheckedIOException- 如果写入文件时发生错误
-
delete
public void delete()Delete a folder or a file. If it's a folder, delete all files and sub-folders under it. -
listDirectoryContents
List the contents of a directory.- 返回:
- The contents of the directory.
-
createDirectory
public void createDirectory()Create a directory. It can create multiple levels of directories. -
getFileSize
public long getFileSize()Get the size of a file or directory.- 返回:
- Size in bytes.
-
setTarget
-
setTarget
-
copTo
public void copTo()Copy a file or directory to another location. -
moveTo
public void moveTo()Move a file or directory to another location. -
chunkFile
public void chunkFile(long chunkSize) 对文件按照指定大小进行分片,在文件所在目录生成分片后的文件块儿 使用零拷贝对文件高效的切片和合并 -
mergeFile
把多个文件合并为一个文件- 参数:
chunkFiles- 分片文件
-