Class SessionReader.ImportSupport
- java.lang.Object
-
- org.openstreetmap.josm.io.session.SessionReader.ImportSupport
-
- Enclosing class:
- SessionReader
public class SessionReader.ImportSupport extends Object
A class that provides some context for the individualSessionLayerImporter
when doing the import.
-
-
Field Summary
Fields Modifier and Type Field Description private String
inZipPath
Path of the file inside the zip archive.private List<SessionReader.LayerDependency>
layerDependencies
private int
layerIndex
private String
layerName
-
Constructor Summary
Constructors Constructor Description ImportSupport(String layerName, int layerIndex, List<SessionReader.LayerDependency> layerDependencies)
Constructs a newImportSupport
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPostLayersTask(Runnable task)
Add a task, e.g.File
getFile(String uriStr)
Return a File for a URI from a .jos/.joz file.InputStream
getInputStream(String uriStr)
Return an InputStream for a URI from a .jos/.joz file.List<SessionReader.LayerDependency>
getLayerDependencies()
Dependencies - maps the layer index to the importer of the given layer.int
getLayerIndex()
Index of the layer that is currently imported.String
getLayerName()
Name of the layer that is currently imported.boolean
isZip()
Determines if we are reading from a .joz file.String
toString()
-
-
-
Field Detail
-
layerIndex
private final int layerIndex
-
layerDependencies
private final List<SessionReader.LayerDependency> layerDependencies
-
-
Constructor Detail
-
ImportSupport
public ImportSupport(String layerName, int layerIndex, List<SessionReader.LayerDependency> layerDependencies)
Constructs a newImportSupport
.- Parameters:
layerName
- layer namelayerIndex
- layer indexlayerDependencies
- layer dependencies
-
-
Method Detail
-
addPostLayersTask
public void addPostLayersTask(Runnable task)
Add a task, e.g. a message dialog, that should be executed in EDT after all layers have been added.- Parameters:
task
- task to run in EDT
-
getInputStream
public InputStream getInputStream(String uriStr) throws IOException
Return an InputStream for a URI from a .jos/.joz file. The following forms are supported: - absolute file (both .jos and .joz): "file:///home/user/data.osm" "file:/home/user/data.osm" "file:///C:/files/data.osm" "file:/C:/file/data.osm" "/home/user/data.osm" "C:\files\data.osm" (not a URI, but recognized by File constructor on Windows systems) - standalone .jos files: - relative uri: "save/data.osm" "../project2/data.osm" - for .joz files: - file inside zip archive: "layers/01/data.osm" - relative to the .joz file: "../save/data.osm" ("../" steps out of the archive)- Parameters:
uriStr
- URI as string- Returns:
- the InputStream
- Throws:
IOException
- Thrown when no Stream can be opened for the given URI, e.g. when the linked file has been deleted.
-
getFile
public File getFile(String uriStr) throws IOException
Return a File for a URI from a .jos/.joz file. Returns null if the URI points to a file inside the zip archive. In this case, inZipPath will be set to the corresponding path.- Parameters:
uriStr
- the URI as string- Returns:
- the resulting File
- Throws:
IOException
- if any I/O error occurs
-
isZip
public boolean isZip()
Determines if we are reading from a .joz file.- Returns:
true
if we are reading from a .joz file,false
otherwise
-
getLayerName
public String getLayerName()
Name of the layer that is currently imported.- Returns:
- layer name
-
getLayerIndex
public int getLayerIndex()
Index of the layer that is currently imported.- Returns:
- layer index
-
getLayerDependencies
public List<SessionReader.LayerDependency> getLayerDependencies()
Dependencies - maps the layer index to the importer of the given layer. All the dependent importers have loaded completely at this point.- Returns:
- layer dependencies
-
-