size

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

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

If new is greater than the current FileStream.size, then the File is extended whereby the extended portion reads as 0 bytes (undefined). If new is less than the current FileStream.size, then the File is truncated and data beyond new is lost.

If and only if the current FileStream.position is greater than new, then the FileStream.position will be set to new. Otherwise, the current FileStream.position will remain unmodified.

NOTE: On Js/WasmJs, if using the :kmp-file:async extension module, this synchronous function can fail to acquire the necessary position lock if an asynchronous FileStream operation is holding it. In that event, an IOException is raised. This is a platform limitation and can be avoided by not intermixing synchronous, and asynchronous functionality.

Return

The Write stream for chaining operations.

Parameters

new

The desired size.

Throws

IllegalArgumentException

If new is less than 0.

If an I/O error occurs, or the stream is closed.

actual abstract fun size(new: Long): FileStream.Write(source)
actual abstract fun size(new: Long): FileStream.Write(source)
actual abstract fun size(new: Long): FileStream.Write(source)