http://blog.csdn.net/gao36951/article/details/38302553
根据一个Url拷贝字节到一个文件中copyURLToFile(URL source, File destination)public static void copyURLToFile(URL source, File destination) throws IOException {
InputStream input =source.openStream();
copyInputStreamToFile(input,destination);
}
把一个文件的内容读取到一个对应编码的字符串中去readFileToString(File file, String encoding)
public static String readFileToString(Filefile, String encoding) throws IOException {
InputStream in = null;
try {
in = openInputStream(file);
return IOUtils.toString(in,encoding);
} finally {
IOUtils.closeQuietly(in);
}
}
读取文件的内容到虚拟机的默认编码字符串readFileToString(File file)
public static String readFileToString(Filefile) throws IOException {
return readFileToString(file,null);
}
安静模式删除目录,操作过程中会抛出异常deleteQuietly(File file)
public static boolean deleteQuietly(File file) {
if (file == null) {
return false;
}
try {
if (file.isDirectory()) {
cleanDirectory(file);
}
} catch (Exception ignored) {
}
try {
return file.delete();
} catch (Exception ignored) {
return false;
}
}
清除一个目录而不删除它cleanDirectory(Filedirectory)
删除一个文件,如果是目录则递归删除forceDelete(File file)
...................