/** * Opens the specified file for writing. * * @param filename * @throws UncheckedIOException */ protected final void openFile(final String filename) throws UncheckedIOException { assertNotAlreadyOpen(); if (this.useCompression == null) { this.writer = IOUtils.getBufferedWriter(filename); } else { this.writer = IOUtils.getBufferedWriter(filename, this.useCompression); } }
public OsmXmlParser(final Map<Long, OsmNode> nodes, final Map<Long, OsmWay> ways, final CoordinateTransformation transform) { super(); this.nodes = nodes; this.ways = ways; this.transform = transform; this.setValidating(false); }
/** * Writes a start tag with all attributes on the writer * @param tagname * @param attributes * @throws UncheckedIOException */ protected final void writeStartTag(String tagname, List<Tuple<String, String>> attributes) throws UncheckedIOException{ this.writeStartTag(tagname, attributes, false); }
@Override public void notifyStartup(final StartupEvent event) { this.writer = IOUtils.getBufferedWriter( outPath ); try { this.writer.write( "iter\tagentId\tgroup\tstrategy" ); } catch (IOException e) { throw new UncheckedIOException( e ); } }
/** * Tries to open the specified file for writing and returns a BufferedWriter for it. * If the filename ends with ".gz", data will be automatically gzip-compressed. * * @param filename The filename where to write the data. * @param charset the encoding to use to write the file. * @return BufferedWriter for the specified file. * @throws UncheckedIOException */ public static BufferedWriter getBufferedWriter(final String filename, final Charset charset) throws UncheckedIOException { return getBufferedWriter(filename, charset, false); }
@Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); }
/** * Parses the given input stream and creates a MATSim network from the data. * * @param stream * @throws UncheckedIOException */ public final void parse(final InputStream stream) throws UncheckedIOException { parse(null, stream); }
@Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { this.delegate.startTag(name, atts, context); }
@Override public void characters(char[] ch, int start, int length) throws SAXException { if (this.readCharacters) { super.characters(ch, start, length); } // ignore characters to prevent OutOfMemoryExceptions /* non-validating files contain empty tags with attributes, * but without the dtd or schema, all whitespace between tags is handled * by characters and added up by super.characters, consuming huge * amount of memory when large files are read in. */ }
/** * Override this method if you want to use another way to figure out if one can travel on this link in forward direction. */ protected boolean forwardDirectionExists(OsmWay way) { return !isOnewayReverse(way); }
/** * Override this method if you want to use another way to figure out if one can travel on this link in reverse direction. */ protected boolean reverseDirectionExists(OsmWay way) { return !isOneway(way); }
public ObjectAttributesXmlReader(final ObjectAttributes attributes) { this.attributes = attributes; super.setValidating(false); }
void openHere(String filename ) { super.openFile(filename); } void closeHere() {
void closeHere() { super.close() ; } }
@Override public void notifyStartup(final StartupEvent event) { this.writer = IOUtils.getBufferedWriter( outPath ); try { this.writer.write( "iter\tgroupSize\tstrategy" ); } catch (IOException e) { throw new UncheckedIOException( e ); } }
@Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); }
/** * Parses the given osm file and creates a MATSim network from the data. * * @param osmFilename * @throws UncheckedIOException */ public final void parse(final String osmFilename) { parse(osmFilename, null); }
public PlansParser(final String outFile) { writer = IOUtils.getBufferedWriter( outFile ); try { writer.write( "driverId\tdirectDistance\taccessDistance\tjointDistance\tegressDistance" ); } catch (IOException e) { throw new UncheckedIOException( e ); } }
@Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); }
@Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); }