Package org.apache.mina.util.byteaccess.ByteArrayList

Examples of org.apache.mina.util.byteaccess.ByteArrayList.Node


     * @return
     *  The first ByteArray in the list
     */
    public ByteArray removeFirst()
    {
        Node node = bas.removeFirst();
        return node == null ? null : node.getByteArray();
    }
View Full Code Here


     * @return
     *  The ByteArray that was removed
     */
    public ByteArray removeLast()
    {
        Node node = bas.removeLast();
        return node == null ? null : node.getByteArray();
    }
View Full Code Here

     */
    public void free()
    {
        while ( !bas.isEmpty() )
        {
            Node node = bas.getLast();
            node.getByteArray().free();
            bas.removeLast();
        }
    }
View Full Code Here

        if ( bas.isEmpty() )
        {
            return Collections.emptyList();
        }
        Collection<IoBuffer> result = new ArrayList<IoBuffer>();
        Node node = bas.getFirst();
        for ( IoBuffer bb : node.getByteArray().getIoBuffers() )
        {
            result.add( bb );
        }
        while ( node.hasNextNode() )
        {
            node = node.getNextNode();
            for ( IoBuffer bb : node.getByteArray().getIoBuffers() )
            {
                result.add( bb );
            }
        }
        return result;
View Full Code Here

            ByteArray ba = byteArrayFactory.create( 1 );
            return ba.getSingleIoBuffer();
        }
        int actualLength = last() - first();
        {
            Node node = bas.getFirst();
            ByteArray ba = node.getByteArray();
            if ( ba.last() == actualLength )
            {
                return ba.getSingleIoBuffer();
            }
        }
        // Replace all nodes with a single node.
        ByteArray target = byteArrayFactory.create( actualLength );
        IoBuffer bb = target.getSingleIoBuffer();
        Cursor cursor = cursor();
        cursor.put( bb ); // Copy all existing data into target IoBuffer.
        while ( !bas.isEmpty() )
        {
            Node node = bas.getLast();
            ByteArray component = node.getByteArray();
            bas.removeLast();
            component.free();
        }
        bas.addLast( target );
        return bb;
View Full Code Here

            // Bounds checks
            checkBounds( index, accessSize );

            // Remember the current node so we can later tell whether or not we
            // need to create a new cursor.
            Node oldComponentNode = componentNode;

            // Handle missing node.
            if ( componentNode == null )
            {
                int basMidpoint = ( last() - first() ) / 2 + first();
View Full Code Here

            // Bounds checks
            checkBounds( index, accessSize );

            // Remember the current node so we can later tell whether or not we
            // need to create a new cursor.
            Node oldComponentNode = componentNode;

            // Handle missing node.
            if ( componentNode == null )
            {
                int basMidpoint = ( last() - first() ) / 2 + first();
View Full Code Here

     *
     * @return
     *  The first ByteArray in the list
     */
    public ByteArray removeFirst() {
        Node node = bas.removeFirst();
        return node == null ? null : node.getByteArray();
    }
View Full Code Here

     *
     * @return
     *  The ByteArray that was removed
     */
    public ByteArray removeLast() {
        Node node = bas.removeLast();
        return node == null ? null : node.getByteArray();
    }
View Full Code Here

    /**
     * @inheritDoc
     */
    public void free() {
        while ( !bas.isEmpty() ) {
            Node node = bas.getLast();
            node.getByteArray().free();
            bas.removeLast();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.mina.util.byteaccess.ByteArrayList.Node

Copyright © 2018 www.massapicom. 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.