Package org.apache.mina.common

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


        for( int i = 0; i < 10; i ++ )
        {
            ByteBuffer buf = ByteBuffer.allocate( 16 );
            buf.limit( 16 );
            fillWriteBuffer( buf, i );
            buf.flip();

            Object marker;
            if( ( i & 1 ) == 0 )
            {
                marker = new Integer( i );
View Full Code Here


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

                session.increaseReadBytes( readBytes );
View Full Code Here

            if( readBytes > 0 )
            {
                readBuf.flip();
                ByteBuffer newBuf = ByteBuffer.allocate( readBuf.limit() );
                newBuf.put( readBuf );
                newBuf.flip();

                session.increaseReadBytes( readBytes );
                filters.dataRead( session, newBuf );
            }
        }
View Full Code Here

        {
            SocketAddress remoteAddress = session.getChannel().receive(
                    readBuf.buf() );
            if( remoteAddress != null )
            {
                readBuf.flip();
                session.setRemoteAddress( remoteAddress );

                ByteBuffer newBuf = ByteBuffer.allocate( readBuf.limit() );
                newBuf.put( readBuf );
                newBuf.flip();
View Full Code Here

                readBuf.flip();
                session.setRemoteAddress( remoteAddress );

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

                session.increaseReadBytes( newBuf.remaining() );
                filters.dataRead( session, newBuf );
            }
        }
View Full Code Here

                    readBytes += ret;
                }
            }
            finally
            {
                buf.flip();
            }

            session.increaseReadBytes( readBytes );
            session.resetIdleCount( IdleStatus.BOTH_IDLE );
            session.resetIdleCount( IdleStatus.READER_IDLE );
View Full Code Here

            if( readBytes > 0 )
            {
                ByteBuffer newBuf = ByteBuffer.allocate( readBytes );
                newBuf.put( buf );
                newBuf.flip();
                session.getManagerFilterChain().dataRead( session, newBuf );
            }
            if( ret < 0 )
            {
                scheduleRemove( session );
View Full Code Here

     */
    private static ByteBuffer copy( java.nio.ByteBuffer src )
    {
        ByteBuffer copy = ByteBuffer.allocate( src.remaining() );
        copy.put( src );
        copy.flip();
        return copy;
    }

    // Utilities to mainpulate SSLHandler based on IoSession

View Full Code Here

        for( int i = 0; i < val.length(); i++ )
        {
            buf.put( ( byte ) val.charAt( i ) );
        }

        buf.flip();
        out.write( buf );
    }
}
View Full Code Here

                    "This decoder doesn't work for connectionless transport types." );
        }

        ByteBuffer buf = this.buf;
        buf.put( in );
        buf.flip();

        try
        {
            for( ;; )
            {
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.