public String readLine2() throws IOException {
  sb.delete(0, sb.length());
  int c = -1;
  boolean eol = false;
  while (!eol) {
   switch (c = read()) {
   case -1:
   case '\n':
    eol = true;
    break;
   case '\r':
    eol = true;
    long cur = getFilePointer();
    if ((read()) != '\n') {
     seek(cur);
    }
    break;
   default:
    sb.append((char) c);
    break;
   }
  }

  if ((c == -1) && (sb.length() == 0)) {
   return null;
  }
  return sb.toString();
 }