StreamOutput

interface StreamOutput : BasicStream, Flushable

Represents streams for writing.

Author

Alexander Kornilov (akornilov.82@gmail.com).

Functions

Link copied to clipboard
open fun canWrite(bytes: Int): Boolean

Returns true if stream has place for bytes.

Link copied to clipboard
abstract override fun close()
Link copied to clipboard
abstract fun flush()
Link copied to clipboard
open operator fun plusAssign(value: Byte)

Writes Byte into the stream.

open operator fun plusAssign(value: ByteArray)

Writes ByteArray into the stream.

open operator fun plusAssign(value: Double)

Writes Double into the stream using defaultByteOrder.

open operator fun plusAssign(value: Float)

Writes Float into the stream using defaultByteOrder.

open operator fun plusAssign(value: Int)

Writes Int into the stream using defaultByteOrder.

open operator fun plusAssign(value: Long)

Writes Long into the stream using defaultByteOrder.

open operator fun plusAssign(value: Short)

Writes Short into the stream using defaultByteOrder.

open operator fun plusAssign(value: String)

Writes String into the stream using defaultStringEncoding and defaultByteOrder.

open operator fun plusAssign(value: UInt)

Writes UInt into the stream using defaultByteOrder.

open operator fun plusAssign(value: ULong)

Writes ULong into the stream using defaultByteOrder.

open operator fun plusAssign(value: UShort)

Writes UShort into the stream using defaultByteOrder.

Link copied to clipboard
open fun writeBom(encoding: StringEncoding = defaultStringEncoding, byteOrder: ByteOrder = defaultByteOrder)

Writes BOM character into the stream for non-ASCII encoding.

Link copied to clipboard
abstract fun writeByte(value: Byte)

Writes Byte into the stream.

Link copied to clipboard
open fun writeBytes(    buffer: ByteArray,     size: Int = buffer.size,     offset: Int = 0)

Writes size bytes of buffer starting from offset into the stream.

Link copied to clipboard
open fun writeChar(    value: Int,     encoding: StringEncoding = defaultStringEncoding,     byteOrder: ByteOrder = defaultByteOrder)

Writes code point value with specified byteOrder into the stream.

Link copied to clipboard
open fun writeDouble(value: Double, byteOrder: ByteOrder = defaultByteOrder)

Writes Double with specified byteOrder into the stream.

Link copied to clipboard
open fun writeFloat(value: Float, byteOrder: ByteOrder = defaultByteOrder)

Writes Float with specified byteOrder into the stream.

Link copied to clipboard
open fun writeInt(value: Int, byteOrder: ByteOrder = defaultByteOrder)

Writes Int with specified byteOrder into the stream.

open fun writeInt(    value: Long,     bytes: Int,     byteOrder: ByteOrder = defaultByteOrder)

Writes value with size in bytes with specified byteOrder into the stream. The bytes should be in 1..8 range.

Link copied to clipboard
open fun writeLine(    value: String = "",     encoding: StringEncoding = defaultStringEncoding,     byteOrder: ByteOrder = defaultByteOrder): Int

Writes line value with specified encoding and byteOrder into the stream.

Link copied to clipboard
open fun writeLong(value: Long, byteOrder: ByteOrder = defaultByteOrder)

Writes Long with specified byteOrder into the stream.

open fun writeLong(    value: BigInteger,     bytes: Int,     byteOrder: ByteOrder = defaultByteOrder)

Writes value with size in bytes with specified byteOrder into the stream.

Link copied to clipboard
open fun writeShort(value: Short, byteOrder: ByteOrder = defaultByteOrder)

Writes Short with specified byteOrder into the stream.

Link copied to clipboard
open fun writeString(    value: String,     encoding: StringEncoding = defaultStringEncoding,     startIndex: Int = 0,     size: Int = -1,     byteOrder: ByteOrder = defaultByteOrder,     needTerminator: Boolean = true): Int

Writes string into the stream.

Link copied to clipboard
open fun writeUInt(value: UInt, byteOrder: ByteOrder = defaultByteOrder)

Writes UInt with specified byteOrder into the stream.

Link copied to clipboard
open fun writeULong(value: ULong, byteOrder: ByteOrder = defaultByteOrder)

Writes ULong with specified byteOrder into the stream.

Link copied to clipboard
open fun writeUShort(value: UShort, byteOrder: ByteOrder = defaultByteOrder)

Writes UShort with specified byteOrder into the stream.

Properties

Link copied to clipboard
open val bytesAvailable: Long

Contains available bytes for read/write and the negative value if available bytes is not available at moment. Also, this property take into account limit value if it has non-negative value and isSupportLimit is true.

Link copied to clipboard
abstract val defaultByteOrder: ByteOrder

Default byte order of the stream.

Link copied to clipboard
abstract val defaultStringEncoding: StringEncoding

Default string encoding of the stream.

Link copied to clipboard
abstract val isClosed: Boolean

Indicate that stream is closed.

Link copied to clipboard
open val isEof: Boolean

Indicates that end of stream reached.

Link copied to clipboard
abstract val isFixedSize: Boolean

Indicates that stream has fixed size.

Link copied to clipboard
abstract val isNetwork: Boolean

Indicates that stream is network based (pipe, socket etc).

Link copied to clipboard
abstract val isSeekable: Boolean

Indicates that position of the stream can be changed.

Link copied to clipboard
abstract val isSupportLimit: Boolean

Indicates that stream support validation of the limit field.

Link copied to clipboard
abstract val limit: Long

The limit position of the stream for read and write. If someone try to read or write out of this bound (position >= limit) the LimitOutOfBoundsException should be thrown.

Link copied to clipboard
abstract val position: Long

Current position in the stream. Has negative value if seek is not supported or information about current position is not available at moment.

Link copied to clipboard
abstract val size: Long

Current stream size in bytes or negative value if size isn't available at moment.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard