static long raf_findBeginningOfLine(RandomAccessFile raf, long pos, int bufSize) ctex { byte[] buf = new byte[bufSize]; while (pos > 0) { long start = Math.max(pos-bufSize, 0); raf.seek(start); raf.readFully(buf, 0, (int) Math.min(pos-start, bufSize)); int idx = lastIndexOf_byteArray(buf, (byte) '\n'); if (idx >= 0) ret start+idx+1; pos = start; } ret 0; }