WritingStrategy

interface WritingStrategy

WritingStrategy is used by the OutputStreamAdapter to determine how writing to the WritableDataProvider is handled. Writing works in three steps:

  1. prepare is called before any writing takes place.

  2. write is called until all data has been written.

  3. finishWriting is called once all data has been written.

It is the WritingStrategys responsibility to call OutputStreamAdapter.writeToDataProvider and OutputStreamAdapter.finishWritingToDataProvider at the appropriate times.

Inheritors

Functions

Link copied to clipboard
abstract fun finishWriting()

Called by the OutputStreamAdapter once the last byte was written. You should clear your reference to the OutputStreamAdapter at this time.

Link copied to clipboard
abstract fun prepare(adapter: OutputStreamAdapter)

Called by the OutputStreamAdapter before the first byte is written.

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

Called by the OutputStreamAdapter with the data that should be written.