Write

expect sealed interface Write : FileStream(source)

A FileStream for write-only operations whereby the destination for data is a File.

See also

Inheritors

actual interface Write : FileStream(source)

Inheritors

Inheritors

actual interface Write : FileStream(source)

Inheritors

Properties

Link copied to clipboard
expect abstract val isAppending: Boolean

If the Write stream was opened in appending mode.

actual abstract val isAppending: Boolean
actual abstract val isAppending: Boolean
actual abstract val isAppending: Boolean

Functions

Link copied to clipboard
@JvmStatic
fun FileStream.Write.asOutputStream(closeParentOnClose: Boolean): OutputStream

Converts the provided Write stream to an OutputStream.

Link copied to clipboard
expect abstract override fun close()

Closes the FileStream resource, pushing all potentially buffered data to the underlying File for which this stream belongs. Subsequent invocations do nothing.

actual abstract override fun close()

Closes the resource releasing any system resources that may be allocated to this Closeable. Subsequent invocations do nothing.

actual abstract override fun close()
actual abstract override fun close()

Closes the resource releasing any system resources that may be allocated to this Closeable. Subsequent invocations do nothing.

Link copied to clipboard
open override fun flush()

Redirects to calling sync(meta = true).

Link copied to clipboard
expect abstract fun isOpen(): Boolean

Checks if this FileStream has been closed or not.

actual abstract fun isOpen(): Boolean
actual abstract override fun isOpen(): Boolean
actual abstract fun isOpen(): Boolean
Link copied to clipboard
expect abstract fun position(): Long

Retrieves the current position of the file pointer for which the next operation will occur at.

expect abstract override fun position(new: Long): FileStream.Write
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Write
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Write
actual abstract fun position(): Long
actual abstract override fun position(new: Long): FileStream.Write
Link copied to clipboard
expect abstract fun size(): Long

Retrieves the current size of the File for which this FileStream belongs.

expect abstract fun size(new: Long): FileStream.Write

Modifies the size of the File for which this Write stream belongs.

actual abstract fun size(): Long
actual abstract fun size(new: Long): FileStream.Write
actual abstract fun size(): Long
actual abstract fun size(new: Long): FileStream.Write
actual abstract fun size(): Long
actual abstract fun size(new: Long): FileStream.Write
Link copied to clipboard
expect abstract override fun sync(meta: Boolean): FileStream.Write

Syncs any updates to the File for which this stream belongs, to the device filesystem. This is akin to fsync/fdatasync.

actual abstract override fun sync(meta: Boolean): FileStream.Write
actual abstract override fun sync(meta: Boolean): FileStream.Write
actual abstract override fun sync(meta: Boolean): FileStream.Write
Link copied to clipboard
expect abstract fun write(buf: ByteArray)

Writes the entire contents of buf to the File for which this stream belongs. Bytes are written starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that were written.

expect abstract fun write(buf: ByteArray, position: Long)

Writes the entire contents of buf to the File for which this stream belongs. Bytes are written starting at the specified position. The FileStream.position will not be changed. If the specified position is greater than the current size, then the File is grown to accommodate the new data. The values of any bytes between the previous end-of-file and the newly written data are unspecified.

expect abstract fun write(buf: ByteArray, offset: Int, len: Int)

Writes len number of bytes from buf, starting at index offset, to the File for which this stream belongs. Bytes are written starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that were written.

expect abstract fun write(buf: ByteArray, offset: Int, len: Int, position: Long)

Writes len number of bytes from buf, starting at index offset, to the File for which this stream belongs. Bytes are written starting at the specified position. The FileStream.position will not be changed. If the specified position is greater than the current size, then the File is grown to accommodate the new data. The values of any bytes between the previous end-of-file and the newly written data are unspecified.

abstract fun write(buf: Buffer)

Writes the entire contents of buf to the File for which this stream belongs. Bytes are written starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that were written.

actual abstract fun write(buf: ByteArray)
actual abstract fun write(buf: ByteArray, position: Long)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int, position: Long)
abstract fun write(buf: Buffer, position: Long)

Writes the entire contents of buf to the File for which this stream belongs. Bytes are written starting at the specified position. The FileStream.position will not be changed. If the specified position is greater than the current size, then the File is grown to accommodate the new data. The values of any bytes between the previous end-of-file and the newly written data are unspecified.

abstract fun write(buf: Buffer, offset: Long, len: Long)

Writes len number of bytes from buf, starting at index offset, to the File for which this stream belongs. Bytes are written starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that were written.

abstract fun write(buf: Buffer, offset: Long, len: Long, position: Long)

Writes len number of bytes from buf, starting at index offset, to the File for which this stream belongs. Bytes are written starting at the specified position. The FileStream.position will not be changed. If the specified position is greater than the current size, then the File is grown to accommodate the new data. The values of any bytes between the previous end-of-file and the newly written data are unspecified.

abstract override fun write(src: ByteBuffer?): Int

Writes the available contents of src to the File for which this stream belongs. Bytes are written starting at the current FileStream.position. The FileStream.position will automatically increment by the number of bytes that were written.

actual abstract fun write(buf: ByteArray)
actual abstract fun write(buf: ByteArray, position: Long)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int, position: Long)
abstract fun write(src: ByteBuffer?, position: Long): Int

Writes the available contents of src to the File for which this stream belongs. Bytes are written starting at the specified position. The FileStream.position will not be changed. If the specified position is greater than the current size, then the File is grown to accommodate the new data. The values of any bytes between the previous end-of-file and the newly written data are unspecified.

actual abstract fun write(buf: ByteArray)
actual abstract fun write(buf: ByteArray, position: Long)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int)
actual abstract fun write(buf: ByteArray, offset: Int, len: Int, position: Long)