Class NIOJICPConnection

    • Constructor Detail

      • NIOJICPConnection

        public NIOJICPConnection()
      • NIOJICPConnection

        protected NIOJICPConnection​(boolean wrapper)
    • Method Detail

      • readPacket

        public JICPPacket readPacket()
                              throws IOException
        Read a JICPPacket from the connection. The method is synchronized since we reuse the same Buffer object for reading the packet header. It should be noted that the packet data may not be completely available when the embedded channel is ready for a READ operation. In that case a PacketIncompleteException is thrown to indicate that successive calls to this method must occur in order to fully read the packet.
        Specified by:
        readPacket in class Connection
        Throws:
        IOException
      • moreDataAvailable

        public boolean moreDataAvailable()
      • writePacket

        public int writePacket​(JICPPacket pkt)
                        throws IOException
        Write a JICPPacket on the connection, first calls #preprocessBufferToWrite(java.nio.ByteBuffer). When the buffer returned by #preprocessBufferToWrite(java.nio.ByteBuffer), no write will be performed.
        Specified by:
        writePacket in class Connection
        Returns:
        number of application bytes written to the socket
        Throws:
        IOException
      • writeToChannel

        public int writeToChannel​(ByteBuffer bb)
                           throws IOException
        writes data to the channel
        Parameters:
        bb -
        Returns:
        the number of bytes written to the channel
        Throws:
        IOException
      • isClosed

        public boolean isClosed()
      • addBufferTransformer

        public void addBufferTransformer​(BufferTransformer transformer)