コード例 #1
0
 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;
 }
コード例 #2
0
 public static boolean isFileNewer(File file, long timeMillis) {
   return FileUtils.isFileNewer(file, timeMillis);
 }
コード例 #3
0
 public static boolean isFileNewer(File file, Date date) {
   return FileUtils.isFileNewer(file, date);
 }
コード例 #4
0
 public static boolean isFileNewer(File file, File reference) {
   return FileUtils.isFileNewer(file, reference);
 }