public static void writeFile(IFile file,final FileOutput output,IProgressMonitor monitor) throws CoreException {
  try {
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    output.writeFile(bos);
    ByteArrayInputStream bis=new ByteArrayInputStream(bos.toByteArray());
    if (!file.exists()) {
      mkdirs(file,monitor);
      file.create(bis,true,monitor);
    }
 else {
      file.setContents(bis,true,false,monitor);
    }
  }
 catch (  IOException e) {
    IStatus status=FindbugsPlugin.createErrorStatus("Exception while " + output.getTaskDescription(),e);
    throw new CoreException(status);
  }
}

public static void writeFile ( IFile file , final FileOutput output , IProgressMonitor monitor ) throws CoreException { try { ByteArrayOutputStream bos = new ByteArrayOutputStream ( ) ; output . writeFile ( bos ) ; ByteArrayInputStream bis = new ByteArrayInputStream ( bos . toByteArray ( ) ) ; if ( ! file . exists ( ) ) { mkdirs ( file , monitor ) ; file . create ( bis , true , monitor ) ; } else { file . setContents ( bis , true , false , monitor ) ; } } catch ( IOException e ) { IStatus status = FindbugsPlugin . createErrorStatus ( "Exception while " + output . getTaskDescription ( ) , e ) ; throw new CoreException ( status ) ; } }
write the contents of a file in the eclipse workspace .
