Class OsmExporter

    • Constructor Detail

      • OsmExporter

        public OsmExporter()
        Constructs a new OsmExporter.
    • Method Detail

      • acceptFile

        public boolean acceptFile​(java.io.File pathname,
                                  Layer layer)
        Description copied from class: FileExporter
        Check if this exporter can export a certain layer to a certain file. Most exporters support just a single layer type.
        Overrides:
        acceptFile in class FileExporter
        Parameters:
        pathname - the target file name (check file extension using the FileExporter.filter
        layer - the layer requested for export
        Returns:
        true, if the exporter can handle the layer and filename is okay
      • exportData

        public void exportData​(java.io.File file,
                               Layer layer)
                        throws java.io.IOException
        Description copied from class: FileExporter
        Execute the data export. (To be overridden by subclasses.)
        Overrides:
        exportData in class FileExporter
        Parameters:
        file - target file
        layer - the layer to export
        Throws:
        java.io.IOException - in case of an IO error
      • exportData

        public void exportData​(java.io.File file,
                               Layer layer,
                               boolean isAutosave)
                        throws java.io.IOException
        Exports OSM data to the given file.
        Parameters:
        file - Output file
        layer - Data layer. Must be an instance of OsmDataLayer.
        isAutosave - if true, the potential backup file created if the output file already exists will be deleted after a successful export and post-save events won't be fired
        Throws:
        java.io.IOException - in case of IO errors
        java.nio.file.InvalidPathException - when file name cannot be converted into a Path
        java.lang.IllegalArgumentException - if layer is not an instance of OsmDataLayer
      • getOutputStream

        protected static java.io.OutputStream getOutputStream​(java.io.File file)
                                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • save

        private void save​(java.io.File file,
                          OsmDataLayer layer,
                          boolean isAutosave)
                   throws java.io.IOException
        Throws:
        java.io.IOException
      • doSave

        protected void doSave​(java.io.File file,
                              OsmDataLayer layer)
                       throws java.io.IOException
        Throws:
        java.io.IOException