binary-streams / loggersoft.kotlin.streams / StreamOutput

StreamOutput

interface StreamOutput : BasicStream, Flushable

Represents streams for writing.

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

Functions

canWrite

Returns true if stream has place for bytes.

open fun canWrite(bytes: Int): Boolean

plusAssign

Writes Byte into the stream.

open operator fun plusAssign(value: Byte): Unit

Writes Short into the stream using defaultByteOrder.

open operator fun plusAssign(value: Short): Unit

Writes Int into the stream using defaultByteOrder.

open operator fun plusAssign(value: Int): Unit

Writes Long into the stream using defaultByteOrder.

open operator fun plusAssign(value: Long): Unit

Writes ULong into the stream using defaultByteOrder.

open operator fun plusAssign(value: ULong): Unit

Writes Float into the stream using defaultByteOrder.

open operator fun plusAssign(value: Float): Unit

Writes Double into the stream using defaultByteOrder.

open operator fun plusAssign(value: Double): Unit

Writes String into the stream using defaultStringEncoding and defaultByteOrder.

open operator fun plusAssign(value: String): Unit

Writes ByteArray into the stream.

open operator fun plusAssign(value: ByteArray): Unit

writeBom

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

open fun writeBom(encoding: StringEncoding = defaultStringEncoding, byteOrder: ByteOrder = defaultByteOrder): Unit

writeByte

Writes Byte into the stream.

abstract fun writeByte(value: Byte): Unit

writeBytes

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

abstract fun writeBytes(buffer: ByteArray, size: Int = buffer.size, offset: Int = 0): Unit

writeChar

Writes code point value with specified byteOrder into the stream.

open fun writeChar(value: Int, encoding: StringEncoding = defaultStringEncoding, byteOrder: ByteOrder = defaultByteOrder): Unit

writeDouble

Writes Double with specified byteOrder into the stream.

open fun writeDouble(value: Double, byteOrder: ByteOrder = defaultByteOrder): Unit

writeFloat

Writes Float with specified byteOrder into the stream.

open fun writeFloat(value: Float, byteOrder: ByteOrder = defaultByteOrder): Unit

writeInt

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

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

Writes Int with specified byteOrder into the stream.

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

writeLine

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

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

writeLong

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

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

Writes Long with specified byteOrder into the stream.

open fun writeLong(value: Long, byteOrder: ByteOrder = defaultByteOrder): Unit

writeShort

Writes Short with specified byteOrder into the stream.

open fun writeShort(value: Short, byteOrder: ByteOrder = defaultByteOrder): Unit

writeString

Writes string into the stream.

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

writeULong

Writes ULong with specified byteOrder into the stream.

abstract fun writeULong(value: ULong, byteOrder: ByteOrder = defaultByteOrder): Unit

Inheritors

BufferedStreamOutput

The decorator of StreamOutput for buffering.

class BufferedStreamOutput : StreamOutput

ProxyStreamOutput

Provides StreamOutput interface from Stream.

class ProxyStreamOutput : StreamOutput

Stream

Represents input and output stream.

interface Stream : StreamInput, StreamOutput