Class TCPNIOConnection

    • Method Detail

      • notifyReady

        protected boolean notifyReady()
      • getPeerAddress

        public SocketAddress getPeerAddress()
        Returns the address of the endpoint this Connection is connected to, or null if it is unconnected.
        Returns:
        the address of the endpoint this Connection is connected to, or null if it is unconnected.
      • getLocalAddress

        public SocketAddress getLocalAddress()
        Returns the local address of this Connection, or null if it is unconnected.
        Returns:
        the local address of this Connection, or null if it is unconnected.
      • resetProperties

        protected void resetProperties()
      • getReadBufferSize

        public int getReadBufferSize()
        Get the default size of Buffers, which will be allocated for reading data from Connection. The value less or equal to zero will be ignored.
        Returns:
        the default size of Buffers, which will be allocated for reading data from Connection.
      • setReadBufferSize

        public void setReadBufferSize​(int readBufferSize)
        Set the default size of Buffers, which will be allocated for reading data from Connection. The value less or equal to zero will be ignored.
        Parameters:
        readBufferSize - the default size of Buffers, which will be allocated for reading data from Connection.
      • getWriteBufferSize

        public int getWriteBufferSize()
        Get the default size of Buffers, which will be allocated for writing data to Connection.
        Returns:
        the default size of Buffers, which will be allocated for writing data to Connection.
      • setWriteBufferSize

        public void setWriteBufferSize​(int writeBufferSize)
        Set the default size of Buffers, which will be allocated for writing data to Connection.
        Parameters:
        writeBufferSize - the default size of Buffers, which will be allocated for writing data to Connection.
      • onConnect

        protected final void onConnect()
                                throws IOException
        Method will be called, when the connection gets connected.
        Throws:
        IOException
      • checkConnectFailed

        protected final void checkConnectFailed​(Throwable failure)
        Method will be called in order to check if failure happened before Connection was reported as connected.
      • onRead

        protected final void onRead​(Buffer data,
                                    int size)
        Method will be called, when some data was read on the connection
      • onWrite

        protected final void onWrite​(Buffer data,
                                     long size)
        Method will be called, when some data was written on the connection
      • canWrite

        public boolean canWrite()
        Returns:
        true if a write to this OutputSink will succeed, otherwise returns false.
      • canWrite

        @Deprecated
        public boolean canWrite​(int length)
        Deprecated.
        Parameters:
        length - specifies the number of bytes (or characters) that require writing
        Returns:
        true if a write to this OutputSink will succeed, otherwise returns false.
      • notifyCanWrite

        public void notifyCanWrite​(WriteHandler writeHandler)
        Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write more bytes (or characters). Note that once the WriteHandler has been notified, it will not be considered for notification again at a later point in time.
        Parameters:
        writeHandler - the WriteHandler that should be notified when it's possible to write more data.
      • notifyCanWrite

        @Deprecated
        public void notifyCanWrite​(WriteHandler handler,
                                   int length)
        Deprecated.
        Instructs the OutputSink to invoke the provided WriteHandler when it is possible to write length bytes (or characters). Note that once the WriteHandler has been notified, it will not be considered for notification again at a later point in time.
        Parameters:
        handler - the WriteHandler that should be notified when it's possible to write length bytes.
        length - the number of bytes or characters that require writing.