Package org.apache.mina.core.buffer

Examples of org.apache.mina.core.buffer.IoBuffer.buf()



    public void encode( IoSession session, Object message, ProtocolEncoderOutput out )
    {
        IoBuffer buf = IoBuffer.allocate( 1024 );
        encoder.encode( buf.buf(), ( DhcpMessage ) message );

        buf.flip();

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


        // make space for int length
        buf.putInt( 0 );

        if ( message instanceof KdcReply )
        {
            replyEncoder.encode( ( KdcReply ) message, buf.buf() );
        }
        else
        {
            if ( message instanceof ErrorMessage )
            {
View Full Code Here

        }
        else
        {
            if ( message instanceof ErrorMessage )
            {
                errorEncoder.encode( ( ErrorMessage ) message, buf.buf() );
            }
        }

        // mark position
        int pos = buf.position();
View Full Code Here

    {
        IoBuffer buf = IoBuffer.allocate( 1024 );

        if ( message instanceof KdcReply )
        {
            replyEncoder.encode( ( KdcReply ) message, buf.buf() );
        }
        else
        {
            if ( message instanceof ErrorMessage )
            {
View Full Code Here

        }
        else
        {
            if ( message instanceof ErrorMessage )
            {
                errorEncoder.encode( ( ErrorMessage ) message, buf.buf() );
            }
        }

        buf.flip();
View Full Code Here

        // make space for int length
        buf.putInt( 0 );

        if ( message instanceof ChangePasswordReply )
        {
            replyEncoder.encode( buf.buf(), ( ChangePasswordReply ) message );
        }
        else
        {
            if ( message instanceof ChangePasswordError )
            {
View Full Code Here

        }
        else
        {
            if ( message instanceof ChangePasswordError )
            {
                errorEncoder.encode( buf.buf(), ( ChangePasswordError ) message );
            }
        }

        // mark position
        int pos = buf.position();
View Full Code Here

    public void encode( IoSession session, Object message, ProtocolEncoderOutput out )
    {
        NtpMessageEncoder encoder = new NtpMessageEncoder();

        IoBuffer buf = IoBuffer.allocate( 1024 );
        encoder.encode( buf.buf(), ( NtpMessage ) message );

        buf.flip();

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

                wChannel = new FileOutputStream(file, false).getChannel();
            }

            // Write the ByteBuffer contents; the bytes between the ByteBuffer's
            // position and the limit is written to the file
            wChannel.write(buf.buf());
        } catch (IOException e) {
            //e.printStackTrace();
        }
    }
View Full Code Here

        duplicate = original.duplicate();
        original.put(4, (byte) 127);
        assertEquals(4, duplicate.position());
        assertEquals(10, duplicate.limit());
        assertEquals(16, duplicate.capacity());
        assertNotSame(original.buf(), duplicate.buf());
        assertSame(original.buf().array(), duplicate.buf().array());
        assertEquals(127, duplicate.get(4));

        // Test a duplicate of a duplicate.
        original = IoBuffer.allocate(16);
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.