ChunkedFileOutputStream
class ChunkedFileOutputStream(val filesDir: File, chunkSize: Int, chunkNameGenerator: (Int) -> String = { id -> "chunk_$id" }, listener: ChunkedFileOutputStream.Listener = object : Listener {}) : OutputStream
A class that allows to write into multiple files. It is useful when you want to upload a file to a server but you don't want to wait for the record to finish before. Use this class as an OutputStream of a IFileStreamer.
Parameters
filesDir
the directory where the files will be written
chunkSize
the size of each file in bytes
chunkNameGenerator
generate the name of each file from its index
listener
the listener that will be called when a file is created
Constructors
Link copied to clipboard
constructor(filesDir: File, chunkSize: Int, chunkNameGenerator: (Int) -> String = { id -> "chunk_$id" }, listener: ChunkedFileOutputStream.Listener = object : Listener {})
Types
Link copied to clipboard
interface Listener
Listener for ChunkedFileOutputStream
Functions
Link copied to clipboard
Close the stream. This will close the current file and call Listener.onFileClosed with the last file.