create

suspend fun create(dataSource: RandomAccessDataSource, zipResourceProviderOptions: ZipResourceProviderOptions = ZipResourceProviderOptions()): ColibrioResult<ZipResourceProvider>

Creates a new ZipResourceProvider using byte data provided by dataSource. The dataSource must return data from a valid ZIP file, such as an EPUB file for example.

Return

Either ColibrioResult.Success with the created ZipResourceProvider when successful, or ColibrioResult.Error containing the error.

Parameters

dataSource

A RandomAccessDataSource used for reading the ZIP archive.

zipResourceProviderOptions

options for creating the ZipResourceProvider.


fun create(dataSource: RandomAccessDataSource, serializedZipArchiveInformation: ByteArray, chunkCacheSize: Int = DEFAULT_CACHE_SIZE, onSuccess: (ZipResourceProvider) -> Unit, onError: (ColibrioException) -> Unit)

Deprecated

Use ZipResourceProvider.create(dataSource: RandomAccessDataSource, zipResourceProviderOptions: ZipResourceProviderOptions) instead.

Replace with

ZipResourceProvider.create(dataSource = dataSource, zipResourceProviderOptions = zipResourceProviderOptions)

Create a new instance of ZipResourceProvider using a RandomAccessDataSource to read the ZIP archive and serialized ZipArchiveInformation in binary format describing the ZIP archive.

You can get a serialized ZipArchiveInformation in binary format from ZipResourceProvider.serializedZipArchiveInformation. If you don't have access to serialized ZipArchiveInformation, you can create a new ZipResourceProvider with ReadingSystemEngine.createZipResourceProvider instead.

This method will fail and invoke onError if you call it with invalid data or with ZipArchiveInformation data that does not match the ZIP archive.

Parameters

dataSource

A RandomAccessDataSource used for reading the ZIP archive.

serializedZipArchiveInformation

Serialized information about this ZIP archive.

chunkCacheSize

The size of the chunk cache in bytes. Defaults to 16 MB.

onSuccess

Called with the new ZipResourceProvider if the operation is successful.

onError

Called if the operation fails.


suspend fun create(dataSource: RandomAccessDataSource, serializedZipArchiveInformation: ByteArray, chunkCacheSize: Int = DEFAULT_CACHE_SIZE): ColibrioResult<ZipResourceProvider>

Deprecated

Use ZipResourceProvider.create(dataSource: RandomAccessDataSource, zipResourceProviderOptions: ZipResourceProviderOptions) instead.

Replace with

ZipResourceProvider.create(dataSource = dataSource, zipResourceProviderOptions = zipResourceProviderOptions)

Create a new instance of ZipResourceProvider using a RandomAccessDataSource to read the ZIP archive and serialized ZipArchiveInformation in binary format describing the ZIP archive.

You can get a serialized ZipArchiveInformation in binary format from ZipResourceProvider.serializedZipArchiveInformation. If you don't have access to serialized ZipArchiveInformation, you can create a new ZipResourceProvider with ReadingSystemEngine.createZipResourceProvider instead.

This method will fail and return a ColibrioResult.Error if you call it with invalid data or with ZipArchiveInformation data that does not match the ZIP archive.

Return

Either ColibrioResult.Success containing ZipResourceProvider instance or ColibrioResult.Error containing the error.

Parameters

dataSource

A RandomAccessDataSource used for reading the ZIP archive.

serializedZipArchiveInformation

Serialized information about this ZIP archive.

chunkCacheSize

The size of the chunk cache in bytes. Defaults to 16 MB.