/** * Writes the data to the file. Binary data will be added. * * @param file The file to handle. * @param ome The element to write to the file. * @throws Exception Thrown if an error occurred while writing the XML file. */ public void writeFile(File file, OME ome) throws Exception { writeFile(file, ome, true); }
/** * Writes the data to the file. * * @param file The file to handle. * @param ome The element to write to the file. * @param binaryData Pass <code>true</code> to add the binary data, * <code>false</code> otherwise. * @throws Exception Thrown if an error occurred while writing the XML file. */ public void writeFile(File file, OME ome, boolean binaryData) throws Exception { String values = createXMLDocument(ome, binaryData); copyValues(file, values.getBytes()); //validate(file); }
/** * Generates an <code>OME-XML</code> file. * * @param index The type of image to import. One of the constants defined * by this class. * @return The image file. * @throws Exception Thrown if an error occurred. */ private File createImageFile(int index) throws Exception { // First create an image File f = File.createTempFile("tempFileName","." + OME_XML); XMLMockObjects xml = new XMLMockObjects(); XMLWriter writer = new XMLWriter(); if (index == IMAGE_ROI) { writer.writeFile(f, xml.createImageWithROI(), true); } else if (index == IMAGE_ANNOTATED_DATA) { writer.writeFile(f, xml.createImageWithAnnotatedAcquisitionData(), true); } else { writer.writeFile(f, xml.createImageWithAcquisitionData(), true); } return f; }