Class SessionWriter.ExportSupport
- java.lang.Object
-
- org.openstreetmap.josm.io.session.SessionWriter.ExportSupport
-
- Enclosing class:
- SessionWriter
public class SessionWriter.ExportSupport extends java.lang.Object
A class that provides some context for the individualSessionLayerExporter
when doing the export.
-
-
Field Summary
Fields Modifier and Type Field Description private org.w3c.dom.Document
doc
private int
layerIndex
-
Constructor Summary
Constructors Constructor Description ExportSupport(org.w3c.dom.Document doc, int layerIndex)
Constructs a newExportSupport
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.Element
createElement(java.lang.String name)
Creates an element of the type specified.org.w3c.dom.Text
createTextNode(java.lang.String text)
Creates a text node given the specified string.int
getLayerIndex()
Get the index of the layer that is currently exported.int
getLayerIndexOf(Layer layer)
Get the index of the specified layerjava.io.OutputStream
getOutputStreamZip(java.lang.String zipPath)
Create a file inside the zip archive.boolean
isZip()
Check, if the session is exported as a zip archive.
-
-
-
Field Detail
-
doc
private final org.w3c.dom.Document doc
-
layerIndex
private final int layerIndex
-
-
Constructor Detail
-
ExportSupport
public ExportSupport(org.w3c.dom.Document doc, int layerIndex)
Constructs a newExportSupport
.- Parameters:
doc
- XML documentlayerIndex
- layer index
-
-
Method Detail
-
createElement
public org.w3c.dom.Element createElement(java.lang.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:
Document.createElement(java.lang.String)
-
createTextNode
public org.w3c.dom.Text createTextNode(java.lang.String text)
Creates a text node given the specified string.- Parameters:
text
- The data for the node.- Returns:
- The new
Text
object. - See Also:
Document.createTextNode(java.lang.String)
-
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
public java.io.OutputStream getOutputStreamZip(java.lang.String zipPath) throws java.io.IOException
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:
java.io.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 theSessionLayerExporter.requiresZip()
method. Otherwise, the user can decide in the file chooser dialog.
-
-