public Pair<DAAQueryRecord,DAAMatchRecord[]> readQueryAndMatches(InputReaderLittleEndian ins,InputReaderLittleEndian refIns,int maxMatchesPerRead,ByteInputBuffer inputBuffer,DAAMatchRecord[] matchRecords) throws IOException {
  final DAAQueryRecord queryRecord=new DAAQueryRecord(this);
  if (inputBuffer == null)   inputBuffer=new ByteInputBuffer();
 else   inputBuffer.rewind();
  if (matchRecords == null)   matchRecords=new DAAMatchRecord[maxMatchesPerRead];
  queryRecord.setLocation(ins.getPosition());
  ins.readSizePrefixedBytes(inputBuffer);
  queryRecord.parseBuffer(inputBuffer);
  int numberOfMatches=0;
  while (inputBuffer.getPosition() < inputBuffer.size()) {
    DAAMatchRecord matchRecord=new DAAMatchRecord(queryRecord);
    matchRecord.parseBuffer(inputBuffer,refIns);
    if (numberOfMatches < maxMatchesPerRead)     matchRecords[numberOfMatches++]=matchRecord;
 else     break;
  }
  if (numberOfMatches > 0) {
    DAAMatchRecord[] usedMatchRecords=new DAAMatchRecord[numberOfMatches];
    System.arraycopy(matchRecords,0,usedMatchRecords,0,numberOfMatches);
    return new Pair<>(queryRecord,usedMatchRecords);
  }
 else   return new Pair<>(queryRecord,new DAAMatchRecord[0]);
}

public Pair < DAAQueryRecord , DAAMatchRecord [ ] > readQueryAndMatches ( InputReaderLittleEndian ins , InputReaderLittleEndian refIns , int maxMatchesPerRead , ByteInputBuffer inputBuffer , DAAMatchRecord [ ] matchRecords ) throws IOException { final DAAQueryRecord queryRecord = new DAAQueryRecord ( this ) ; if ( inputBuffer == null ) inputBuffer = new ByteInputBuffer ( ) ; else inputBuffer . rewind ( ) ; if ( matchRecords == null ) matchRecords = new DAAMatchRecord [ maxMatchesPerRead ] ; queryRecord . setLocation ( ins . getPosition ( ) ) ; ins . readSizePrefixedBytes ( inputBuffer ) ; queryRecord . parseBuffer ( inputBuffer ) ; int numberOfMatches = 0 ; while ( inputBuffer . getPosition ( ) < inputBuffer . size ( ) ) { DAAMatchRecord matchRecord = new DAAMatchRecord ( queryRecord ) ; matchRecord . parseBuffer ( inputBuffer , refIns ) ; if ( numberOfMatches < maxMatchesPerRead ) matchRecords [ numberOfMatches ++ ] = matchRecord ; else break ; } if ( numberOfMatches > 0 ) { DAAMatchRecord [ ] usedMatchRecords = new DAAMatchRecord [ numberOfMatches ] ; System . arraycopy ( matchRecords , 0 , usedMatchRecords , 0 , numberOfMatches ) ; return new Pair < > ( queryRecord , usedMatchRecords ) ; } else return new Pair < > ( queryRecord , new DAAMatchRecord [ 0 ] ) ; }
read a query and its matches
