I am trying to check if a log file is empty (meaning no errors) or not, in Java, on Windows. I have tried using 2 methods so far.
Method 1 (Failure)
Stolen from http://www.coderanch.com/t/279224/Streams/java/Checking-empty-file
FileInputStream fis = new FileInputStream(new File("file_name")); int b = fis.read(); if (b == -1) { System.out.println("!!File " + file_name + " emty!!"); }
Updated: My first answer was premature and contained a bug.