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; }
public static boolean isFileNewer(File file, long timeMillis) { return FileUtils.isFileNewer(file, timeMillis); }
public static boolean isFileNewer(File file, Date date) { return FileUtils.isFileNewer(file, date); }
public static boolean isFileNewer(File file, File reference) { return FileUtils.isFileNewer(file, reference); }