gps_history_persist library Null safety

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


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.
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.
Persister for GpcCompactGpsMeasurement.
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.
Represents the signature and version data of Persistence and Persister.
As the Persistence class is itself stateless, it uses the StreamReaderState class to maintain and feed it with information from a stream.
Utility class for writing various data types to a Sink.


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 collection 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

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