public final class Files extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static int |
BUFF_SIZE |
static String |
CURRENT_PATH |
static Charset |
DEFAULT_CHARSET |
static String |
DEFAULT_CHARSET_NAME |
static int |
EOF |
static String |
MAC_LINE_SEPARATOR |
static String |
SYSTEM_FOLDER_SEPARATOR |
static String |
SYSTEM_LINE_SEPARATOR |
static String |
TOP_PATH |
static String |
UNIX_FOLDER_SEPARATOR |
static String |
UNIX_LINE_SEPARATOR |
static String |
UTF_8 |
static String |
WINDOWS_FOLDER_SEPARATOR |
static String |
WINDOWS_LINE_SEPARATOR |
| 构造器和说明 |
|---|
Files() |
| 限定符和类型 | 方法和说明 |
|---|---|
static TreeNode<Integer,File> |
listFiles(File file)
递归列出所有文件
|
static TreeNode<Integer,File> |
listFiles(String filePath) |
static void |
mkdir(File file)
创建目录
|
static File |
mkdir(String filePath)
创建目录
|
static byte[] |
readByteArray(File file,
int count) |
static byte[] |
readByteArray(InputStream input,
int count) |
static byte[] |
readByteArray(String filePath,
int count) |
static byte[] |
toByteArray(File file)
Reads file to byte array
|
static String |
toString(File file) |
static String |
toString(File file,
Charset charset) |
static void |
touch(File file)
创建文件
|
static String |
tree(File file)
打印文件树
|
static String |
tree(String filePath) |
public static final int EOF
public static final int BUFF_SIZE
public static final Charset DEFAULT_CHARSET
public static final String DEFAULT_CHARSET_NAME
public static final String SYSTEM_FOLDER_SEPARATOR
public static final String SYSTEM_LINE_SEPARATOR
public static void mkdir(File file)
file - public static void touch(File file)
file - public static String toString(File file) throws IOException
IOExceptionpublic static String toString(File file, Charset charset) throws IOException
IOExceptionpublic static byte[] toByteArray(File file)
file - public static byte[] readByteArray(String filePath, int count) throws IOException
IOExceptionpublic static byte[] readByteArray(File file, int count) throws IOException
IOExceptionpublic static byte[] readByteArray(InputStream input, int count) throws IOException
IOExceptionpublic static String tree(String filePath) throws IOException
IOExceptionpublic static String tree(File file) throws IOException
file - IOExceptionCopyright © 2023. All rights reserved.