[Java] Programming reminder Path and File from 51 years old (currently 52)

less than 1 minute read

I forgot, so I confirmed. File operation after java7 1.Specify the file or directory to operate with the method of java.nio.file.Paths class.

  1. Operate files and directories with the methods of java.nio.file.Files class
   Path p1 = Paths.get ("sample.dat"); // Paths method
   Boolean b = Files.isDirectory(p1); // Files method
   System.out.println(b);


Is [Files.newBufferedReader(path)] good for this?

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