Package org.apache.mina.common

Examples of org.apache.mina.common.ByteBuffer.remaining()


            }

            if( buf == null )
                break;

            if( buf.remaining() == 0 )
            {
                synchronized( writeBufferQueue )
                {
                    writeBufferQueue.pop();
                    writeMarkerQueue.pop();
View Full Code Here


                ByteBuffer newBuf = ByteBuffer.allocate(readBuf.limit());
                newBuf.put(readBuf);
                newBuf.flip();

                session.increaseReadBytes(newBuf.remaining());
                session.getFilterChain().fireMessageReceived(session, newBuf);
            }
        } finally {
            readBuf.release();
        }
View Full Code Here

   
                if (req == null)
                    break;
   
                ByteBuffer buf = (ByteBuffer) req.getMessage();
                if (buf.remaining() == 0) {
                    // pop and fire event
                    writeRequestQueue.poll();
   
                    buf.reset();
                   
View Full Code Here

                    int byteCount = 1;
                    Object messageCopy = message;
                    if (message instanceof ByteBuffer) {
                        ByteBuffer rb = (ByteBuffer) message;
                        rb.mark();
                        byteCount = rb.remaining();
                        ByteBuffer wb = ByteBuffer.allocate(rb.remaining());
                        wb.put(rb);
                        wb.flip();
                        rb.reset();
                        messageCopy = wb;
View Full Code Here

                if (req == null)
                    break;

                ByteBuffer buf = (ByteBuffer) req.getMessage();
                if (buf.remaining() == 0) {
                    writeRequestQueue.poll();

                    buf.reset();
                   
                    if (!buf.hasRemaining()) {
View Full Code Here

       
                if (req == null)
                    break;
       
                ByteBuffer buf = (ByteBuffer) req.getMessage();
                if (buf.remaining() == 0) {
                    // pop and fire event
                    writeRequestQueue.poll();
       
                    buf.reset();
                   
View Full Code Here

                    {
                        // A special message is a buffer with zero length.
                        // A special message will bypass all next filters.
                        // TODO: Provide a nicer way to take care of special messages.
                        ByteBuffer message = ( ByteBuffer ) writeRequest.getMessage();
                        if( message.remaining() == 0 )
                        {
                            callPreviousFilterWrite( head.nextEntry, session, writeRequest );
                            return;
                        }
                    }
View Full Code Here

            if( req == null )
                break;

            ByteBuffer buf = ( ByteBuffer ) req.getMessage();
            if( buf.remaining() == 0 )
            {
                synchronized( writeRequestQueue )
                {
                    writeRequestQueue.pop();
                }
View Full Code Here

            if( req == null )
                break;

            ByteBuffer buf = ( ByteBuffer ) req.getMessage();
            if( buf.remaining() == 0 )
            {
                // pop and fire event
                synchronized( writeRequestQueue )
                {
                    writeRequestQueue.pop();
View Full Code Here

                ByteBuffer newBuf = ByteBuffer.allocate( readBuf.limit() );
                newBuf.put( readBuf );
                newBuf.flip();

                session.increaseReadBytes( newBuf.remaining() );
                session.getFilterChain().fireMessageReceived( session, newBuf );
            }
        }
        finally
        {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.