@ExperimentalUnsignedTypes abstract class AbstractStream : Stream
This class is recommended as the base for any Stream implementations.
Author
Alexander Kornilov (akornilov.82@gmail.com).
<init> |
This class is recommended as the base for any Stream implementations. AbstractStream() |
defaultByteOrder |
Default byte order of the stream. open var defaultByteOrder: ByteOrder |
defaultStringEncoding |
Default string encoding of the stream. open var defaultStringEncoding: StringEncoding |
isClosed |
Indicate that stream is closed. Overrode for inherit implementations. open var isClosed: Boolean |
isNetwork |
Indicates that stream is network based (pipe, socket etc).
Overrode to return default value open val isNetwork: 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. open var limit: Long |
position |
Current position can be changed for seekable streams. open var position: Long |
readBufferSize |
Read buffer size in bytes for streams which support read buffering. Has negative value if buffering is not supported. open var readBufferSize: Int |
readTimeout |
Read timeout for special streams (e.g. socket). Has negative value if timeout is not supported. open var readTimeout: Int |
writeBufferSize |
Write buffer size in bytes for streams which support write buffering. Has negative value if buffering is not supported. open var writeBufferSize: Int |
writeTimeout |
Write timeout for special streams (e.g. socket). Has negative value if timeout is not supported. open var writeTimeout: Int |
canReadValue |
Checks possibility to read for specified as template type. Supported types are: Byte, Short, Int, Long, Float, Double. fun <T : Any> canReadValue(): Boolean |
read |
Reads from stream value with type of template. Supported types are: Byte, Short, Int, Long, Float, Double, String. fun <T : Any> read(): T |
validateLimit |
Validates possibility to read or write from/into the stream according current value of limit. If operation is not possible LimitOutOfBoundsException are thrown. fun validateLimit(bytes: Int, message: String? = null): Unit |
write |
Writes value to stream with type of template. Supported types are: Byte, Short, Int, Long, Float, Double, String, ByteArray. infix fun <T : Any> write(value: T): Any |
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 |
StreamAdapter |
Provides Stream interface from Java InputStream and OutputStream. class StreamAdapter : AbstractStream |
StreamAdapterInput |
Provides Stream interface from StreamInput. class StreamAdapterInput : AbstractStream |
StreamAdapterOutput |
Provides Stream interface from StreamOutput. class StreamAdapterOutput : AbstractStream |
StreamByteArea |
Implementation of the Stream for ByteArea (in fact for any ByteAreaBased objects). class StreamByteArea : AbstractStream, ByteAreaBased |
StreamFile |
Implementation of Stream for random access file. class StreamFile : AbstractStream |