[
トップ|
一覧|
単語検索|
最終更新|
バックアップ|
ヘルプ]
- 追加された行はこの色です。
- 削除された行はこの色です。
*[[Jakarta Commons IO:http://jakarta.apache.org/commons/io/]]
#contents
|InputStream|OutputStream|
|Reader|Writer|
|InputStream|Writer|
|Reader|OutputStream|
|String|OutputStream|
|String|Writer|
|byte[]|Writer|
|byte[]|OutputStream|
try {
InputStream in = new FileInputStream("C:\\tmp\\org.txt");
OutputStream out = new FileOutputStream("C:\\tmp\\copy.txt");
CopyUtils.copy(in, out);
} catch (Exception e) {
e.printStackTrace();
}
InputStream in = null;
try {
in = new URL("http://www.moriwaki.net/wiki/").openStream();
System.out.println(IOUtils.toString(in));
} catch (Exception e) {
e.printStackTrace();
} finally {
IOUtils.closeQuietly(in);
}
File dir = new File("C:\\tmp\\work");
try {
FileUtils.cleanDirectory(dir);
} catch (IOException e) {
e.printStackTrace();
}
File file1 = new File("C:\\tmp\\test.txt");
File file2 = new File("C:\\tmp\\copy.txt");
try {
FileUtils.copyFile(file1, file2);
} catch (IOException e) {
e.printStackTrace();
}
File dir = new File("C:\\tmp");
String[] extensions = {"txt", "html"};
Collection files = FileUtils.listFiles(dir, extensions, recursive);
System.out.println(files);
File dir = new File("C:\\tmp");
long size = FileUtils.sizeOfDirectory(dir);
System.out.println(size + " bytes");
System.out.println(FileUtils.byteCountToDisplaySize(size));
693928711 bytes
661 MB
-void ''touch''(File)
-File[] ''convertFileCollectionToFileArray''(Collection)
-Collection ''listFiles''(File, IOFileFilter, IOFileFilter)
-boolean ''contentEquals''(File, File)
-File ''toFile''(URL)
-URL[] ''toURLs''(File[])
-String ''readFileToString''(File, String)
-void ''writeStringToFile''(File, String, String)
-void ''forceDelete''(File)
-boolean ''isFileNewer''(File, File)
File dir = new File("C:\\tmp");
IOFileFilter fileFilter1 = FileFilterUtils.prefixFileFilter("test");
IOFileFilter fileFilter2 = FileFilterUtils.suffixFileFilter("html");
IOFileFilter fileFilter =
FileFilterUtils.andFileFilter(fileFilter1, fileFilter2);
IOFileFilter dirFilter = FileFilterUtils.trueFileFilter();
dirFilter = FileFilterUtils.makeCVSAware(dirFilter);
files = FileUtils.listFiles(dir, fileFilter, dirFilter);
System.out.println(files);
[C:\tmp\test.html, C:\tmp\test2.html]
Modified by MT22(Moriwaki Takashi)
"PukiWiki" 1.3.7 Copyright © 2001,2002,2003 PukiWiki Developers Team. License is GNU/GPL.
Based on "PukiWiki" 1.3 by sng
Powered by PHP 7.4.33
HTML convert time to 0.006 sec.