DataSink

abstract class DataSink

A consumer of data.

An abstraction over the byte stream reading operations, this class allows for a flexible way to read bytes from a BufferedSource.

  • The create method can be used for writing data to a file.
  • For any other cases just extend the class and do your magic in the readAll method.

Functions

create
Link copied to clipboard
open fun create(file: File): DataSink
Create a DataSink instance that writes data to a file.
readAll
Link copied to clipboard
abstract fun readAll(source: BufferedSource)
Reads all bytes from a source Do any reading here.