public Pair<String,String> next(){
  currentHeaderPosition=nextHeaderPosition;
  Pair<String,String> result=new Pair<>(nextHeader,nextSequence);
  nextHeader=nextNextHeader;
  nextHeaderPosition=nextNextHeaderPosition;
  nextSequence=null;
  nextNextHeader=null;
  if (nextHeader != null) {
    String aLine;
    try {
      while ((aLine=r.readLine()) != null) {
        if (aLine.startsWith(">")) {
          nextNextHeader=aLine;
          nextNextHeaderPosition=position;
          position+=aLine.length() + endOfLineBytes;
          break;
        }
 else {
          position+=aLine.length() + endOfLineBytes;
          parts.add(aLine);
        }
      }
      numberOfSequencesRead++;
    }
 catch (    IOException e) {
      Basic.caught(e);
    }
    nextSequence=Basic.concatenateAndRemoveWhiteSpaces(parts);
    parts.clear();
  }
 else   try {
    close();
  }
 catch (  IOException ex) {
    Basic.caught(ex);
  }
  return result;
}

public Pair < String , String > next ( ) { currentHeaderPosition = nextHeaderPosition ; Pair < String , String > result = new Pair < > ( nextHeader , nextSequence ) ; nextHeader = nextNextHeader ; nextHeaderPosition = nextNextHeaderPosition ; nextSequence = null ; nextNextHeader = null ; if ( nextHeader != null ) { String aLine ; try { while ( ( aLine = r . readLine ( ) ) != null ) { if ( aLine . startsWith ( ">" ) ) { nextNextHeader = aLine ; nextNextHeaderPosition = position ; position += aLine . length ( ) + endOfLineBytes ; break ; } else { position += aLine . length ( ) + endOfLineBytes ; parts . add ( aLine ) ; } } numberOfSequencesRead ++ ; } catch ( IOException e ) { Basic . caught ( e ) ; } nextSequence = Basic . concatenateAndRemoveWhiteSpaces ( parts ) ; parts . clear ( ) ; } else try { close ( ) ; } catch ( IOException ex ) { Basic . caught ( ex ) ; } return result ; }
gets next fasta record
