StorageProvider

interface StorageProvider

Storage services are provided to the SudoAdTrackerBlockerClient by classes that implement this interface.

Functions

Link copied to clipboard
abstract fun delete(fileName: String): Boolean

Delete a file.

Link copied to clipboard
abstract fun deleteFileETag(fileName: String): Boolean

Delete the eTag of a file.

Link copied to clipboard
abstract fun deleteFileETags()

Delete all the file eTags managed by the StorageProvider.

Link copied to clipboard
abstract fun deleteFiles()

Delete all the files managed by the StorageProvider.

Link copied to clipboard
abstract fun deletePreferences()

Delete the set of preferences.

Link copied to clipboard

List all the files in the storage provider.

Link copied to clipboard
abstract fun read(fileName: String): ByteArray?

Reads all the bytes from a file.

Link copied to clipboard
abstract fun readFileETag(fileName: String): String?

Reads the eTag of a file, returns null if the file does not exist.

Link copied to clipboard
abstract fun readPreferences(): Map<String, String>

Reads the preferences from storage. Preference storage might be restricted by implementations to a maximum size. It should not be considered appropriate to store large amounts of data in the preferences.

Link copied to clipboard
abstract fun write(fileName: String, data: ByteArray)

Writes all the bytes to a file.

Link copied to clipboard
abstract fun writeFileETag(fileName: String, eTag: String)

Writes the eTag of a file.

Link copied to clipboard
abstract fun writePreferences(preferences: Map<String, String>)

Writes the preferences to storage. Preference storage might be restricted by implementations to a maximum size. It should not be considered appropriate to store large amounts of data in the preferences.