Class WritableStore
java.lang.Object
org.apache.sis.storage.DataStore
org.apache.sis.internal.storage.URIDataStore
org.apache.sis.internal.storage.xml.stream.StaxDataStore
org.apache.sis.internal.storage.gpx.Store
org.apache.sis.internal.storage.gpx.WritableStore
- All Implemented Interfaces:
AutoCloseable
,ResourceOnFileSystem
,StoreResource
,DataSet
,FeatureSet
,Resource
,WritableFeatureSet
,Localized
A GPX store capable to write GPX file.
- Since:
- 1.3
- Version:
- 1.3
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.internal.storage.URIDataStore
URIDataStore.Provider
-
Field Summary
Fields inherited from class org.apache.sis.internal.storage.xml.stream.StaxDataStore
encoding, locale, timezone
Fields inherited from class org.apache.sis.internal.storage.URIDataStore
location
-
Constructor Summary
ConstructorsConstructorDescriptionWritableStore
(StoreProvider provider, StorageConnector connector) Creates a new GPX store from the given file, URL or stream object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Iterator<? extends AbstractFeature> features) Appends new feature instances in thisFeatureSet
.boolean
removeIf
(Predicate<? super AbstractFeature> filter) Removes all feature instances from thisFeatureSet
which matches the given predicate.void
replaceIf
(Predicate<? super AbstractFeature> filter, UnaryOperator<AbstractFeature> replacement) Updates all feature instances from thisFeatureSet
which match the given predicate.private Updater
updater()
Returns the helper object to use for updating the GPX file.void
updateType
(DefaultFeatureType newType) Verifies the type of feature instances in this feature set.void
write
(org.opengis.metadata.Metadata metadata, Stream<? extends AbstractFeature> features) Deprecated.Methods inherited from class org.apache.sis.internal.storage.gpx.Store
close, closeReader, features, getEnvelope, getFeatureType, getFormat, getMetadata, getType, getVersion, setVersion
Methods inherited from class org.apache.sis.internal.storage.xml.stream.StaxDataStore
getFormatName, getProvider
Methods inherited from class org.apache.sis.internal.storage.URIDataStore
addTitleOrIdentifier, getComponentFiles, getIdentifier, getOpenParameters, getOriginator, getSpecifiedPath, location, parameters
Methods inherited from class org.apache.sis.storage.DataStore
addListener, findResource, getDisplayName, getLocale, getNativeMetadata, removeListener, setLocale, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.sis.storage.DataSet
getEnvelope
Methods inherited from interface org.apache.sis.storage.FeatureSet
features, getType, subset
Methods inherited from interface org.apache.sis.storage.Resource
addListener, getIdentifier, getMetadata, removeListener
-
Constructor Details
-
WritableStore
Creates a new GPX store from the given file, URL or stream object. This constructor invokesStorageConnector.closeAllExcept(Object)
, keeping open only the needed resource.- Parameters:
provider
- the provider of this data store, ornull
if unspecified.connector
- information about the storage (URL, stream, etc).- Throws:
DataStoreException
- if an error occurred while opening the GPX file.
-
-
Method Details
-
updateType
Verifies the type of feature instances in this feature set. This method does nothing if the specified type is equal toStore.getType()
, or throwsIllegalFeatureTypeException
otherwise.- Specified by:
updateType
in interfaceWritableFeatureSet
- Parameters:
newType
- new feature type definition (notnull
).- Throws:
DataStoreException
- if the given type is not compatible with the types supported by the store.
-
add
Appends new feature instances in thisFeatureSet
. Any feature already present in thisFeatureSet
will remain unmodified.- Specified by:
add
in interfaceWritableFeatureSet
- Parameters:
features
- feature instances to append in thisFeatureSet
.- Throws:
DataStoreException
- if the feature stream cannot be obtained or updated.
-
removeIf
Removes all feature instances from thisFeatureSet
which matches the given predicate.- Specified by:
removeIf
in interfaceWritableFeatureSet
- Parameters:
filter
- a predicate which returnstrue
for feature instances to be removed.- Returns:
true
if any elements were removed.- Throws:
DataStoreException
- if the feature stream cannot be obtained or updated.
-
replaceIf
public void replaceIf(Predicate<? super AbstractFeature> filter, UnaryOperator<AbstractFeature> replacement) throws DataStoreException Updates all feature instances from thisFeatureSet
which match the given predicate. If the given operator returnsnull
, then the filtered feature is removed.- Specified by:
replaceIf
in interfaceWritableFeatureSet
- Parameters:
filter
- a predicate which returnstrue
for feature instances to be updated.replacement
- operation called for each matchingFeature
instance. May returnnull
.- Throws:
DataStoreException
- if the feature stream cannot be obtained or updated.
-
updater
Returns the helper object to use for updating the GPX file.- Throws:
DataStoreException
-
write
@Deprecated public void write(org.opengis.metadata.Metadata metadata, Stream<? extends AbstractFeature> features) throws DataStoreException Deprecated.To be replaced byadd(Iterator)
, after we resolved how to specify metadata.Replaces the content of this GPX file by the given metadata and features.- Parameters:
metadata
- the metadata to write, ornull
if none.features
- the features to write, ornull
if none.- Throws:
ConcurrentReadException
- if thefeatures
stream was provided by this data store.DataStoreException
- if an error occurred while writing the data.- See Also:
-
add(Iterator)
, after we resolved how to specify metadata.