Module swim.io
Package swim.io

Interface IpModemContext<I,​O>

  • All Superinterfaces:
    FlowContext, IpContext
    All Known Implementing Classes:
    IpSocketModem

    public interface IpModemContext<I,​O>
    extends IpContext, FlowContext
    Network socket context that manages asynchronous I/O decoders and encoders for a non-blocking NIO network channel. An IpModemContext is implicitly bound to a IpModem, providing the IpModem with the ability to modify its FlowControl state, enqueue read decoders and write encoders, to become a different kind of IpSocket, and to close the socket.
    • Method Detail

      • ipSettings

        IpSettings ipSettings()
        Returns the configuration parameters that govern the underlying network socket.
      • read

        <I2 extends I> void read​(Decoder<I2> decoder)
        Enqueues a read decoder to which input data will be asynchronously fed. The read flow control of the underlying network socket is automatically managed using the state of the read decoder. When the read decoder transitions into the done state, the didRead callback of the bound IpModem will be invoked with the decoded result. If the read decoder transitions into the error state, then the didFail callback of the bound IpModem will be invoked with the decode error.
      • write

        <O2 extends O> void write​(Encoder<?,​O2> encoder)
        Enqueues a write encoder from which output data will be asynchronously pulled. The write flow control of the underlying network socket is automatically managed using the state of the write encoder. When the write encoder transitions into the done state, the didWrite callback of the bound IpModem will be invoked with the encoded result. If the write encoder transitions into the error state, then the didFail callback of the bound IpModem will be invoked with the encode error.
      • become

        void become​(IpSocket socket)
        Rebinds the underlying IpSocketContext to a new socket implementation, thereby changing the IpSocket handler that receives network I/O callbacks.
      • close

        void close()
        Closes the underlying network socket.