PipedInputStream pin = new PipedInputStream(); final PipedOutputStream pout = new PipedOutputStream();   Thread worker = new Thread() { public void run() { try { bugCollection.writeXML(pout, findbugsProject); } catch (IOException e) { FindbugsPlugin.getDefault().logException(e, "Exception while creating XML bug description file."); } finally { try { pout.close(); } catch (IOException e) {  } }
FileOutput fileOutput = new FileOutput() { public void writeFile(OutputStream os) throws IOException { bugCollection.writeXML(os, findbugsProject);
	public static void storeBugCollection(			IProject project,			final SortedBugCollection bugCollection,			final Project findbugsProject,			IProgressMonitor monitor) throws IOException, CoreException {				// Store the bug collection and findbugs project in the session		project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugCollection);		project.setSessionProperty(SESSION_PROPERTY_FB_PROJECT, findbugsProject);		// Save to file		IFile bugCollectionFile = FindbugsPlugin.getBugCollectionFile(project);				PipedInputStream pin = new PipedInputStream();		final PipedOutputStream pout = new PipedOutputStream();				// Create a thread to write bug collection to output stream		Thread worker = new Thread() {			public void run() {				try {					bugCollection.writeXML(pout, findbugsProject);				} catch (IOException e) {					FindbugsPlugin.getDefault().logException(e, "Exception while creating XML bug description file.");				} finally {					try {						pout.close();					} catch (IOException e) {						// ignore					}				}			}		};						try {			pin.connect(pout);			worker.start();									if (!bugCollectionFile.exists())				bugCollectionFile.create(pin, true, monitor);			else				bugCollectionFile.setContents(pin, true, false, monitor);						// Need to refresh here?			bugCollectionFile.refreshLocal(IResource.DEPTH_INFINITE, monitor);		} finally {			try {				pin.close();			} catch (IOException e) {				// ignore			}		}			}