@Override public void notifyShutdown(ShutdownEvent event) { try { this.writer.close(); } catch (IOException e) { throw new UncheckedIOException( e ); } }
@Test public void testNotExistant() { try { new MatsimFileTypeGuesser("examples/equil/dummy.xml"); fail("expected IOException"); } catch (UncheckedIOException e) { log.info("catched expected exception: " + e.getMessage()); } }
@Override public void notifyBeforeMobsim(BeforeMobsimEvent event) { try { this.writer.flush(); } catch (IOException e) { throw new UncheckedIOException( e ); } } }
public void write(char c) { if (writer != null) try { writer.write(c); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void close() { try { writer.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void flush() { try { writer.flush(); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void notifyShutdown(ShutdownEvent event) { try { this.writer.close(); } catch (IOException e) { throw new UncheckedIOException( e ); } }
@Override public void notifyBeforeMobsim(BeforeMobsimEvent event) { try { this.writer.flush(); } catch (IOException e) { throw new UncheckedIOException( e ); } } }
private void writeHeader() { try { this.out.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<events version=\"1.0\">\n"); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void write(char[] c) { if (writer != null) try { writer.write(c); } catch (IOException e) { throw new UncheckedIOException(e); } }
/** * Writes the doctype declaration to the output. * * @param rootTag The root tag of the written XML document. * @param dtdUrl The location of the document type definition of this XML document. * @throws UncheckedIOException */ protected final void writeDoctype(String rootTag, String dtdUrl) throws UncheckedIOException { try { this.writer.write("<!DOCTYPE " + rootTag + " SYSTEM \"" + dtdUrl + "\">\n"); } catch (IOException e) { throw new UncheckedIOException(e); } }
public void write(String s) { if (writer != null) { try { writer.write(s); } catch (IOException e) { System.err.println("writer was not initialized yet!"); throw new UncheckedIOException(e); } } }
@Override void endConfig(final BufferedWriter out) throws UncheckedIOException { try { out.write("</config>"); out.write(this.newline); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override void startConfig( final Config config, final BufferedWriter out) { try { out.write("<"+CONFIG+">"); out.write( this.newline ); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override public void closeFile() { try { this.out.write("</events>"); // I added a "\n" to make it look nicer on the console. Can't say if this may have unintended side // effects anywhere else. kai, oct'12 // fails signalsystems test (and presumably other tests in contrib/playground) since they compare // checksums of event files. Removed that change again. kai, oct'12 this.out.close(); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override void writeSeparator(final BufferedWriter out) throws UncheckedIOException { try { out.write("<!-- ====================================================================== -->"); out.write(this.newline); out.write(this.newline); } catch (IOException e) { throw new UncheckedIOException(e); } } }
@Override void startConfig(final Config config, final BufferedWriter out) throws UncheckedIOException { try { out.write("<config>"); out.write(this.newline); out.write(this.newline); } catch (IOException e) { throw new UncheckedIOException(e); } }
@Override void endConfig( final BufferedWriter out) { try { out.write( this.newline ); out.write("</"+CONFIG+">"); out.write( this.newline ); } catch (IOException e) { throw new UncheckedIOException(e); } }
/** * Writes the standard xml 1.0 header to the output. * * @throws UncheckedIOException */ protected final void writeXmlHead() throws UncheckedIOException { try { this.writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); if (doPrettyPrint) { this.writer.write(NL); } } catch (IOException e) { throw new UncheckedIOException(e); } }
public static InputStream getInputStream(URL url) throws UncheckedIOException { try { if (url.getFile().endsWith(".gz")) { return new GZIPInputStream(url.openStream()); } else { return url.openStream(); } } catch (IOException e) { throw new UncheckedIOException(e); } }