/** * If you call this method, you're responsible for setting up the * right encoding for the Writer @param w. */ public void write(java.io.Writer w) throws IOException, Schema2BeansException { write(w, null); }
public void dumpXml() { try { write(System.out); } catch (IOException ee) { ee.printStackTrace(); } }
public void write(File f) throws IOException, Schema2BeansRuntimeException { OutputStream out = new FileOutputStream(f); try { write(out); } finally { out.close(); } }
/** * Replace the content of the document by the graph. */ public static void replaceDocument(final StyledDocument doc, BaseBean graph) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); try { graph.write(out); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } NbDocument.runAtomic(doc, new Runnable() { public void run() { try { doc.remove(0, doc.getLength()); doc.insertString(0, out.toString(), null); } catch (BadLocationException ble) { Exceptions.printStackTrace(ble); } } }); }
/** * Replace the content of the document by the graph. */ private static void replaceDocument(final StyledDocument doc, BaseBean graph) { final StringWriter out = new StringWriter(); try { graph.write(out); } catch (Schema2BeansException ex) { Logger.getLogger(TomcatModuleConfiguration.class.getName()).log(Level.INFO, null, ex); } catch (IOException ioe) { Logger.getLogger(TomcatModuleConfiguration.class.getName()).log(Level.INFO, null, ioe); } NbDocument.runAtomic(doc, new Runnable() { public void run() { try { doc.remove(0, doc.getLength()); doc.insertString(0, out.toString(), null); } catch (BadLocationException ble) { Exceptions.printStackTrace(ble); } } }); }
public void run() throws IOException { OutputStream os = null; FileLock lock = null; try { String name = file.getName(); FileObject configFO = deployDir.getFileObject(name); if (configFO == null) { configFO = deployDir.createData(name); } lock = configFO.lock(); os = new BufferedOutputStream (configFO.getOutputStream(lock), 4096); // TODO notification needed if (bean != null) { bean.write(os); } } finally { if (os != null) { try { os.close(); } catch(IOException ioe) {} } if (lock != null) lock.releaseLock(); } } });
public void run() throws IOException { OutputStream os = null; FileLock lock = null; try { String name = file.getName(); FileObject configFO = folder.getFileObject(name); if (configFO == null) { configFO = folder.createData(name); } lock = configFO.lock(); os = new BufferedOutputStream (configFO.getOutputStream(lock), 4086); // TODO notification needed if (bean != null) { bean.write(os); } } finally { if (os != null) { try { os.close(); } catch(IOException ioe) {} } if (lock != null) lock.releaseLock(); } } });
this.getBean().write(System.err); System.err.println(this.getBean().dumpDomNode()); } catch (java.io.IOException e2) {
public void run() throws IOException { String name = file.getName(); FileObject configFO = folder.getFileObject(name); if (configFO == null) { configFO = folder.createData(name); } T ctx = null; try { ctx = store.getValue(); } catch (ConfigurationException e) { // propagate exception out to the outer class anonClassException[0] = e; return; } FileLock lock = configFO.lock(); try { OutputStream os = new BufferedOutputStream(configFO.getOutputStream(lock), 4096); try { if (ctx != null) { ctx.write(os); } } finally { os.close(); } } finally { lock.releaseLock(); } } });