0
0

More than 3 years have passed since last update.

51歳(現52)からのプログラミング 備忘 Path と File

Last updated at Posted at 2020-08-13

忘れていたので確認しました。
java7以降のファイル操作は
1. java.nio.file.Pathsクラスのメソッドで、操作するファイルやディレクトリを指定し
2. java.nio.file.Filesクラスのメソッドで、ファイルやディレクトリを操作する

  Path    p1 = Paths.get ("sample.dat"); // Pathsメソッド
  Boolean b  = Files.isDirectory(p1);    // Filesメソッド
  System.out.println(b);



[ Files.newBufferedReader(path) ]は、これでいいのかな?

  Path p1 = Paths.get("sample.dat");
  BufferedReader br = Files.newBufferedReader(p1);
  String l;
  while( (l=br.readLine()) != null){ System.out.println(l); }
0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0