public boolean addSearchResults(String base, Iterator<CaptureSearchResult> itr) 
	throws HttpException, IOException {
		
		if(tmpDir == null) {
			throw new IOException("No tmpDir argument");
		}
		File tmpFile = new File(tmpDir,base);
		if(tmpFile.exists()) {
			// TODO: is this safe?
			if(!tmpFile.delete()) {
				throw new IOException("Unable to remove tmp " + 
						tmpFile.getAbsolutePath());
			}
		}
		FileOutputStream os = new FileOutputStream(tmpFile);
		BufferedOutputStream bos = new BufferedOutputStream(os);
		PrintWriter pw = new PrintWriter(bos);
		
		Adapter<CaptureSearchResult,String> adapterSRtoS = 
			new SearchResultToCDXLineAdapter();
		Iterator<String> itrS = 
			new AdaptedIterator<CaptureSearchResult,String>(itr,adapterSRtoS);
		
		while(itrS.hasNext()) {
			pw.println(itrS.next());
		}
		pw.close();
		boolean added = addCDX(tmpFile);
		return added;
	}
public boolean addSearchResults ( String base , Iterator < CaptureSearchResult > itr ) throws HttpException , IOException { if ( tmpDir == null ) { throw new IOException ( "No tmpDir argument" ) ; } File tmpFile = new File ( tmpDir , base ) ; if ( tmpFile . exists ( ) ) { if ( ! tmpFile . delete ( ) ) { throw new IOException ( "Unable to remove tmp " + tmpFile . getAbsolutePath ( ) ) ; } } FileOutputStream os = new FileOutputStream ( tmpFile ) ; BufferedOutputStream bos = new BufferedOutputStream ( os ) ; PrintWriter pw = new PrintWriter ( bos ) ; Adapter < CaptureSearchResult , String > adapterSRtoS = new SearchResultToCDXLineAdapter ( ) ; Iterator < String > itrS = new AdaptedIterator < CaptureSearchResult , String > ( itr , adapterSRtoS ) ; while ( itrS . hasNext ( ) ) { pw . println ( itrS . next ( ) ) ; } pw . close ( ) ; boolean added = addCDX ( tmpFile ) ; return added ; }
@param base
@param itr
@return true if data was added to local or remote index
@throws HttpException
@throws IOException