read

abstract fun read(size: Long, offset: Long): Array<Byte>

Called by PSPDFKit to read data from the document. The returned byte array can be reused in subsequent calls to prevent excessive allocations.

Return

Byte array with document data of the exact same size or larger size than size parameter. Implementations may not return null or loading will fail. Instead, when experiencing a read error, implementations may return NO_DATA_AVAILABLE to safely stop reading.

Parameters

size

Size of the data chunk to be read in bytes.

offset

Offset from start of document of the data chunk to be read in bytes.