Package org.apache.mina.common

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


        }
       
        ByteBuffer buf = ByteBuffer.allocate( objectSize + 4, false );
        buf.putInt( objectSize );
        in.readFully( buf.array(), 4, objectSize );
        buf.position( 0 );
        buf.limit( objectSize );
       
        Object answer = buf.getObject( classLoader );
        buf.release();
        return answer;
View Full Code Here


                if( SessionLog.isDebugEnabled( session ) )
                {
                    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 );
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

            data = ByteBuffer.allocate(0);
        }

        if (debug)
        {
            _logger.debug("Creating message from buffer with position=" + data.position() + " and remaining=" + data
                    .remaining());
        }
        // set the properties of this message
        MessageProperties mprop;
        DeliveryProperties devprop;
View Full Code Here

            {
                int offset = _chunkSize - _partialBytesRead;
                if (size >= offset)
                {
                    _chunkTimes[_chunksReceived++] = now;
                    result.position(offset);
                }
                else
                {
                    // have not read even one chunk, including the previous partial bytes
                    _partialBytesRead += size;
View Full Code Here

                {
                    result.skip(_chunkSize - 1);
                }
                catch (IllegalArgumentException e)
                {
                    _logger.error("Position was: " + result.position());
                    _logger.error("Tried to skip to: " + (_chunkSize * i));
                    _logger.error("limit was; " + result.limit());
                }
            }
            _logger.debug("Chunks received now " + _chunksReceived);
View Full Code Here

            buf = in;
        }

        for( ;; )
        {
            int oldPos = buf.position();
            boolean decoded = doDecode( session, buf, out );
            if( decoded )
            {
                if( buf.position() == oldPos )
                {
View Full Code Here

        {
            int oldPos = buf.position();
            boolean decoded = doDecode( session, buf, out );
            if( decoded )
            {
                if( buf.position() == oldPos )
                {
                    throw new IllegalStateException(
                            "doDecode() can't return true when buffer is not consumed." );
                }
View Full Code Here

        {
            if(buffer.isDirect() || buffer.isReadOnly())
            {
                ByteBuffer encodedForm = _encodedForm.duplicate();

                if (encodedForm.position() != 0)
                {
                    encodedForm.flip();
                }

                buffer.put(encodedForm);
View Full Code Here

            buf = in;
            usingSessionBuffer = false;
        }

        for (;;) {
            int oldPos = buf.position();
            boolean decoded = doDecode(session, buf, out);
            if (decoded) {
                if (buf.position() == oldPos) {
                    throw new IllegalStateException(
                            "doDecode() can't return true when buffer is not consumed.");
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.