synchronized boolean visit() throws IOException {
  if (exc != null) {
    return true;
  }
  if (current == null) {
    if (iter.hasNext() == false) {
      c.close();
      return true;
    }
    Map.Entry<String,FileMetaData> next=iter.next();
    FileMetaData metaData=next.getValue();
    String fileName=next.getKey();
    long len=c.in.readVLong();
    if (len != metaData.length) {
      throw new IllegalStateException("file " + fileName + ": meta data says length="+ metaData.length+ " but c.in says "+ len);
    }
    current=new CopyOneFile(c.in,dest,fileName,metaData,copyBuffer);
  }
  if (current.visit()) {
    copiedFiles.put(current.name,current.tmpName);
    totBytesCopied+=current.getBytesCopied();
    assert totBytesCopied <= totBytes : "totBytesCopied=" + totBytesCopied + " totBytes="+ totBytes;
    current=null;
    return false;
  }
  return false;
}

synchronized boolean visit ( ) throws IOException { if ( exc != null ) { return true ; } if ( current == null ) { if ( iter . hasNext ( ) == false ) { c . close ( ) ; return true ; } Map . Entry < String , FileMetaData > next = iter . next ( ) ; FileMetaData metaData = next . getValue ( ) ; String fileName = next . getKey ( ) ; long len = c . in . readVLong ( ) ; if ( len != metaData . length ) { throw new IllegalStateException ( "file " + fileName + ": meta data says length=" + metaData . length + " but c.in says " + len ) ; } current = new CopyOneFile ( c . in , dest , fileName , metaData , copyBuffer ) ; } if ( current . visit ( ) ) { copiedFiles . put ( current . name , current . tmpName ) ; totBytesCopied += current . getBytesCopied ( ) ; assert totBytesCopied <= totBytes : "totBytesCopied=" + totBytesCopied + " totBytes=" + totBytes ; current = null ; return false ; } return false ; }
do an iota of work ; returns true if all copying is done
