KFileOutputStream

A KFileOutputStream is an asynchronous file output stream that supports coroutine-based non-blocking I/O operations.

This class is equivalent to the java.io.FileOutputStream.

Parameters

path

The path to the file to write.

context

The context to use for I/O operations.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open suspend override fun close()

Closes this file output stream and releases any system resources associated with this stream. This file output stream may no longer be used for writing bytes.

Link copied to clipboard
open suspend fun flush()

Flushes this output stream and forces any buffered output bytes to be written out.

Link copied to clipboard
open suspend override fun write(b: ByteBuffer)

Writes b.remaining() bytes from the specified byte array to this output stream.

open suspend fun write(b: ByteArray)

Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).

open suspend fun write(b: Int)

Writes the specified byte to this file output stream. Implements the write method of OutputStream.

open suspend fun write(b: ByteArray, off: Int, len: Int)

Writes len bytes from the specified byte array starting at offset off to this file output stream. Implements the write method of OutputStream.