private IBindingSet[] decodeNextChunk() throws IOException {
  if (nsolutions == solutionSetCount) {
    if (log.isDebugEnabled())     log.debug("Read solutionSet: name=" + name + ", solutionSetSize="+ nsolutions);
    return null;
  }
  in.readInt();
  final int chunkSize=in.readInt();
  final int byteLength=in.readInt();
  final byte[] a=new byte[byteLength];
  in.readFully(a);
  final DataInputBuffer buf=new DataInputBuffer(a);
  final IBindingSet[] t=new IBindingSet[chunkSize];
  for (int i=0; i < chunkSize; i++) {
    t[i]=decoder.decodeSolution(buf,true);
    if (log.isTraceEnabled())     log.trace("Read: name=" + name + ", solution="+ t[i]);
  }
  nsolutions+=chunkSize;
  if (log.isTraceEnabled())   log.trace("Read chunk: name=" + name + ", chunkSize="+ chunkSize+ ", bytesRead="+ (SolutionSetStreamEncoder.CHUNK_HEADER_SIZE + byteLength)+ ", solutionSetSize="+ nsolutions);
  return t;
}

private IBindingSet [ ] decodeNextChunk ( ) throws IOException { if ( nsolutions == solutionSetCount ) { if ( log . isDebugEnabled ( ) ) log . debug ( "Read solutionSet: name=" + name + ", solutionSetSize=" + nsolutions ) ; return null ; } in . readInt ( ) ; final int chunkSize = in . readInt ( ) ; final int byteLength = in . readInt ( ) ; final byte [ ] a = new byte [ byteLength ] ; in . readFully ( a ) ; final DataInputBuffer buf = new DataInputBuffer ( a ) ; final IBindingSet [ ] t = new IBindingSet [ chunkSize ] ; for ( int i = 0 ; i < chunkSize ; i ++ ) { t [ i ] = decoder . decodeSolution ( buf , true ) ; if ( log . isTraceEnabled ( ) ) log . trace ( "Read: name=" + name + ", solution=" + t [ i ] ) ; } nsolutions += chunkSize ; if ( log . isTraceEnabled ( ) ) log . trace ( "Read chunk: name=" + name + ", chunkSize=" + chunkSize + ", bytesRead=" + ( SolutionSetStreamEncoder . CHUNK_HEADER_SIZE + byteLength ) + ", solutionSetSize=" + nsolutions ) ; return t ; }
read ahead and decode the next chunk of solutions .
