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, timezoneFields 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 TypeMethodDescriptionvoidadd(Iterator<? extends AbstractFeature> features) Appends new feature instances in thisFeatureSet.booleanremoveIf(Predicate<? super AbstractFeature> filter) Removes all feature instances from thisFeatureSetwhich matches the given predicate.voidreplaceIf(Predicate<? super AbstractFeature> filter, UnaryOperator<AbstractFeature> replacement) Updates all feature instances from thisFeatureSetwhich match the given predicate.private Updaterupdater()Returns the helper object to use for updating the GPX file.voidupdateType(DefaultFeatureType newType) Verifies the type of feature instances in this feature set.voidwrite(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, setVersionMethods inherited from class org.apache.sis.internal.storage.xml.stream.StaxDataStore
getFormatName, getProviderMethods inherited from class org.apache.sis.internal.storage.URIDataStore
addTitleOrIdentifier, getComponentFiles, getIdentifier, getOpenParameters, getOriginator, getSpecifiedPath, location, parametersMethods inherited from class org.apache.sis.storage.DataStore
addListener, findResource, getDisplayName, getLocale, getNativeMetadata, removeListener, setLocale, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.sis.storage.DataSet
getEnvelopeMethods inherited from interface org.apache.sis.storage.FeatureSet
features, getType, subsetMethods 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, ornullif 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 throwsIllegalFeatureTypeExceptionotherwise.- Specified by:
updateTypein 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 thisFeatureSetwill remain unmodified.- Specified by:
addin 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 thisFeatureSetwhich matches the given predicate.- Specified by:
removeIfin interfaceWritableFeatureSet- Parameters:
filter- a predicate which returnstruefor feature instances to be removed.- Returns:
trueif 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 thisFeatureSetwhich match the given predicate. If the given operator returnsnull, then the filtered feature is removed.- Specified by:
replaceIfin interfaceWritableFeatureSet- Parameters:
filter- a predicate which returnstruefor feature instances to be updated.replacement- operation called for each matchingFeatureinstance. 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, ornullif none.features- the features to write, ornullif none.- Throws:
ConcurrentReadException- if thefeaturesstream 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.