easy-nio.protocols

DatagramIO

protocol

Connectionless datagram send/receive. Implemented by DatagramChannel.

members

receive!

(receive! ch buf)

Receives a datagram into buf. Returns the source SocketAddress, or nil if no datagram was available (non-blocking mode with empty receive queue).

send!

(send! ch buf addr)

Sends the bytes remaining in buf to addr (a SocketAddress). Returns the number of bytes sent.

NIOChannel

protocol

Common operations across all channel types.

members

close!

(close! ch)

Closes the channel. Idempotent — safe to call on an already-closed channel.

open?

(open? ch)

Returns true if the channel is open.

StreamReadable

protocol

Stream-oriented reading into a ByteBuffer. Implemented by SocketChannel. Returns the number of bytes read, or -1 on end-of-stream.

members

read!

(read! ch buf)

Reads bytes from ch into buf. Returns bytes read, or -1 on EOF.

StreamWritable

protocol

Stream-oriented writing from a ByteBuffer. Implemented by SocketChannel. Returns the number of bytes written.

members

write!

(write! ch buf)

Writes bytes from buf to ch. Returns bytes written.