StreamChannel

class StreamChannel(socket: Socket, inputStream: InputStream, outputStream: OutputStream) : Flushable, ByteChannel, InterruptibleChannel

Channel wrapping a Socket with support for TLS and compression layers

Constructors

Link copied to clipboard
fun StreamChannel(socket: Socket, inputStream: InputStream = socket.getInputStream(), outputStream: OutputStream = socket.getOutputStream())

Functions

Link copied to clipboard
open override fun close()

Close the underlying streams and channels

Link copied to clipboard
open override fun flush()
Link copied to clipboard
open override fun isOpen(): Boolean

Returns whether the current channel is open, can be read from and written to

Link copied to clipboard
open override fun read(dst: ByteBuffer): Int

Reads from the channel into a given byte buffer and returns the amount of written bytes

Link copied to clipboard
fun tlsInfo(): TlsInfo?

Return metadata about the current TLS session, if enabled

Link copied to clipboard
fun withCompression(): StreamChannel

Return a copy of the current channel with DEFLATE compression

Link copied to clipboard
fun withTLS(context: SSLContext): StreamChannel

Return a copy of the current channel with TLS

Link copied to clipboard
open override fun write(src: ByteBuffer): Int

Write a given byte buffer to the channel and return the amount of written bytes