コード例 #1
0
 protected void saveGlyphFile(File a_file) throws FileNotFoundException {
   FileOutputStream output = new FileOutputStream(a_file);
   saveGlyphFile(output);
   try {
     output.close(); // JPEXS
   } catch (IOException ex) {
     Logger.getLogger(GlyphFile.class.getName()).log(Level.SEVERE, null, ex);
   }
 }
コード例 #2
0
ファイル: Chemkin.java プロジェクト: ecintron/RMG-Java
 private void copyFiles(String string, String string2) {
   File src = new File(string);
   File dest = new File(string2);
   FileInputStream fin;
   try {
     fin = new FileInputStream(src);
     FileOutputStream fout = new FileOutputStream(dest);
     int c;
     while ((c = fin.read()) >= 0) fout.write(c);
     fin.close();
     fout.close();
   } catch (FileNotFoundException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (IOException e) {
     e.printStackTrace();
   }
 }
コード例 #3
0
 /**
  * Writes an XML file from a Document object.
  *
  * @param doc the Document object to be written to file
  * @param file the file to be written
  * @throws IOException
  * @author Klaus Meffert
  * @since 2.0
  */
 public static void writeFile(Document doc, File file) throws IOException {
   // Use a Transformer for output
   TransformerFactory tFactory = TransformerFactory.newInstance();
   Transformer transformer;
   try {
     transformer = tFactory.newTransformer();
   } catch (TransformerConfigurationException tex) {
     throw new IOException(tex.getMessage());
   }
   DOMSource source = new DOMSource(doc);
   FileOutputStream fos = new FileOutputStream(file);
   StreamResult result = new StreamResult(fos);
   try {
     transformer.transform(source, result);
     fos.close();
   } catch (TransformerException tex) {
     throw new IOException(tex.getMessage());
   }
 }