@ExperimentalUnsignedTypes class StreamAdapterInput : AbstractStream
Provides Stream interface from StreamInput.
Author
Alexander Kornilov (akornilov.82@gmail.com).
<init> |
Provides Stream interface from StreamInput. StreamAdapterInput(input: StreamInput) |
bytesAvailable |
val bytesAvailable: Long |
canFetchMore |
Optional hint for fetch ability (may be useful for streams where size isn't available). val canFetchMore: FetchHint |
defaultByteOrder |
Default byte order of the stream. var defaultByteOrder: ByteOrder |
defaultStringEncoding |
Default string encoding of the stream. var defaultStringEncoding: StringEncoding |
isClosed |
Indicate that stream is closed. Overrode for inherit implementations. var isClosed: Boolean |
isEof |
val isEof: Boolean |
isFixedSize |
val isFixedSize: Boolean |
isNetwork |
Indicates that stream is network based (pipe, socket etc).
Overrode to return default value val isNetwork: Boolean |
isReadable |
Indicates that stream is readable. val isReadable: Boolean |
isSeekable |
val isSeekable: Boolean |
isSupportLimit |
val isSupportLimit: Boolean |
isWritable |
Indicates that stream is writable. val isWritable: 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. var limit: Long |
position |
Current position can be changed for seekable streams. var position: Long |
readBufferSize |
Read buffer size in bytes for streams which support read buffering. Has negative value if buffering is not supported. var readBufferSize: Int |
readTimeout |
Read timeout for special streams (e.g. socket). Has negative value if timeout is not supported. var readTimeout: Int |
size |
val size: Long |
writeBufferSize |
Write buffer size in bytes for streams which support write buffering. Has negative value if buffering is not supported. var writeBufferSize: Int |
writeTimeout |
Write timeout for special streams (e.g. socket). Has negative value if timeout is not supported. var writeTimeout: Int |
canRead |
Returns fun canRead(bytes: Int): Boolean |
canWrite |
Returns fun canWrite(bytes: Int): Boolean |
close |
fun close(): Unit |
flush |
fun flush(): Unit |
forLines |
Calls the block callback giving it a sequence of all the lines in the stream. fun forLines(encoding: StringEncoding, byteOrder: ByteOrder, block: (lines: Sequence<String>) -> Unit): Unit |
readByte |
Reads Byte from the stream. fun readByte(): Byte |
readBytes |
Reads bytes size from the stream into the buffer starting from offset. fun readBytes(buffer: ByteArray, size: Int, offset: Int): Int |
readByteUnsigned |
Reads unsigned Byte from the stream. fun readByteUnsigned(): Int |
readChar |
Reads code point from the stream with specified encoding and byteOrder. fun readChar(encoding: StringEncoding, byteOrder: ByteOrder): Int |
readDouble |
Reads Double from the stream with specified byteOrder. fun readDouble(byteOrder: ByteOrder): Double |
readFloat |
Reads Float from the stream with specified byteOrder. fun readFloat(byteOrder: ByteOrder): Float |
readInt |
Read integer value from the stream with specified bytes count and byteOrder.
If signed is fun readInt(bytes: Int, signed: Boolean, byteOrder: ByteOrder): Long
Reads Int from the stream with specified byteOrder. fun readInt(byteOrder: ByteOrder): Int |
readLine |
Reads line from the stream with specified encoding and byteOrder. fun readLine(encoding: StringEncoding, byteOrder: ByteOrder): String |
readLong |
Read integer value from the stream as BigInteger with specified bytes count and byteOrder.
If signed is fun readLong(bytes: Int, signed: Boolean, byteOrder: ByteOrder): BigInteger
Reads Long from the stream with specified byteOrder. fun readLong(byteOrder: ByteOrder): Long |
readShort |
Reads Short from the stream with specified byteOrder. fun readShort(byteOrder: ByteOrder): Short |
readString |
Reads string from the stream with specified encoding, byteOrder and length limit. fun readString(encoding: StringEncoding, length: Int, byteOrder: ByteOrder): String |
readULong |
Reads ULong from the stream with specified byteOrder. fun readULong(byteOrder: ByteOrder): ULong |
skip |
Skips bytes in the stream. fun skip(bytes: Long): Long |
useLines |
Calls the block callback giving it a sequence of all the lines in the stream and closes it once the processing is complete. fun useLines(encoding: StringEncoding, byteOrder: ByteOrder, block: (lines: Sequence<String>) -> Unit): Unit |
writeBom |
Writes BOM character into the stream for non-ASCII encoding. fun writeBom(encoding: StringEncoding, byteOrder: ByteOrder): Nothing |
writeByte |
Writes Byte into the stream. fun writeByte(value: Byte): Nothing |
writeBytes |
Writes size bytes of buffer starting from offset into the stream. fun writeBytes(buffer: ByteArray, size: Int, offset: Int): Nothing |
writeChar |
Writes code point value with specified byteOrder into the stream. fun writeChar(value: Int, encoding: StringEncoding, byteOrder: ByteOrder): Nothing |
writeDouble |
Writes Double with specified byteOrder into the stream. fun writeDouble(value: Double, byteOrder: ByteOrder): Nothing |
writeFloat |
Writes Float with specified byteOrder into the stream. fun writeFloat(value: Float, byteOrder: ByteOrder): Nothing |
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): Nothing
Writes Int with specified byteOrder into the stream. fun writeInt(value: Int, byteOrder: ByteOrder): Nothing |
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): Nothing
Writes Long with specified byteOrder into the stream. fun writeLong(value: Long, byteOrder: ByteOrder): Nothing |
writeShort |
Writes Short with specified byteOrder into the stream. fun writeShort(value: Short, byteOrder: ByteOrder): Nothing |
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): Nothing |
crc16 |
Calculates CRC16 for size bytes in the stream. fun StreamInput.crc16(size: Int): Int |
crc32 |
Calculates CRC32 for size bytes in the stream. fun StreamInput.crc32(size: Int): Int |
setLimit |
Sets current stream position and limit. e.g. after setLimit(10, 5) the stream position will be 10 and limit 15. fun Stream.setLimit(position: Long, limit: Long): Unit |
tryDetectBom |
Tries detect BOM signature in current position and if success updates Stream.defaultByteOrder and Stream.defaultStringEncoding. fun Stream.tryDetectBom(): Boolean |