Package org.apache.mina.common

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


                    continue;
                }
   
                int localWrittenBytes = 0;
                for (int i = WRITE_SPIN_COUNT; i > 0; i --) {
                    localWrittenBytes = ch.write(buf.buf());
                    if (localWrittenBytes != 0 || !buf.hasRemaining()) {
                        break;
                    }
                }
View Full Code Here


                }
   
                try
                {
                    // forward read encrypted data to SSL handler
                    handler.messageReceived( nextFilter, buf.buf() );
   
                    // Handle data to be forwarded to application or written to net
                    handleSSLData( nextFilter, handler );
   
                    if( handler.isInboundDone() )
View Full Code Here

                    {
                        SessionLog.debug( session, " encrypt: " + buf );
                    }
                   
                    int pos = buf.position();
                    handler.encrypt( buf.buf() );
                    buf.position( pos );
                    ByteBuffer encryptedBuffer = new EncryptedBuffer(
                            SSLHandler.copy( handler.getOutNetBuffer() ), buf );
   
                    if( SessionLog.isDebugEnabled( session ) )
View Full Code Here

        {
            ByteBuffer buf = ByteBuffer.allocate( 8192 );
            Message m = ( Message ) message;
            try
            {
                if( m.write( buf.buf() ) )
                {
                    break;
                }
            }
            finally
View Full Code Here

            }

            try
            {
                // forward read encrypted data to SSL handler
                handler.messageReceived( nextFilter, buf.buf() );

                // Handle data to be forwarded to application or written to net
                handleSSLData( nextFilter, handler );

                if( handler.isInboundDone() )
View Full Code Here

                {
                    SessionLog.debug( session, " encrypt: " + buf );
                }
               
                int pos = buf.position();
                handler.encrypt( buf.buf() );
                buf.position( pos );
                ByteBuffer encryptedBuffer = new EncryptedBuffer(
                        SSLHandler.copy( handler.getOutNetBuffer() ), buf );

                if( SessionLog.isDebugEnabled( session ) )
View Full Code Here

            int readBytes = 0;
            int ret;

            try
            {
                while( ( ret = ch.read( buf.buf() ) ) > 0 )
                {
                    readBytes += ret;
                }
            }
            finally
View Full Code Here

                buf.reset();
                ( ( SocketFilterChain ) session.getFilterChain() ).messageSent( session, req );
                continue;
            }

            int writtenBytes = ch.write( buf.buf() );
            if( writtenBytes > 0 )
            {
                session.increaseWrittenBytes( writtenBytes );
            }
View Full Code Here

    {

        ByteBuffer readBuf = ByteBuffer.allocate( session.getReadBufferSize() );
        try
        {
            int readBytes = session.getChannel().read( readBuf.buf() );
            if( readBytes > 0 )
            {
                readBuf.flip();
                ByteBuffer newBuf = ByteBuffer.allocate( readBuf.limit() );
                newBuf.put( readBuf );
View Full Code Here

            if( !key.isValid() )
            {
                continue;
            }

            int writtenBytes = ch.write( buf.buf() );

            if( writtenBytes == 0 )
            {
                // Kernel buffer is full
                key.interestOps( key.interestOps() | SelectionKey.OP_WRITE );
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.