code: private void writeToFile(String filename, File outputDir) {
  	File outFile = new File(outputDir, filename);
  	OutputStream os;
  	try {
  	    os = new FileOutputStream(outFile);
  	} catch (FileNotFoundException e) {
  	    throw new UIMARuntimeException(e);
  	}
  	InputStream is = null;
  	try {
  	    is = ResourceHelper.getInputStream("viewer/" + filename);
  	    byte[] buf = new byte[1024];
  	    int numRead;
  	    while ((numRead = is.read(buf)) > 0) {
  		os.write(buf, 0, numRead);
  	    }
  	} catch (IOException e) {
  	    throw new UIMARuntimeException(e);
  	} finally {
  	    try {
  		is.close();
  	    } catch (IOException e) {
  		// ignore close errors
  	    }
  	    try {
  		os.close();
  	    } catch (IOException e) {
  		// ignore close errors
  	    }
  	}
      }
docs: Writes a resource file to disk. The resource file is looked up in the
  classpath
  
  @param filename
  name of the file, to be looked up in the classpath, under the
  same package as this class.
  @return outputDir directory of output file. Output file will be named the
  same as the <code>filename</code> parameter.