gps_history_persist library

The GPS History Persistence library provides persistence related facilities for the GPS History library.

Classes

Persistence
The Persistence class should be used as a singleton (call Persistence.get) that can write and potentially read GpsPointsView instances to StreamSink respectively from Stream instances. Reading from streams requires the view to be modifiable, which not all views are.
Persister
Children of Persister implement the actual reading and writing of particular types of GpsPointsView descendants. They must be stateless w.r.t. to the data they are persisting, the only data they are allowed to contain are generic information such as their own version number and signature.
PGpcCompactGpsMeasurement
Persister for GpcCompactGpsMeasurement.
PGpcCompactGpsPoint
Persister for GpcCompactGpsPoint.
PGpcEfficient<T extends GpcEfficient<GpsPoint>>
Abstract persister for GpcEfficient. Child classes should be created for specific children of GpcEfficient, providing overriddes for methods/properties like supportedType and signatureAndVersion.
SignatureAndVersion
Represents the signature and version data of Persistence and Persister.
StreamReaderState
As the Persistence class is itself stateless, it uses the StreamReaderState class to maintain and feed it with information from a stream.
StreamSinkWriter
Utility class for writing various data types to a Sink.

Functions

getFirstNonAsciiCharIndex(String string) int?
Returns, if any, the index of the first non-ASCII character in the string. If the string is either empty or all-ASCII, null is returned.
initializeDefaultPersisters() → void
Function that creates and registers the default persisters for the built-in container types. Call it from the calling code's main() function for example, unless you want to do your own persistence registration from scratch.
isValidAsciiChar(int codeUnit) bool
Determines if codeUnit is between SPACE (ASCII 32) and ~ (ASCII 126).

Exceptions / Errors

ConflictingPersisterException
An exception raised if there is an attempt to register conflicting persisters (e.g. multiple of them with the same signature).
InvalidMetadataException
An exception raised if trying to set an invalid metadata (e.g incorrect length).
InvalidSignatureException
An exception raised if trying to set an invalid signature (e.g incorrect length).
NewerVersionException
An exception raised if trying to read data from a stream written with a newer version of the streaming method or of the persister.
NoPersisterException
An exception raised if no persister is found for a particular object.
NotEmptyContainerException
An exception raised if trying to read data into an object that's not empty.
ReadonlyContainerException
An exception raised if trying to read data into a readonly object.