public class Resourcer extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static String |
TEMP_FOLDER |
| 构造器和说明 |
|---|
Resourcer() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
clean_folder(File fold)
清除目录下文件
|
static InputStream |
clone(InputStream source)
复制输入流
|
static void |
closeQuietly(Closeable closeable) |
static void |
closeQuietly(InputStream is) |
static void |
closeQuietly(OutputStream os) |
static void |
copy_file_to_file(File source,
File target)
拷贝文件到文件
|
static void |
copy_file_to_folder(File sourcefile,
File targetfold)
拷贝文件到目录
|
static void |
copy_folder_to_folder(File sourcefold,
File targetfold)
拷贝文件夹到目录(在目标目录下新建整个来源文件夹)
|
static long |
copy_large(InputStream source,
OutputStream target)
将大数据输入流写入输出流
|
static long |
copy_large(InputStream source,
OutputStream target,
long offset,
long length)
将大数据输入流写入输出流
|
static long |
copy(File source,
OutputStream target)
将文件写入输出流
|
static int |
copy(InputStream source,
OutputStream target)
将输入流写入输出流
|
static void |
copy(Reader source,
OutputStream target,
String encoding)
将Reader写入输出流
|
static boolean |
delete(File file)
删除文件或目录
|
static String |
getUserRootDir()
查询应用运行目录
|
static File |
getUserRootFile()
查询应用运行目录
|
static String |
getUserTempDir(boolean usesys)
查询应用临时目录
|
static File |
getUserTempFile(boolean usesys)
查询应用临时目录
|
static boolean |
mkdir_folder(File fold)
创建目录
|
static void |
move_file_to_folder(File sourcefile,
File targetfold)
移动文件到目录
|
static void |
move_folder_to_folder(File sourcefold,
File targetfold)
移动文件夹到目录
|
static byte[] |
read_bytes(File file)
读取文件内容
|
static org.apache.commons.io.LineIterator |
read_line_iterator(File file)
按行读取文件内容
|
static org.apache.commons.io.LineIterator |
read_line_iterator(File file,
String encoding)
按行读取文件内容
|
static List<String> |
read_lines(File file)
按行读取文件内容
|
static List<String> |
read_lines(File file,
String encoding)
按行读取文件内容
|
static String |
read_string(File file)
读取文件内容
|
static String |
read_string(File file,
String encoding)
读取文件内容
|
static byte[] |
to_bytes(InputStream is) |
static byte[] |
to_bytes(InputStream is,
long size) |
static byte[] |
to_bytes(Reader reader) |
static byte[] |
to_bytes(URL url) |
static String |
to_string(byte[] bytes) |
static String |
to_string(byte[] bytes,
String encoding) |
static String |
to_string(InputStream is) |
static String |
to_string(InputStream is,
String encoding) |
static String |
to_string(Reader reader) |
static String |
to_string(URL url) |
static String |
to_string(URL url,
String encoding) |
static void |
write_bytes(File file,
byte[] data,
boolean append)
向文件写入二进制
|
static void |
write_stream(File file,
InputStream is)
向文件写入输入流
|
static void |
write_string(File file,
String data,
boolean append)
向文件写入字符串
|
static void |
write_string(File file,
String data,
String encoding,
boolean append)
向文件写入字符串
|
static void |
write_url(File file,
String url,
int conntimeout,
int readtimeout)
向文件写入网络资源内容
|
public static String read_string(File file) throws IOException
file - 文件IOException - 异常public static String read_string(File file, String encoding) throws IOException
file - 文件encoding - 编码IOException - 异常public static byte[] read_bytes(File file) throws IOException
file - 文件IOException - 异常public static List<String> read_lines(File file) throws IOException
file - 文件IOException - 异常public static List<String> read_lines(File file, String encoding) throws IOException
file - 文件encoding - 指定编码IOException - 异常public static org.apache.commons.io.LineIterator read_line_iterator(File file) throws IOException
file - 文件IOException - 异常public static org.apache.commons.io.LineIterator read_line_iterator(File file, String encoding) throws IOException
file - 文件encoding - 指定编码IOException - 异常public static void write_string(File file, String data, boolean append) throws IOException
file - 文件data - 内容append - 是否追加IOException - 异常public static void write_string(File file, String data, String encoding, boolean append) throws IOException
file - 文件data - 内容encoding - 编码append - 是否追加IOException - 异常public static void write_bytes(File file, byte[] data, boolean append) throws IOException
file - 文件data - 内容append - 是否追加IOException - 异常public static void write_url(File file, String url, int conntimeout, int readtimeout) throws IOException
file - 文件url - 网络资源conntimeout - 连接超时时间readtimeout - 读取超时时间IOException - 异常public static void write_stream(File file, InputStream is) throws IOException
file - 文件is - 输入流IOException - 异常public static byte[] to_bytes(InputStream is) throws IOException
IOExceptionpublic static byte[] to_bytes(InputStream is, long size) throws IOException
IOExceptionpublic static byte[] to_bytes(Reader reader) throws IOException
IOExceptionpublic static byte[] to_bytes(URL url) throws IOException
IOExceptionpublic static String to_string(byte[] bytes) throws IOException
IOExceptionpublic static String to_string(byte[] bytes, String encoding) throws IOException
IOExceptionpublic static String to_string(InputStream is) throws IOException
IOExceptionpublic static String to_string(InputStream is, String encoding) throws IOException
IOExceptionpublic static String to_string(Reader reader) throws IOException
IOExceptionpublic static String to_string(URL url) throws IOException
IOExceptionpublic static String to_string(URL url, String encoding) throws IOException
IOExceptionpublic static void copy_file_to_file(File source, File target)
source - 来源文件target - 目标文件public static void copy_file_to_folder(File sourcefile, File targetfold)
sourcefile - 来源文件targetfold - 目标目录public static void copy_folder_to_folder(File sourcefold, File targetfold)
sourcefold - 来源文件夹targetfold - 目标目录public static void move_file_to_folder(File sourcefile, File targetfold)
sourcefile - 来源文件targetfold - 目标目录public static void move_folder_to_folder(File sourcefold, File targetfold)
sourcefold - 来源文件夹targetfold - 目标目录public static boolean delete(File file)
file - 文件或目录public static boolean clean_folder(File fold)
fold - 目录public static boolean mkdir_folder(File fold)
fold - 目录public static InputStream clone(InputStream source) throws IOException
source - 输入流IOException - 异常public static long copy(File source, OutputStream target) throws IOException
source - 文件target - 输出流IOException - 异常public static void copy(Reader source, OutputStream target, String encoding) throws IOException
source - 输入流target - 输出流encoding - 编码IOException - 异常public static int copy(InputStream source, OutputStream target) throws IOException
source - 输入流target - 输出流IOException - 异常public static long copy_large(InputStream source, OutputStream target) throws IOException
source - 输入流target - 输出流IOException - 异常public static long copy_large(InputStream source, OutputStream target, long offset, long length) throws IOException
source - 输入流target - 输出流offset - 偏移length - 长度IOException - 异常public static String getUserRootDir()
public static File getUserRootFile()
public static String getUserTempDir(boolean usesys)
usesys - 是否使用系统临时目录public static File getUserTempFile(boolean usesys)
usesys - 是否使用系统临时目录public static void closeQuietly(Closeable closeable)
public static void closeQuietly(InputStream is)
public static void closeQuietly(OutputStream os)
Copyright (c) 2002-2020 Luther Inc.