/** * Creates a new instance. * * @param file * The file to write. * @param compressionMethod * Specifies the compression method to employ. */ public XmlWriter(File file, CompressionMethod compressionMethod) { super(file, compressionMethod); osmWriter = new OsmWriter("osm", 0, true, false); }
/** * {@inheritDoc} */ @Override protected void setWriterOnElementWriter(BufferedWriter writer) { osmWriter.setWriter(writer); } }
/** * Begins an element. */ public void begin() { beginOpenElement(); if (renderAttributes) { addAttribute("version", XmlConstants.OSM_VERSION); addAttribute("generator", "Osmosis " + OsmosisConstants.VERSION); } endOpenElement(false); }
/** * {@inheritDoc} */ public void process(EntityContainer entityContainer) { initialize(); osmWriter.process(entityContainer); }
/** * Switch to another type of change. * @param action the action to apply to the next elements. */ private void updateActiveOsmWriter(final ChangeAction action) { if (action != lastAction) { if (activeOsmWriter != null) { activeOsmWriter.end(); } activeOsmWriter = getWriterForAction(action); activeOsmWriter.begin(); lastAction = action; } }
/** * {@inheritDoc} */ @Override protected void endElementWriter() { osmWriter.end(); }
/** * Ends an element. */ public void end() { closeElement(); }
/** * {@inheritDoc} */ @Override protected void beginElementWriter() { osmWriter.begin(); }
/** * {@inheritDoc} */ public void process(EntityContainer entityContainer) { initialize(); osmWriter.process(entityContainer); }
/** * Switch to another type of change. * @param action the action to apply to the next elements. */ private void updateActiveOsmWriter(final ChangeAction action) { if (action != lastAction) { if (activeOsmWriter != null) { activeOsmWriter.end(); } activeOsmWriter = getWriterForAction(action); activeOsmWriter.begin(); lastAction = action; } }
/** * {@inheritDoc} */ @Override protected void endElementWriter() { osmWriter.end(); }
/** * Ends an element. */ public void end() { closeElement(); }
/** * {@inheritDoc} */ @Override protected void beginElementWriter() { osmWriter.begin(); }
/** * Writes the change in the container. * * @param changeContainer * The container holding the change. */ public void process(final ChangeContainer changeContainer) { updateActiveOsmWriter(changeContainer.getAction()); activeOsmWriter.process(changeContainer.getEntityContainer()); } }
/** * Begins an element. */ public void begin() { beginOpenElement(); if (renderAttributes) { addAttribute("version", XmlConstants.OSM_VERSION); addAttribute("generator", "Osmosis " + OsmosisConstants.VERSION); } endOpenElement(false); }
/** * Creates a new instance. * * @param writer * The writer to send all data to. */ public XmlWriter(BufferedWriter writer) { super(writer); osmWriter = new OsmWriter("osm", 0, true, false); }
/** * {@inheritDoc} */ @Override protected void setWriterOnElementWriter(BufferedWriter writer) { osmWriter.setWriter(writer); } }
/** * Ends an <osmchange>-element. */ public void end() { if (activeOsmWriter != null) { activeOsmWriter.end(); activeOsmWriter = null; } lastAction = null; closeElement(); }
/** * Writes the change in the container. * * @param changeContainer * The container holding the change. */ public void process(final ChangeContainer changeContainer) { updateActiveOsmWriter(changeContainer.getAction()); activeOsmWriter.process(changeContainer.getEntityContainer()); } }