binary-streams / loggersoft.kotlin.streams / ProxyStreamOutput

ProxyStreamOutput

@ExperimentalUnsignedTypes class ProxyStreamOutput : StreamOutput

Provides StreamOutput interface from Stream.

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

Constructors

<init>

Provides StreamOutput interface from Stream.

ProxyStreamOutput(stream: Stream)

Properties

bytesAvailable

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.

val bytesAvailable: Long

defaultByteOrder

Default byte order of the stream.

val defaultByteOrder: ByteOrder

defaultStringEncoding

Default string encoding of the stream.

val defaultStringEncoding: StringEncoding

isClosed

Indicate that stream is closed.

val isClosed: Boolean

isEof

Indicates that end of stream reached.

val isEof: Boolean

isFixedSize

Indicates that stream has fixed size.

val isFixedSize: Boolean

isNetwork

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

val isNetwork: Boolean

isSeekable

Indicates that position of the stream can be changed.

val isSeekable: Boolean

isSupportLimit

Indicates that stream support validation of the limit field.

val isSupportLimit: Boolean

limit

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.

val limit: Long

position

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

val position: Long

size

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

val size: Long

Functions

canWrite

Returns true if stream has place for bytes.

fun canWrite(bytes: Int): Boolean

close

fun close(): Unit

flush

fun flush(): Unit

writeBom

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

fun writeBom(encoding: StringEncoding, byteOrder: ByteOrder): Unit

writeByte

Writes Byte into the stream.

fun writeByte(value: Byte): Unit

writeBytes

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

fun writeBytes(buffer: ByteArray, size: Int, offset: Int): Unit

writeChar

Writes code point value with specified byteOrder into the stream.

fun writeChar(value: Int, encoding: StringEncoding, byteOrder: ByteOrder): Unit

writeDouble

Writes Double with specified byteOrder into the stream.

fun writeDouble(value: Double, byteOrder: ByteOrder): Unit

writeFloat

Writes Float with specified byteOrder into the stream.

fun writeFloat(value: Float, byteOrder: ByteOrder): Unit

writeInt

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

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

Writes Int with specified byteOrder into the stream.

fun writeInt(value: Int, byteOrder: ByteOrder): Unit

writeLine

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

fun writeLine(value: String, encoding: StringEncoding, byteOrder: ByteOrder): Int

writeLong

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

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

Writes Long with specified byteOrder into the stream.

fun writeLong(value: Long, byteOrder: ByteOrder): Unit

writeShort

Writes Short with specified byteOrder into the stream.

fun writeShort(value: Short, byteOrder: ByteOrder): Unit

writeString

Writes string into the stream.

fun writeString(value: String, encoding: StringEncoding, startIndex: Int, size: Int, byteOrder: ByteOrder, needTerminator: Boolean): Int

writeULong

Writes ULong with specified byteOrder into the stream.

fun writeULong(value: ULong, byteOrder: ByteOrder): Unit