title: Reading lines from file using SeekableByteChannel
body: <p>Can I use SeekableByteChannel for reading lines from file. I have the position (in bytes) and want to read the whole line. for example I use this method for RandomAccessFile</p>
  
  <pre><code>private static String currentLine(String filepath, long currentPosition)
  {
     RandomAccessFile f = new RandomAccessFile(filepath, "rw");
  
    byte b = f.readByte();
    while (b != 10)
    {
      currentPosition -= 1;
      f.seek(currentPosition);
      b = f.readByte();
      if (currentPosition &lt;= 0)
      {
        f.seek(0);
        String currentLine = f.readLine();
        f.close();
        return currentLine;
      }
    }
    String line = f.readLine();
    f.close();
    return line;  
  
  }
  </code></pre>
  
  <p>How can I use something like this for SeekableByteChannel, and will be it faster for reading huge numbers of lines?</p>