public class FileUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
private static int |
BUFFER_SIZE
缓存区大小
|
private static String |
FILE_OPEN_MODE
文件打开模式
|
private static String |
NEWLINE_CONTENT
换行符
|
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
createFolder(String path)
创建文件夹
|
static boolean |
fileExists(String path) |
static boolean |
folderExists(String path) |
static String |
readFile(String path)
读取文件内容
|
static List<io.vavr.Tuple2<Integer,String>> |
readFileByLine(File file)
按行读取文件
|
static boolean |
renameFile(String oldPath,
String newPath) |
static void |
writeFile(File file,
String content,
boolean overwrite)
Deprecated.
|
static void |
writeFile(File file,
String content,
FileWriteType writeType)
写入内容到指定文件
|
static void |
writeFile(String path,
String content,
boolean overwrite)
Deprecated.
|
static void |
writeFile(String path,
String content,
FileWriteType writeType)
写入内容到指定文件
|
private static final int BUFFER_SIZE
private static final String NEWLINE_CONTENT
private static final String FILE_OPEN_MODE
public static List<io.vavr.Tuple2<Integer,String>> readFileByLine(File file) throws Exception
Exception@Deprecated public static void writeFile(String path, String content, boolean overwrite) throws Exception
path - 文件路径content - 写入内容overwrite - 是否覆盖Exceptionpublic static void writeFile(String path, String content, FileWriteType writeType) throws Exception
path - 文件路径content - 写入内容writeType - 写模式Exception@Deprecated public static void writeFile(File file, String content, boolean overwrite) throws Exception
file - 文件content - 写入内容overwrite - 是否覆盖Exceptionpublic static void writeFile(File file, String content, FileWriteType writeType) throws Exception
file - 文件content - 写入内容writeType - 写模式Exceptionpublic static void createFolder(String path) throws IOException
IOExceptionpublic static boolean folderExists(String path)
public static boolean fileExists(String path)
Copyright © 2023. All rights reserved.