JAVA開発メモ
CommonsIO のバックアップの現在との差分(No.1)
 

[トップ|一覧|単語検索|最終更新|バックアップ|ヘルプ]



  *[[Jakarta Commons IO:http://jakarta.apache.org/commons/io/]]

  


   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;
       in = new URL("http://www.moriwaki.net/wiki/").openStream();

       System.out.println(IOUtils.toString(in));
   } finally {

       IOUtils.closeQuietly(in);



   File dir = new File("C:\\tmp\\work");
       FileUtils.cleanDirectory(dir);
   } catch (IOException e) {

   File file1 = new File("C:\\tmp\\test.txt");
   File file2 = new File("C:\\tmp\\copy.txt");
       try {
   FileUtils.copyFile(file1, file2);

   File dir = new File("C:\\tmp");
   String[] extensions = {"txt", "html"};

   Collection files = FileUtils.listFiles(dir, extensions, recursive);
   System.out.println(files);

   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)

トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS

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.003 sec.