Class FileMillisecondStoreDataProvider
- All Implemented Interfaces:
MillisecondStoreDataProvider
ExternalResourceMillisecondStoreDataProvider
loads binary streams of long values from a file.
Please see ExternalResourceMillisecondStoreDataProvider
for more details regarding the external resource mechanism.
The FileMillisecondStoreDataProvider
is useful for applications that want to load the numbers of milliseconds from
the official lukashian.org server, but don't have access to the Internet. If you want to use this class to load the exact same
numbers as the StandardEarthHttpMillisecondStoreDataProvider
, then you can simply perform requests to the location specified
in the StandardEarthHttpMillisecondStoreDataProvider
, extended with the default locations specified in
ExternalResourceMillisecondStoreDataProvider
, for example:
curl -L https://lukashian.org/millisecondstore/standardearth/unixEpochOffset -o unixEpochOffsetAlternatively, you can simply use a browser to obtain the file at the above example url.
-
Field Summary
Fields inherited from class org.lukashian.store.external.ExternalResourceMillisecondStoreDataProvider
DEFAULT_DAY_EPOCH_MILLISECONDS_EXTENSION, DEFAULT_UNIX_EPOCH_OFFSET_EXTENSION, DEFAULT_YEAR_EPOCH_MILLISECONDS_EXTENSION
-
Constructor Summary
ConstructorsConstructorDescriptionFileMillisecondStoreDataProvider
(String basePath) FileMillisecondStoreDataProvider
(String basePath, String unixEpochOffsetPathExtension, String yearEpochMillisecondsPathExtension, String dayEpochMillisecondsPathExtension) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
Loads an array of bytes from the specified location.Methods inherited from class org.lukashian.store.external.ExternalResourceMillisecondStoreDataProvider
loadDayEpochMilliseconds, loadUnixEpochOffsetMilliseconds, loadYearEpochMilliseconds
-
Constructor Details
-
FileMillisecondStoreDataProvider
-
FileMillisecondStoreDataProvider
-
-
Method Details
-
loadMillisecondsByteArray
Description copied from class:ExternalResourceMillisecondStoreDataProvider
Loads an array of bytes from the specified location. This location is a concatenation of the base location and one of the extensions, depending on which of the values needs loading.This method needs to return a binary stream from the specified location. This binary stream should encode the long values that represent the milliseconds. Each consecutive 8 bytes of the stream should correspond to an individual millisecond. This binary stream is then decoded into an array of longs. For the unix epoch offset, only a single long value (i.e. 8 bytes) should be returned in the binary stream.
- Specified by:
loadMillisecondsByteArray
in classExternalResourceMillisecondStoreDataProvider
- Throws:
IOException
-