Package com.chatopera.bot.utils
Class FileUtil
java.lang.Object
com.chatopera.bot.utils.FileUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
复制文件static boolean
指定路径是否存在static boolean
isDirectory
(String path) 指定路径是否是文件夹static boolean
指定路径是否是文件static int
创建路径软链接 https://javarevisited.blogspot.com/2011/04/symbolic-link-or-symlink-in-unix-linux.htmlstatic int
移动文件https://www.journaldev.com/709/java-read-file-line-by-linestatic void
删除指定路径static void
writelines
(String filePath, List<String> lines) 指定路径文件写入内容,覆盖以前内容
-
Constructor Details
-
FileUtil
public FileUtil()
-
-
Method Details
-
exists
指定路径是否存在- Parameters:
path
-- Returns:
-
isDirectory
指定路径是否是文件夹- Parameters:
path
-- Returns:
- Throws:
FileNotExistException
-
isFile
指定路径是否是文件- Parameters:
path
-- Returns:
- Throws:
FileNotExistException
-
readlines
https://www.journaldev.com/709/java-read-file-line-by-line- Parameters:
filePath
-istrim
-- Returns:
- Throws:
FileNotExistException
-
readlines
- Parameters:
filePath
-- Returns:
- Throws:
FileNotExistException
-
writelines
指定路径文件写入内容,覆盖以前内容- Parameters:
filePath
-lines
-- Throws:
IOException
-
remove
删除指定路径- Parameters:
path
-- Throws:
IOException
-
move
移动文件- Parameters:
pre
-post
-- Throws:
FileNotExistException
-
copy
复制文件- Parameters:
source
-copied
-- Throws:
FileNotExistException
-
ln
创建路径软链接 https://javarevisited.blogspot.com/2011/04/symbolic-link-or-symlink-in-unix-linux.html- Parameters:
source
-link
-- Returns:
- Throws:
FileNotExistException
IOException
-