Class SessionWriter.ExportSupport

java.lang.Object
org.openstreetmap.josm.io.session.SessionWriter.ExportSupport
Enclosing class:
SessionWriter

public class SessionWriter.ExportSupport extends Object
A class that provides some context for the individual SessionLayerExporter when doing the export.
  • Field Details

  • Constructor Details

    • ExportSupport

      public ExportSupport(Document doc, int layerIndex)
      Constructs a new ExportSupport.
      Parameters:
      doc - XML document
      layerIndex - layer index
  • Method Details

    • createElement

      public Element createElement(String name)
      Creates an element of the type specified.
      Parameters:
      name - The name of the element type to instantiate
      Returns:
      A new Element object
      See Also:
    • createTextNode

      public Text createTextNode(String text)
      Creates a text node given the specified string.
      Parameters:
      text - The data for the node.
      Returns:
      The new Text object.
      See Also:
    • getLayerIndex

      public int getLayerIndex()
      Get the index of the layer that is currently exported.
      Returns:
      the index of the layer that is currently exported
    • getLayerIndexOf

      public int getLayerIndexOf(Layer layer)
      Get the index of the specified layer
      Parameters:
      layer - the layer
      Returns:
      the index of the specified layer
      Since:
      18466
    • getOutputStreamZip

      Create a file inside the zip archive.
      Parameters:
      zipPath - the path inside the zip archive, e.g. "layers/03/data.xml"
      Returns:
      the OutputStream you can write to. Never close the returned output stream, but make sure to flush buffers.
      Throws:
      IOException - if any I/O error occurs
    • isZip

      public boolean isZip()
      Check, if the session is exported as a zip archive.
      Returns:
      true, if the session is exported as a zip archive (.joz file extension). It will always return true, if one of the SessionLayerExporter returns true for the SessionLayerExporter.requiresZip() method. Otherwise, the user can decide in the file chooser dialog.