Class Updater
java.lang.Object
org.apache.sis.internal.storage.xml.stream.RewriteOnUpdate
org.apache.sis.internal.storage.gpx.Updater
- All Implemented Interfaces:
AutoCloseable
Updates the content of a GPX file by rewriting it.
- Since:
- 1.3
- Version:
- 1.3
-
Field Summary
FieldsFields inherited from class org.apache.sis.internal.storage.xml.stream.RewriteOnUpdate
source
-
Constructor Summary
ConstructorsConstructorDescriptionUpdater
(WritableStore source, Path location) Creates an updater for the given source of features. -
Method Summary
Modifier and TypeMethodDescriptionprotected Path
Creates an initially empty temporary file.protected StaxStreamWriter
createWriter
(OutputStream temporary) Creates a new GPX writer for an output in the specified file.protected Stream<? extends AbstractFeature>
features()
Returns the stream of features to copy.
-
Field Details
-
metadata
The metadata to write.
-
-
Constructor Details
-
Updater
Updater(WritableStore source, Path location) throws IOException Creates an updater for the given source of features.- Parameters:
source
- the set of features to update.location
- the main file, ornull
if unknown.- Throws:
IOException
- if an error occurred while determining whether the file is empty.
-
-
Method Details
-
features
Returns the stream of features to copy.- Overrides:
features
in classRewriteOnUpdate
- Returns:
- all features contained in the dataset.
- Throws:
DataStoreException
- if an error occurred while fetching the features.
-
createTemporaryFile
Creates an initially empty temporary file.- Specified by:
createTemporaryFile
in classRewriteOnUpdate
- Returns:
- the temporary file.
- Throws:
IOException
- if an error occurred while creating the temporary file.
-
createWriter
Creates a new GPX writer for an output in the specified file.- Specified by:
createWriter
in classRewriteOnUpdate
- Parameters:
temporary
- the temporary stream where to write, ornull
for writing directly in the store file.- Returns:
- the writer where to copy updated features.
- Throws:
Exception
- if an error occurred while creating the writer.
-