private String readLine() throws IOException {
   StringBuffer sb = new StringBuffer();
   char readChar;
   int ch;
   long pos = reader.getFilePointer();
   long length = file.length();
   if ((length < pos) || (length == pos && FileUtils.isFileNewer(file, accessTime))) {
     // file got rotated or truncated
     reader.close();
     reader = new RandomAccessFile(file, "r");
     position = 0;
     reader.seek(position);
     pos = 0;
   }
   accessTime = System.currentTimeMillis();
   while ((ch = reader.read()) != -1) {
     readChar = (char) ch;
     if (readChar != delimiter) {
       sb.append(readChar);
     } else {
       return sb.toString();
     }
   }
   reader.seek(pos);
   return null;
 }
Esempio n. 2
0
 public static boolean isFileNewer(File file, long timeMillis) {
   return FileUtils.isFileNewer(file, timeMillis);
 }
Esempio n. 3
0
 public static boolean isFileNewer(File file, Date date) {
   return FileUtils.isFileNewer(file, date);
 }
Esempio n. 4
0
 public static boolean isFileNewer(File file, File reference) {
   return FileUtils.isFileNewer(file, reference);
 }