mina-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1392134 [11/16] - in /mina/branches/2.0: mina-core/src/main/java/org/apache/mina/core/ mina-core/src/main/java/org/apache/mina/core/buffer/ mina-core/src/main/java/org/apache/mina/core/file/ mina-core/src/main/java/org/apache/mina/core/fil...
Date Sun, 30 Sep 2012 23:43:34 GMT
Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayPool.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayPool.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayPool.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/ByteArrayPool.java Sun Sep 30 23:43:23 2012
@@ -19,13 +19,11 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.util.ArrayList;
 import java.util.Stack;
 
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Creates <code>ByteArray</code>s, using a pool to reduce allocation where possible.
  *
@@ -34,17 +32,22 @@ import org.apache.mina.core.buffer.IoBuf
  *
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class ByteArrayPool implements ByteArrayFactory
-{
+public class ByteArrayPool implements ByteArrayFactory {
 
     private final int MAX_BITS = 32;
 
     private boolean freed;
+
     private final boolean direct;
+
     private ArrayList<Stack<DirectBufferByteArray>> freeBuffers;
+
     private int freeBufferCount = 0;
+
     private long freeMemory = 0;
+
     private final int maxFreeBuffers;
+
     private final int maxFreeMemory;
 
     /**
@@ -57,13 +60,11 @@ public class ByteArrayPool implements By
      * @param maxFreeMemory
      *  The maximum amount of free memory allowed
      */
-    public ByteArrayPool( boolean direct, int maxFreeBuffers, int maxFreeMemory )
-    {
+    public ByteArrayPool(boolean direct, int maxFreeBuffers, int maxFreeMemory) {
         this.direct = direct;
         freeBuffers = new ArrayList<Stack<DirectBufferByteArray>>();
-        for ( int i = 0; i < MAX_BITS; i++ )
-        {
-            freeBuffers.add( new Stack<DirectBufferByteArray>() );
+        for (int i = 0; i < MAX_BITS; i++) {
+            freeBuffers.add(new Stack<DirectBufferByteArray>());
         }
         this.maxFreeBuffers = maxFreeBuffers;
         this.maxFreeMemory = maxFreeMemory;
@@ -76,38 +77,31 @@ public class ByteArrayPool implements By
      * @param size
      *  The size of the array to build
      */
-    public ByteArray create( int size )
-    {
-        if ( size < 1 )
-        {
-            throw new IllegalArgumentException( "Buffer size must be at least 1: " + size );
-        }
-        int bits = bits( size );
-        synchronized ( this )
-        {
-            if ( !freeBuffers.get(bits).isEmpty() )
-            {
-                DirectBufferByteArray ba = freeBuffers.get( bits ).pop();
-                ba.setFreed( false );
-                ba.getSingleIoBuffer().limit( size );
+    public ByteArray create(int size) {
+        if (size < 1) {
+            throw new IllegalArgumentException("Buffer size must be at least 1: " + size);
+        }
+        int bits = bits(size);
+        synchronized (this) {
+            if (!freeBuffers.get(bits).isEmpty()) {
+                DirectBufferByteArray ba = freeBuffers.get(bits).pop();
+                ba.setFreed(false);
+                ba.getSingleIoBuffer().limit(size);
                 return ba;
             }
         }
         IoBuffer bb;
         int bbSize = 1 << bits;
-        bb = IoBuffer.allocate( bbSize, direct );
-        bb.limit( size );
-        DirectBufferByteArray ba = new DirectBufferByteArray( bb );
-        ba.setFreed( false );
+        bb = IoBuffer.allocate(bbSize, direct);
+        bb.limit(size);
+        DirectBufferByteArray ba = new DirectBufferByteArray(bb);
+        ba.setFreed(false);
         return ba;
     }
 
-
-    private int bits( int index )
-    {
+    private int bits(int index) {
         int bits = 0;
-        while ( 1 << bits < index )
-        {
+        while (1 << bits < index) {
             bits++;
         }
         return bits;
@@ -117,13 +111,10 @@ public class ByteArrayPool implements By
      * Frees the buffers
      *
      */
-    public void free()
-    {
-        synchronized ( this )
-        {
-            if ( freed )
-            {
-                throw new IllegalStateException( "Already freed." );
+    public void free() {
+        synchronized (this) {
+            if (freed) {
+                throw new IllegalStateException("Already freed.");
             }
             freed = true;
             freeBuffers.clear();
@@ -131,41 +122,30 @@ public class ByteArrayPool implements By
         }
     }
 
-    private class DirectBufferByteArray extends BufferByteArray
-    {
+    private class DirectBufferByteArray extends BufferByteArray {
 
         public boolean freed;
 
-
-        public DirectBufferByteArray( IoBuffer bb )
-        {
-            super( bb );
+        public DirectBufferByteArray(IoBuffer bb) {
+            super(bb);
         }
 
-
-        public void setFreed( boolean freed )
-        {
+        public void setFreed(boolean freed) {
             this.freed = freed;
         }
 
-
         @Override
-        public void free()
-        {
-            synchronized ( this )
-            {
-                if ( freed )
-                {
-                    throw new IllegalStateException( "Already freed." );
+        public void free() {
+            synchronized (this) {
+                if (freed) {
+                    throw new IllegalStateException("Already freed.");
                 }
                 freed = true;
             }
-            int bits = bits( last() );
-            synchronized ( ByteArrayPool.this )
-            {
-                if ( freeBuffers != null && freeBufferCount < maxFreeBuffers && freeMemory + last() <= maxFreeMemory )
-                {
-                    freeBuffers.get( bits ).push( this );
+            int bits = bits(last());
+            synchronized (ByteArrayPool.this) {
+                if (freeBuffers != null && freeBufferCount < maxFreeBuffers && freeMemory + last() <= maxFreeMemory) {
+                    freeBuffers.get(bits).push(this);
                     freeBufferCount++;
                     freeMemory += last();
                     return;

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArray.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArray.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArray.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArray.java Sun Sep 30 23:43:23 2012
@@ -19,7 +19,6 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -28,7 +27,6 @@ import java.util.Collections;
 import org.apache.mina.core.buffer.IoBuffer;
 import org.apache.mina.util.byteaccess.ByteArrayList.Node;
 
-
 /**
  * A ByteArray composed of other ByteArrays. Optimised for fast relative access
  * via cursors. Absolute access methods are provided, but may perform poorly.
@@ -50,25 +48,22 @@ public final class CompositeByteArray ex
         /**
          * Called when the first component in the composite is entered by the cursor.
          */
-        public void enteredFirstComponent( int componentIndex, ByteArray component );
-
+        public void enteredFirstComponent(int componentIndex, ByteArray component);
 
         /**
          * Called when the next component in the composite is entered by the cursor.
          */
-        public void enteredNextComponent( int componentIndex, ByteArray component );
-
+        public void enteredNextComponent(int componentIndex, ByteArray component);
 
         /**
          * Called when the previous component in the composite is entered by the cursor.
          */
-        public void enteredPreviousComponent( int componentIndex, ByteArray component );
-
+        public void enteredPreviousComponent(int componentIndex, ByteArray component);
 
         /**
          * Called when the last component in the composite is entered by the cursor.
          */
-        public void enteredLastComponent( int componentIndex, ByteArray component );
+        public void enteredLastComponent(int componentIndex, ByteArray component);
     }
 
     /**
@@ -90,7 +85,7 @@ public final class CompositeByteArray ex
      * Creates a new instance of CompositeByteArray.
      */
     public CompositeByteArray() {
-        this( null );
+        this(null);
     }
 
     /**
@@ -100,7 +95,7 @@ public final class CompositeByteArray ex
      * @param byteArrayFactory
      *  The factory used to create the ByteArray objects
      */
-    public CompositeByteArray( ByteArrayFactory byteArrayFactory ) {
+    public CompositeByteArray(ByteArrayFactory byteArrayFactory) {
         this.byteArrayFactory = byteArrayFactory;
     }
 
@@ -111,7 +106,7 @@ public final class CompositeByteArray ex
      *  The first ByteArray in the list
      */
     public ByteArray getFirst() {
-        if ( bas.isEmpty() ) {
+        if (bas.isEmpty()) {
             return null;
         }
 
@@ -125,9 +120,9 @@ public final class CompositeByteArray ex
      * @param ba
      *  The ByteArray to add to the list
      */
-    public void addFirst( ByteArray ba ) {
-        addHook( ba );
-        bas.addFirst( ba );
+    public void addFirst(ByteArray ba) {
+        addHook(ba);
+        bas.addFirst(ba);
     }
 
     /**
@@ -141,7 +136,6 @@ public final class CompositeByteArray ex
         return node == null ? null : node.getByteArray();
     }
 
-
     /**
      * Remove component <code>ByteArray</code>s to the given index (splitting
      * them if necessary) and returning them in a single <code>ByteArray</code>.
@@ -149,8 +143,8 @@ public final class CompositeByteArray ex
      *
      * TODO: Document free behaviour more thoroughly.
      */
-    public ByteArray removeTo( int index ) {
-        if ( index < first() || index > last() ) {
+    public ByteArray removeTo(int index) {
+        if (index < first() || index > last()) {
             throw new IndexOutOfBoundsException();
         }
         // Optimisation when removing exactly one component.
@@ -160,15 +154,15 @@ public final class CompositeByteArray ex
         //            return component;
         //        }
         // Removing
-        CompositeByteArray prefix = new CompositeByteArray( byteArrayFactory );
+        CompositeByteArray prefix = new CompositeByteArray(byteArrayFactory);
         int remaining = index - first();
-        
-        while ( remaining > 0 ) {
+
+        while (remaining > 0) {
             ByteArray component = removeFirst();
-            
-            if ( component.last() <= remaining ) {
+
+            if (component.last() <= remaining) {
                 // Remove entire component.
-                prefix.addLast( component );
+                prefix.addLast(component);
                 remaining -= component.last();
             } else {
                 // Remove part of component. Do this by removing entire
@@ -179,42 +173,42 @@ public final class CompositeByteArray ex
                 // get the limit of the buffer
                 int originalLimit = bb.limit();
                 // set the position to the beginning of the buffer
-                bb.position( 0 );
+                bb.position(0);
                 // set the limit of the buffer to what is remaining
-                bb.limit( remaining );
+                bb.limit(remaining);
                 // create a new IoBuffer, sharing the data with 'bb'
                 IoBuffer bb1 = bb.slice();
                 // set the position at the end of the buffer
-                bb.position( remaining );
+                bb.position(remaining);
                 // gets the limit of the buffer
-                bb.limit( originalLimit );
+                bb.limit(originalLimit);
                 // create a new IoBuffer, sharing teh data with 'bb'
                 IoBuffer bb2 = bb.slice();
                 // create a new ByteArray with 'bb1'
-                ByteArray ba1 = new BufferByteArray( bb1 ) {
+                ByteArray ba1 = new BufferByteArray(bb1) {
                     @Override
                     public void free() {
                         // Do not free.  This will get freed 
                     }
                 };
-                
+
                 // add the new ByteArray to the CompositeByteArray
-                prefix.addLast( ba1 );
+                prefix.addLast(ba1);
                 remaining -= ba1.last();
-                
+
                 // final for anonymous inner class
-                final ByteArray componentFinal = component; 
-                ByteArray ba2 = new BufferByteArray( bb2 ) {
+                final ByteArray componentFinal = component;
+                ByteArray ba2 = new BufferByteArray(bb2) {
                     @Override
                     public void free() {
                         componentFinal.free();
                     }
                 };
                 // add the new ByteArray to the CompositeByteArray
-                addFirst( ba2 );
+                addFirst(ba2);
             }
         }
-        
+
         // return the CompositeByteArray
         return prefix;
     }
@@ -225,9 +219,9 @@ public final class CompositeByteArray ex
      * @param ba
      *  The ByteArray to add to the end of the list
      */
-    public void addLast( ByteArray ba ) {
-        addHook( ba );
-        bas.addLast( ba );
+    public void addLast(ByteArray ba) {
+        addHook(ba);
+        bas.addLast(ba);
     }
 
     /**
@@ -241,103 +235,98 @@ public final class CompositeByteArray ex
         return node == null ? null : node.getByteArray();
     }
 
-
     /**
      * @inheritDoc
      */
     public void free() {
-        while ( !bas.isEmpty() ) {
+        while (!bas.isEmpty()) {
             Node node = bas.getLast();
             node.getByteArray().free();
             bas.removeLast();
         }
     }
 
-
-    private void checkBounds( int index, int accessSize ) {
+    private void checkBounds(int index, int accessSize) {
         int lower = index;
         int upper = index + accessSize;
-        
-        if ( lower < first() ) {
-            throw new IndexOutOfBoundsException( "Index " + lower + " less than start " + first() + "." );
-        }
-        
-        if ( upper > last() ) {
-            throw new IndexOutOfBoundsException( "Index " + upper + " greater than length " + last() + "." );
+
+        if (lower < first()) {
+            throw new IndexOutOfBoundsException("Index " + lower + " less than start " + first() + ".");
         }
-    }
 
+        if (upper > last()) {
+            throw new IndexOutOfBoundsException("Index " + upper + " greater than length " + last() + ".");
+        }
+    }
 
     /**
      * @inheritDoc
      */
     public Iterable<IoBuffer> getIoBuffers() {
-        if ( bas.isEmpty() ) {
+        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 );
+
+        for (IoBuffer bb : node.getByteArray().getIoBuffers()) {
+            result.add(bb);
         }
-        
-        while ( node.hasNextNode() ) {
+
+        while (node.hasNextNode()) {
             node = node.getNextNode();
-            
-            for ( IoBuffer bb : node.getByteArray().getIoBuffers() ) {
-                result.add( bb );
+
+            for (IoBuffer bb : node.getByteArray().getIoBuffers()) {
+                result.add(bb);
             }
         }
-        
+
         return result;
     }
 
-
     /**
      * @inheritDoc
      */
     public IoBuffer getSingleIoBuffer() {
-        if ( byteArrayFactory == null ) {
+        if (byteArrayFactory == null) {
             throw new IllegalStateException(
-                "Can't get single buffer from CompositeByteArray unless it has a ByteArrayFactory." );
+                    "Can't get single buffer from CompositeByteArray unless it has a ByteArrayFactory.");
         }
-        
-        if ( bas.isEmpty() ) {
-            ByteArray ba = byteArrayFactory.create( 1 );
+
+        if (bas.isEmpty()) {
+            ByteArray ba = byteArrayFactory.create(1);
             return ba.getSingleIoBuffer();
         }
-        
+
         int actualLength = last() - first();
-        
+
         {
             Node node = bas.getFirst();
             ByteArray ba = node.getByteArray();
-            
-            if ( ba.last() == actualLength ) {
+
+            if (ba.last() == actualLength) {
                 return ba.getSingleIoBuffer();
             }
         }
-        
+
         // Replace all nodes with a single node.
-        ByteArray target = byteArrayFactory.create( actualLength );
+        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() ) {
+        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 );
+
+        bas.addLast(target);
         return bb;
     }
 
-
     /**
      * @inheritDoc
      */
@@ -345,15 +334,13 @@ public final class CompositeByteArray ex
         return new CursorImpl();
     }
 
-
     /**
      * @inheritDoc
      */
-    public Cursor cursor( int index ) {
-        return new CursorImpl( index );
+    public Cursor cursor(int index) {
+        return new CursorImpl(index);
     }
 
-
     /**
      * Get a cursor starting at index 0 (which may not be the start of the
      * array) and with the given listener.
@@ -361,11 +348,10 @@ public final class CompositeByteArray ex
      * @param listener
      *  Returns a new {@link Cursor} instance
      */
-    public Cursor cursor( CursorListener listener ) {
-        return new CursorImpl( listener );
+    public Cursor cursor(CursorListener listener) {
+        return new CursorImpl(listener);
     }
 
-
     /**
      * Get a cursor starting at the given index and with the given listener.
      * 
@@ -374,72 +360,59 @@ public final class CompositeByteArray ex
      * @param listener
      *  The listener for the Cursor that is returned
      */
-    public Cursor cursor( int index, CursorListener listener ) {
-        return new CursorImpl( index, listener );
+    public Cursor cursor(int index, CursorListener listener) {
+        return new CursorImpl(index, listener);
     }
 
-
     /**
      * @inheritDoc
      */
-    public ByteArray slice( int index, int length ) {
-        return cursor( index ).slice( length );
+    public ByteArray slice(int index, int length) {
+        return cursor(index).slice(length);
     }
 
-
     /**
      * @inheritDoc
      */
-    public byte get( int index ) {
-        return cursor( index ).get();
+    public byte get(int index) {
+        return cursor(index).get();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void put( int index, byte b )
-    {
-        cursor( index ).put( b );
+    public void put(int index, byte b) {
+        cursor(index).put(b);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void get( int index, IoBuffer bb )
-    {
-        cursor( index ).get( bb );
+    public void get(int index, IoBuffer bb) {
+        cursor(index).get(bb);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void put( int index, IoBuffer bb )
-    {
-        cursor( index ).put( bb );
+    public void put(int index, IoBuffer bb) {
+        cursor(index).put(bb);
     }
 
-
     /**
      * @inheritDoc
      */
-    public int first()
-    {
+    public int first() {
         return bas.firstByte();
     }
 
-
     /**
      * @inheritDoc
      */
-    public int last()
-    {
+    public int last() {
         return bas.lastByte();
     }
 
-
     /**
      * This method should be called prior to adding any component
      * <code>ByteArray</code> to a composite.
@@ -447,162 +420,130 @@ public final class CompositeByteArray ex
      * @param ba
      *  The component to add.
      */
-    private void addHook( ByteArray ba )
-    {
+    private void addHook(ByteArray ba) {
         // Check first() is zero, otherwise cursor might not work.
         // TODO: Remove this restriction?
-        if ( ba.first() != 0 )
-        {
-            throw new IllegalArgumentException( "Cannot add byte array that doesn't start from 0: " + ba.first() );
+        if (ba.first() != 0) {
+            throw new IllegalArgumentException("Cannot add byte array that doesn't start from 0: " + ba.first());
         }
         // Check order.
-        if ( order == null )
-        {
+        if (order == null) {
             order = ba.order();
-        }
-        else if ( !order.equals( ba.order() ) )
-        {
-            throw new IllegalArgumentException( "Cannot add byte array with different byte order: " + ba.order() );
+        } else if (!order.equals(ba.order())) {
+            throw new IllegalArgumentException("Cannot add byte array with different byte order: " + ba.order());
         }
     }
 
-
     /**
      * @inheritDoc
      */
-    public ByteOrder order()
-    {
-        if ( order == null )
-        {
-            throw new IllegalStateException( "Byte order not yet set." );
+    public ByteOrder order() {
+        if (order == null) {
+            throw new IllegalStateException("Byte order not yet set.");
         }
         return order;
     }
 
-
     /**
      * @inheritDoc
      */
-    public void order( ByteOrder order ) {
-        if ( order == null || !order.equals( this.order ) ) {
+    public void order(ByteOrder order) {
+        if (order == null || !order.equals(this.order)) {
             this.order = order;
-            
-            if ( !bas.isEmpty() ) {
-                for ( Node node = bas.getFirst(); node.hasNextNode(); node = node.getNextNode() ) {
-                    node.getByteArray().order( order );
+
+            if (!bas.isEmpty()) {
+                for (Node node = bas.getFirst(); node.hasNextNode(); node = node.getNextNode()) {
+                    node.getByteArray().order(order);
                 }
             }
         }
     }
 
-
     /**
      * @inheritDoc
      */
-    public short getShort( int index ) {
-        return cursor( index ).getShort();
+    public short getShort(int index) {
+        return cursor(index).getShort();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putShort( int index, short s ) {
-        cursor( index ).putShort( s );
+    public void putShort(int index, short s) {
+        cursor(index).putShort(s);
     }
 
-
     /**
      * @inheritDoc
      */
-    public int getInt( int index )
-    {
-        return cursor( index ).getInt();
+    public int getInt(int index) {
+        return cursor(index).getInt();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putInt( int index, int i )
-    {
-        cursor( index ).putInt( i );
+    public void putInt(int index, int i) {
+        cursor(index).putInt(i);
     }
 
-
     /**
      * @inheritDoc
      */
-    public long getLong( int index )
-    {
-        return cursor( index ).getLong();
+    public long getLong(int index) {
+        return cursor(index).getLong();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putLong( int index, long l )
-    {
-        cursor( index ).putLong( l );
+    public void putLong(int index, long l) {
+        cursor(index).putLong(l);
     }
 
-
     /**
      * @inheritDoc
      */
-    public float getFloat( int index )
-    {
-        return cursor( index ).getFloat();
+    public float getFloat(int index) {
+        return cursor(index).getFloat();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putFloat( int index, float f )
-    {
-        cursor( index ).putFloat( f );
+    public void putFloat(int index, float f) {
+        cursor(index).putFloat(f);
     }
 
-
     /**
      * @inheritDoc
      */
-    public double getDouble( int index )
-    {
-        return cursor( index ).getDouble();
+    public double getDouble(int index) {
+        return cursor(index).getDouble();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putDouble( int index, double d )
-    {
-        cursor( index ).putDouble( d );
+    public void putDouble(int index, double d) {
+        cursor(index).putDouble(d);
     }
 
-
     /**
      * @inheritDoc
      */
-    public char getChar( int index )
-    {
-        return cursor( index ).getChar();
+    public char getChar(int index) {
+        return cursor(index).getChar();
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putChar( int index, char c )
-    {
-        cursor( index ).putChar( c );
+    public void putChar(int index, char c) {
+        cursor(index).putChar(c);
     }
 
-    private class CursorImpl implements Cursor
-    {
+    private class CursorImpl implements Cursor {
 
         private int index;
 
@@ -616,220 +557,174 @@ public final class CompositeByteArray ex
         // Cursor within current component.
         private ByteArray.Cursor componentCursor;
 
-
-        public CursorImpl()
-        {
-            this( 0, null );
+        public CursorImpl() {
+            this(0, null);
         }
 
-
-        public CursorImpl( int index )
-        {
-            this( index, null );
+        public CursorImpl(int index) {
+            this(index, null);
         }
 
-
-        public CursorImpl( CursorListener listener )
-        {
-            this( 0, listener );
+        public CursorImpl(CursorListener listener) {
+            this(0, listener);
         }
 
-
-        public CursorImpl( int index, CursorListener listener )
-        {
+        public CursorImpl(int index, CursorListener listener) {
             this.index = index;
             this.listener = listener;
         }
 
-
         /**
          * @inheritDoc
          */
-        public int getIndex()
-        {
+        public int getIndex() {
             return index;
         }
 
-
         /**
          * @inheritDoc
          */
-        public void setIndex( int index )
-        {
-            checkBounds( index, 0 );
+        public void setIndex(int index) {
+            checkBounds(index, 0);
             this.index = index;
         }
 
-
         /**
          * @inheritDoc
          */
-        public void skip( int length )
-        {
-            setIndex( index + length );
+        public void skip(int length) {
+            setIndex(index + length);
         }
 
-
         /**
          * @inheritDoc
          */
-        public ByteArray slice( int length )
-        {
-            CompositeByteArray slice = new CompositeByteArray( byteArrayFactory );
+        public ByteArray slice(int length) {
+            CompositeByteArray slice = new CompositeByteArray(byteArrayFactory);
             int remaining = length;
-            while ( remaining > 0 )
-            {
-                prepareForAccess( remaining );
-                int componentSliceSize = Math.min( remaining, componentCursor.getRemaining() );
-                ByteArray componentSlice = componentCursor.slice( componentSliceSize );
-                slice.addLast( componentSlice );
+            while (remaining > 0) {
+                prepareForAccess(remaining);
+                int componentSliceSize = Math.min(remaining, componentCursor.getRemaining());
+                ByteArray componentSlice = componentCursor.slice(componentSliceSize);
+                slice.addLast(componentSlice);
                 index += componentSliceSize;
                 remaining -= componentSliceSize;
             }
             return slice;
         }
 
-
         /**
          * @inheritDoc
          */
-        public ByteOrder order()
-        {
+        public ByteOrder order() {
             return CompositeByteArray.this.order();
         }
 
-
-        private void prepareForAccess( int accessSize )
-        {
+        private void prepareForAccess(int accessSize) {
             // Handle removed node. Do this first so we can remove the reference
             // even if bounds checking fails.
-            if ( componentNode != null && componentNode.isRemoved() )
-            {
+            if (componentNode != null && componentNode.isRemoved()) {
                 componentNode = null;
                 componentCursor = null;
             }
 
             // Bounds checks
-            checkBounds( index, accessSize );
+            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();
-                if ( index <= basMidpoint )
-                {
+            if (componentNode == null) {
+                int basMidpoint = (last() - first()) / 2 + first();
+                if (index <= basMidpoint) {
                     // Search from the start.
                     componentNode = bas.getFirst();
                     componentIndex = first();
-                    if ( listener != null )
-                    {
-                        listener.enteredFirstComponent( componentIndex, componentNode.getByteArray() );
+                    if (listener != null) {
+                        listener.enteredFirstComponent(componentIndex, componentNode.getByteArray());
                     }
-                }
-                else
-                {
+                } else {
                     // Search from the end.
                     componentNode = bas.getLast();
                     componentIndex = last() - componentNode.getByteArray().last();
-                    if ( listener != null )
-                    {
-                        listener.enteredLastComponent( componentIndex, componentNode.getByteArray() );
+                    if (listener != null) {
+                        listener.enteredLastComponent(componentIndex, componentNode.getByteArray());
                     }
                 }
             }
 
             // Go back, if necessary.
-            while ( index < componentIndex )
-            {
+            while (index < componentIndex) {
                 componentNode = componentNode.getPreviousNode();
                 componentIndex -= componentNode.getByteArray().last();
-                if ( listener != null )
-                {
-                    listener.enteredPreviousComponent( componentIndex, componentNode.getByteArray() );
+                if (listener != null) {
+                    listener.enteredPreviousComponent(componentIndex, componentNode.getByteArray());
                 }
             }
 
             // Go forward, if necessary.
-            while ( index >= componentIndex + componentNode.getByteArray().length() )
-            {
+            while (index >= componentIndex + componentNode.getByteArray().length()) {
                 componentIndex += componentNode.getByteArray().last();
                 componentNode = componentNode.getNextNode();
-                if ( listener != null )
-                {
-                    listener.enteredNextComponent( componentIndex, componentNode.getByteArray() );
+                if (listener != null) {
+                    listener.enteredNextComponent(componentIndex, componentNode.getByteArray());
                 }
             }
 
             // Update the cursor.
             int internalComponentIndex = index - componentIndex;
-            if ( componentNode == oldComponentNode )
-            {
+            if (componentNode == oldComponentNode) {
                 // Move existing cursor.
-                componentCursor.setIndex( internalComponentIndex );
-            }
-            else
-            {
+                componentCursor.setIndex(internalComponentIndex);
+            } else {
                 // Create new cursor.
-                componentCursor = componentNode.getByteArray().cursor( internalComponentIndex );
+                componentCursor = componentNode.getByteArray().cursor(internalComponentIndex);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public int getRemaining()
-        {
+        public int getRemaining() {
             return last() - index + 1;
         }
 
-
         /**
          * @inheritDoc
          */
-        public boolean hasRemaining()
-        {
+        public boolean hasRemaining() {
             return getRemaining() > 0;
         }
 
-
         /**
          * @inheritDoc
          */
-        public byte get()
-        {
-            prepareForAccess( 1 );
+        public byte get() {
+            prepareForAccess(1);
             byte b = componentCursor.get();
             index += 1;
             return b;
         }
 
-
         /**
          * @inheritDoc
          */
-        public void put( byte b )
-        {
-            prepareForAccess( 1 );
-            componentCursor.put( b );
+        public void put(byte b) {
+            prepareForAccess(1);
+            componentCursor.put(b);
             index += 1;
         }
 
-
         /**
          * @inheritDoc
          */
-        public void get( IoBuffer bb )
-        {
-            while ( bb.hasRemaining() )
-            {
+        public void get(IoBuffer bb) {
+            while (bb.hasRemaining()) {
                 int remainingBefore = bb.remaining();
-                prepareForAccess( remainingBefore );
-                componentCursor.get( bb );
+                prepareForAccess(remainingBefore);
+                componentCursor.get(bb);
                 int remainingAfter = bb.remaining();
                 // Advance index by actual amount got.
                 int chunkSize = remainingBefore - remainingAfter;
@@ -837,17 +732,14 @@ public final class CompositeByteArray ex
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void put( IoBuffer bb )
-        {
-            while ( bb.hasRemaining() )
-            {
+        public void put(IoBuffer bb) {
+            while (bb.hasRemaining()) {
                 int remainingBefore = bb.remaining();
-                prepareForAccess( remainingBefore );
-                componentCursor.put( bb );
+                prepareForAccess(remainingBefore);
+                componentCursor.put(bb);
                 int remainingAfter = bb.remaining();
                 // Advance index by actual amount put.
                 int chunkSize = remainingBefore - remainingAfter;
@@ -855,149 +747,112 @@ public final class CompositeByteArray ex
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public short getShort()
-        {
-            prepareForAccess( 2 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public short getShort() {
+            prepareForAccess(2);
+            if (componentCursor.getRemaining() >= 4) {
                 short s = componentCursor.getShort();
                 index += 2;
                 return s;
-            }
-            else
-            {
+            } else {
                 byte b0 = get();
                 byte b1 = get();
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    return ( short ) ( ( b0 << 8 ) | ( b1 << 0 ) );
-                }
-                else
-                {
-                    return ( short ) ( ( b1 << 8 ) | ( b0 << 0 ) );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    return (short) ((b0 << 8) | (b1 << 0));
+                } else {
+                    return (short) ((b1 << 8) | (b0 << 0));
                 }
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putShort( short s )
-        {
-            prepareForAccess( 2 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putShort( s );
+        public void putShort(short s) {
+            prepareForAccess(2);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putShort(s);
                 index += 2;
-            }
-            else
-            {
+            } else {
                 byte b0;
                 byte b1;
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    b0 = ( byte ) ( ( s >> 8 ) & 0xff );
-                    b1 = ( byte ) ( ( s >> 0 ) & 0xff );
-                }
-                else
-                {
-                    b0 = ( byte ) ( ( s >> 0 ) & 0xff );
-                    b1 = ( byte ) ( ( s >> 8 ) & 0xff );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    b0 = (byte) ((s >> 8) & 0xff);
+                    b1 = (byte) ((s >> 0) & 0xff);
+                } else {
+                    b0 = (byte) ((s >> 0) & 0xff);
+                    b1 = (byte) ((s >> 8) & 0xff);
                 }
-                put( b0 );
-                put( b1 );
+                put(b0);
+                put(b1);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public int getInt()
-        {
-            prepareForAccess( 4 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public int getInt() {
+            prepareForAccess(4);
+            if (componentCursor.getRemaining() >= 4) {
                 int i = componentCursor.getInt();
                 index += 4;
                 return i;
-            }
-            else
-            {
+            } else {
                 byte b0 = get();
                 byte b1 = get();
                 byte b2 = get();
                 byte b3 = get();
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    return ( ( b0 << 24 ) | ( b1 << 16 ) | ( b2 << 8 ) | ( b3 << 0 ) );
-                }
-                else
-                {
-                    return ( ( b3 << 24 ) | ( b2 << 16 ) | ( b1 << 8 ) | ( b0 << 0 ) );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    return ((b0 << 24) | (b1 << 16) | (b2 << 8) | (b3 << 0));
+                } else {
+                    return ((b3 << 24) | (b2 << 16) | (b1 << 8) | (b0 << 0));
                 }
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putInt( int i )
-        {
-            prepareForAccess( 4 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putInt( i );
+        public void putInt(int i) {
+            prepareForAccess(4);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putInt(i);
                 index += 4;
-            }
-            else
-            {
+            } else {
                 byte b0;
                 byte b1;
                 byte b2;
                 byte b3;
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    b0 = ( byte ) ( ( i >> 24 ) & 0xff );
-                    b1 = ( byte ) ( ( i >> 16 ) & 0xff );
-                    b2 = ( byte ) ( ( i >> 8 ) & 0xff );
-                    b3 = ( byte ) ( ( i >> 0 ) & 0xff );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    b0 = (byte) ((i >> 24) & 0xff);
+                    b1 = (byte) ((i >> 16) & 0xff);
+                    b2 = (byte) ((i >> 8) & 0xff);
+                    b3 = (byte) ((i >> 0) & 0xff);
+                } else {
+                    b0 = (byte) ((i >> 0) & 0xff);
+                    b1 = (byte) ((i >> 8) & 0xff);
+                    b2 = (byte) ((i >> 16) & 0xff);
+                    b3 = (byte) ((i >> 24) & 0xff);
                 }
-                else
-                {
-                    b0 = ( byte ) ( ( i >> 0 ) & 0xff );
-                    b1 = ( byte ) ( ( i >> 8 ) & 0xff );
-                    b2 = ( byte ) ( ( i >> 16 ) & 0xff );
-                    b3 = ( byte ) ( ( i >> 24 ) & 0xff );
-                }
-                put( b0 );
-                put( b1 );
-                put( b2 );
-                put( b3 );
+                put(b0);
+                put(b1);
+                put(b2);
+                put(b3);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public long getLong()
-        {
-            prepareForAccess( 8 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public long getLong() {
+            prepareForAccess(8);
+            if (componentCursor.getRemaining() >= 4) {
                 long l = componentCursor.getLong();
                 index += 8;
                 return l;
-            }
-            else
-            {
+            } else {
                 byte b0 = get();
                 byte b1 = get();
                 byte b2 = get();
@@ -1006,36 +861,26 @@ public final class CompositeByteArray ex
                 byte b5 = get();
                 byte b6 = get();
                 byte b7 = get();
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    return ( ( b0 & 0xffL ) << 56 ) | ( ( b1 & 0xffL ) << 48 ) | ( ( b2 & 0xffL ) << 40 )
-                        | ( ( b3 & 0xffL ) << 32 ) | ( ( b4 & 0xffL ) << 24 ) | ( ( b5 & 0xffL ) << 16 )
-                        | ( ( b6 & 0xffL ) << 8 ) | ( ( b7 & 0xffL ) << 0 );
-                }
-                else
-                {
-                    return ( ( b7 & 0xffL ) << 56 ) | ( ( b6 & 0xffL ) << 48 ) | ( ( b5 & 0xffL ) << 40 )
-                        | ( ( b4 & 0xffL ) << 32 ) | ( ( b3 & 0xffL ) << 24 ) | ( ( b2 & 0xffL ) << 16 )
-                        | ( ( b1 & 0xffL ) << 8 ) | ( ( b0 & 0xffL ) << 0 );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    return ((b0 & 0xffL) << 56) | ((b1 & 0xffL) << 48) | ((b2 & 0xffL) << 40) | ((b3 & 0xffL) << 32)
+                            | ((b4 & 0xffL) << 24) | ((b5 & 0xffL) << 16) | ((b6 & 0xffL) << 8) | ((b7 & 0xffL) << 0);
+                } else {
+                    return ((b7 & 0xffL) << 56) | ((b6 & 0xffL) << 48) | ((b5 & 0xffL) << 40) | ((b4 & 0xffL) << 32)
+                            | ((b3 & 0xffL) << 24) | ((b2 & 0xffL) << 16) | ((b1 & 0xffL) << 8) | ((b0 & 0xffL) << 0);
                 }
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putLong( long l )
-        {
+        public void putLong(long l) {
             //TODO: see if there is some optimizing that can be done here
-            prepareForAccess( 8 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putLong( l );
+            prepareForAccess(8);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putLong(l);
                 index += 8;
-            }
-            else
-            {
+            } else {
                 byte b0;
                 byte b1;
                 byte b2;
@@ -1044,173 +889,134 @@ public final class CompositeByteArray ex
                 byte b5;
                 byte b6;
                 byte b7;
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    b0 = ( byte ) ( ( l >> 56 ) & 0xff );
-                    b1 = ( byte ) ( ( l >> 48 ) & 0xff );
-                    b2 = ( byte ) ( ( l >> 40 ) & 0xff );
-                    b3 = ( byte ) ( ( l >> 32 ) & 0xff );
-                    b4 = ( byte ) ( ( l >> 24 ) & 0xff );
-                    b5 = ( byte ) ( ( l >> 16 ) & 0xff );
-                    b6 = ( byte ) ( ( l >> 8 ) & 0xff );
-                    b7 = ( byte ) ( ( l >> 0 ) & 0xff );
-                }
-                else
-                {
-                    b0 = ( byte ) ( ( l >> 0 ) & 0xff );
-                    b1 = ( byte ) ( ( l >> 8 ) & 0xff );
-                    b2 = ( byte ) ( ( l >> 16 ) & 0xff );
-                    b3 = ( byte ) ( ( l >> 24 ) & 0xff );
-                    b4 = ( byte ) ( ( l >> 32 ) & 0xff );
-                    b5 = ( byte ) ( ( l >> 40 ) & 0xff );
-                    b6 = ( byte ) ( ( l >> 48 ) & 0xff );
-                    b7 = ( byte ) ( ( l >> 56 ) & 0xff );
-                }
-                put( b0 );
-                put( b1 );
-                put( b2 );
-                put( b3 );
-                put( b4 );
-                put( b5 );
-                put( b6 );
-                put( b7 );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    b0 = (byte) ((l >> 56) & 0xff);
+                    b1 = (byte) ((l >> 48) & 0xff);
+                    b2 = (byte) ((l >> 40) & 0xff);
+                    b3 = (byte) ((l >> 32) & 0xff);
+                    b4 = (byte) ((l >> 24) & 0xff);
+                    b5 = (byte) ((l >> 16) & 0xff);
+                    b6 = (byte) ((l >> 8) & 0xff);
+                    b7 = (byte) ((l >> 0) & 0xff);
+                } else {
+                    b0 = (byte) ((l >> 0) & 0xff);
+                    b1 = (byte) ((l >> 8) & 0xff);
+                    b2 = (byte) ((l >> 16) & 0xff);
+                    b3 = (byte) ((l >> 24) & 0xff);
+                    b4 = (byte) ((l >> 32) & 0xff);
+                    b5 = (byte) ((l >> 40) & 0xff);
+                    b6 = (byte) ((l >> 48) & 0xff);
+                    b7 = (byte) ((l >> 56) & 0xff);
+                }
+                put(b0);
+                put(b1);
+                put(b2);
+                put(b3);
+                put(b4);
+                put(b5);
+                put(b6);
+                put(b7);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public float getFloat()
-        {
-            prepareForAccess( 4 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public float getFloat() {
+            prepareForAccess(4);
+            if (componentCursor.getRemaining() >= 4) {
                 float f = componentCursor.getFloat();
                 index += 4;
                 return f;
-            }
-            else
-            {
+            } else {
                 int i = getInt();
-                return Float.intBitsToFloat( i );
+                return Float.intBitsToFloat(i);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putFloat( float f )
-        {
-            prepareForAccess( 4 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putFloat( f );
+        public void putFloat(float f) {
+            prepareForAccess(4);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putFloat(f);
                 index += 4;
-            }
-            else
-            {
-                int i = Float.floatToIntBits( f );
-                putInt( i );
+            } else {
+                int i = Float.floatToIntBits(f);
+                putInt(i);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public double getDouble()
-        {
-            prepareForAccess( 8 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public double getDouble() {
+            prepareForAccess(8);
+            if (componentCursor.getRemaining() >= 4) {
                 double d = componentCursor.getDouble();
                 index += 8;
                 return d;
-            }
-            else
-            {
+            } else {
                 long l = getLong();
-                return Double.longBitsToDouble( l );
+                return Double.longBitsToDouble(l);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putDouble( double d )
-        {
-            prepareForAccess( 8 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putDouble( d );
+        public void putDouble(double d) {
+            prepareForAccess(8);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putDouble(d);
                 index += 8;
-            }
-            else
-            {
-                long l = Double.doubleToLongBits( d );
-                putLong( l );
+            } else {
+                long l = Double.doubleToLongBits(d);
+                putLong(l);
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public char getChar()
-        {
-            prepareForAccess( 2 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
+        public char getChar() {
+            prepareForAccess(2);
+            if (componentCursor.getRemaining() >= 4) {
                 char c = componentCursor.getChar();
                 index += 2;
                 return c;
-            }
-            else
-            {
+            } else {
                 byte b0 = get();
                 byte b1 = get();
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    return ( char ) ( ( b0 << 8 ) | ( b1 << 0 ) );
-                }
-                else
-                {
-                    return ( char ) ( ( b1 << 8 ) | ( b0 << 0 ) );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    return (char) ((b0 << 8) | (b1 << 0));
+                } else {
+                    return (char) ((b1 << 8) | (b0 << 0));
                 }
             }
         }
 
-
         /**
          * @inheritDoc
          */
-        public void putChar( char c )
-        {
-            prepareForAccess( 2 );
-            if ( componentCursor.getRemaining() >= 4 )
-            {
-                componentCursor.putChar( c );
+        public void putChar(char c) {
+            prepareForAccess(2);
+            if (componentCursor.getRemaining() >= 4) {
+                componentCursor.putChar(c);
                 index += 2;
-            }
-            else
-            {
+            } else {
                 byte b0;
                 byte b1;
-                if ( order.equals( ByteOrder.BIG_ENDIAN ) )
-                {
-                    b0 = ( byte ) ( ( c >> 8 ) & 0xff );
-                    b1 = ( byte ) ( ( c >> 0 ) & 0xff );
-                }
-                else
-                {
-                    b0 = ( byte ) ( ( c >> 0 ) & 0xff );
-                    b1 = ( byte ) ( ( c >> 8 ) & 0xff );
+                if (order.equals(ByteOrder.BIG_ENDIAN)) {
+                    b0 = (byte) ((c >> 8) & 0xff);
+                    b1 = (byte) ((c >> 0) & 0xff);
+                } else {
+                    b0 = (byte) ((c >> 0) & 0xff);
+                    b1 = (byte) ((c >> 8) & 0xff);
                 }
-                put( b0 );
-                put( b1 );
+                put(b0);
+                put(b1);
             }
         }
 

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeBase.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeBase.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeBase.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeBase.java Sun Sep 30 23:43:23 2012
@@ -19,13 +19,11 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 
 import org.apache.mina.util.byteaccess.ByteArray.Cursor;
 import org.apache.mina.util.byteaccess.CompositeByteArray.CursorListener;
 
-
 /**
  * Provides common functionality between the
  * <code>CompositeByteArrayRelativeReader</code> and
@@ -33,8 +31,7 @@ import org.apache.mina.util.byteaccess.C
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-abstract class CompositeByteArrayRelativeBase
-{
+abstract class CompositeByteArrayRelativeBase {
 
     /**
      * The underlying <code>CompositeByteArray</code>.
@@ -55,102 +52,78 @@ abstract class CompositeByteArrayRelativ
      * @param cba
      *  The {@link CompositeByteArray} that will be the base for this class
      */
-    public CompositeByteArrayRelativeBase( CompositeByteArray cba )
-    {
+    public CompositeByteArrayRelativeBase(CompositeByteArray cba) {
         this.cba = cba;
-        cursor = cba.cursor( cba.first(), new CursorListener()
-        {
+        cursor = cba.cursor(cba.first(), new CursorListener() {
 
-            public void enteredFirstComponent( int componentIndex, ByteArray component )
-            {
+            public void enteredFirstComponent(int componentIndex, ByteArray component) {
                 // Do nothing.
             }
 
-
-            public void enteredLastComponent( int componentIndex, ByteArray component )
-            {
+            public void enteredLastComponent(int componentIndex, ByteArray component) {
                 assert false;
             }
 
-
-            public void enteredNextComponent( int componentIndex, ByteArray component )
-            {
+            public void enteredNextComponent(int componentIndex, ByteArray component) {
                 cursorPassedFirstComponent();
             }
 
-
-            public void enteredPreviousComponent( int componentIndex, ByteArray component )
-            {
+            public void enteredPreviousComponent(int componentIndex, ByteArray component) {
                 assert false;
             }
 
-        } );
+        });
     }
 
-
     /**
      * @inheritDoc
      */
-    public final int getRemaining()
-    {
+    public final int getRemaining() {
         return cursor.getRemaining();
     }
 
-
     /**
      * @inheritDoc
      */
-    public final boolean hasRemaining()
-    {
+    public final boolean hasRemaining() {
         return cursor.hasRemaining();
     }
 
-
     /**
      * @inheritDoc
      */
-    public ByteOrder order()
-    {
+    public ByteOrder order() {
         return cba.order();
     }
 
-
     /**
      * Make a <code>ByteArray</code> available for access at the end of this object.
      */
-    public final void append( ByteArray ba )
-    {
-        cba.addLast( ba );
+    public final void append(ByteArray ba) {
+        cba.addLast(ba);
     }
 
-
     /**
      * Free all resources associated with this object.
      */
-    public final void free()
-    {
+    public final void free() {
         cba.free();
     }
 
-
     /**
      * Get the index that will be used for the next access.
      */
-    public final int getIndex()
-    {
+    public final int getIndex() {
         return cursor.getIndex();
     }
 
-
     /**
      * Get the index after the last byte that can be accessed.
      */
-    public final int last()
-    {
+    public final int last() {
         return cba.last();
     }
 
-
     /**
      * Called whenever the cursor has passed from the <code>cba</code>'s
      * first component. As the first component is no longer used, this provides

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeReader.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeReader.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeReader.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeReader.java Sun Sep 30 23:43:23 2012
@@ -19,10 +19,8 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides restricted, relative, read-only access to the bytes in a
  * <code>CompositeByteArray</code>. Using this interface has the advantage
@@ -33,8 +31,7 @@ import org.apache.mina.core.buffer.IoBuf
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class CompositeByteArrayRelativeReader extends CompositeByteArrayRelativeBase implements IoRelativeReader
-{
+public class CompositeByteArrayRelativeReader extends CompositeByteArrayRelativeBase implements IoRelativeReader {
 
     /**
      * Whether or not to free component <code>CompositeByteArray</code>s when
@@ -51,46 +48,37 @@ public class CompositeByteArrayRelativeR
      * @param autoFree
      *  If data should be freed once it has been passed in the list
      */
-    public CompositeByteArrayRelativeReader( CompositeByteArray cba, boolean autoFree )
-    {
-        super( cba );
+    public CompositeByteArrayRelativeReader(CompositeByteArray cba, boolean autoFree) {
+        super(cba);
         this.autoFree = autoFree;
     }
 
-
     @Override
-    protected void cursorPassedFirstComponent()
-    {
-        if ( autoFree )
-        {
+    protected void cursorPassedFirstComponent() {
+        if (autoFree) {
             cba.removeFirst().free();
         }
     }
 
-
     /**
      * @inheritDoc
      */
-    public void skip( int length )
-    {
-        cursor.skip( length );
+    public void skip(int length) {
+        cursor.skip(length);
     }
 
-
     /**
      * @inheritDoc
      */
-    public ByteArray slice( int length )
-    {
-        return cursor.slice( length );
+    public ByteArray slice(int length) {
+        return cursor.slice(length);
     }
 
     /**
      * Returns the byte at the current position in the buffer
      * 
      */
-    public byte get()
-    {
+    public byte get() {
         return cursor.get();
     }
 
@@ -98,62 +86,49 @@ public class CompositeByteArrayRelativeR
      * places the data starting at current position into the
      * supplied {@link IoBuffer}
      */
-    public void get( IoBuffer bb )
-    {
-        cursor.get( bb );
+    public void get(IoBuffer bb) {
+        cursor.get(bb);
     }
 
-
     /**
      * @inheritDoc
      */
-    public short getShort()
-    {
+    public short getShort() {
         return cursor.getShort();
     }
 
-
     /**
      * @inheritDoc
      */
-    public int getInt()
-    {
+    public int getInt() {
         return cursor.getInt();
     }
 
-
     /**
      * @inheritDoc
      */
-    public long getLong()
-    {
+    public long getLong() {
         return cursor.getLong();
     }
 
-
     /**
      * @inheritDoc
      */
-    public float getFloat()
-    {
+    public float getFloat() {
         return cursor.getFloat();
     }
 
-
     /**
      * @inheritDoc
      */
-    public double getDouble()
-    {
+    public double getDouble() {
         return cursor.getDouble();
     }
 
-
     /**
      * @inheritDoc
      */
-    public char getChar()
-    {
+    public char getChar() {
         return cursor.getChar();
     }
 

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/CompositeByteArrayRelativeWriter.java Sun Sep 30 23:43:23 2012
@@ -19,10 +19,8 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides restricted, relative, write-only access to the bytes in a
  * <code>CompositeByteArray</code>.
@@ -39,25 +37,21 @@ import org.apache.mina.core.buffer.IoBuf
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class CompositeByteArrayRelativeWriter extends CompositeByteArrayRelativeBase implements IoRelativeWriter
-{
+public class CompositeByteArrayRelativeWriter extends CompositeByteArrayRelativeBase implements IoRelativeWriter {
 
     /**
      * An object that knows how to expand a <code>CompositeByteArray</code>.
      */
-    public interface Expander
-    {
-        void expand( CompositeByteArray cba, int minSize );
+    public interface Expander {
+        void expand(CompositeByteArray cba, int minSize);
     }
 
     /**
      * No-op expander.  The overridden method does nothing.
      * 
      */
-    public static class NopExpander implements Expander
-    {
-        public void expand( CompositeByteArray cba, int minSize )
-        {
+    public static class NopExpander implements Expander {
+        public void expand(CompositeByteArray cba, int minSize) {
             // Do nothing.
         }
     }
@@ -67,28 +61,22 @@ public class CompositeByteArrayRelativeW
      * bytes provided in the constructor
      * 
      */
-    public static class ChunkedExpander implements Expander
-    {
+    public static class ChunkedExpander implements Expander {
 
         private final ByteArrayFactory baf;
 
         private final int newComponentSize;
 
-
-        public ChunkedExpander( ByteArrayFactory baf, int newComponentSize )
-        {
+        public ChunkedExpander(ByteArrayFactory baf, int newComponentSize) {
             this.baf = baf;
             this.newComponentSize = newComponentSize;
         }
 
-
-        public void expand( CompositeByteArray cba, int minSize )
-        {
+        public void expand(CompositeByteArray cba, int minSize) {
             int remaining = minSize;
-            while ( remaining > 0 )
-            {
-                ByteArray component = baf.create( newComponentSize );
-                cba.addLast( component );
+            while (remaining > 0) {
+                ByteArray component = baf.create(newComponentSize);
+                cba.addLast(component);
                 remaining -= newComponentSize;
             }
         }
@@ -98,10 +86,9 @@ public class CompositeByteArrayRelativeW
     /**
      * An object that knows how to flush a <code>ByteArray</code>.
      */
-    public interface Flusher
-    {
+    public interface Flusher {
         // document free() behaviour
-        void flush( ByteArray ba );
+        void flush(ByteArray ba);
     }
 
     /**
@@ -120,7 +107,6 @@ public class CompositeByteArrayRelativeW
      */
     private final boolean autoFlush;
 
-
     /**
      * 
      * Creates a new instance of CompositeByteArrayRelativeWriter.
@@ -134,140 +120,111 @@ public class CompositeByteArrayRelativeW
      * @param autoFlush
      *  Should this class automatically flush?
      */
-    public CompositeByteArrayRelativeWriter( CompositeByteArray cba, Expander expander, Flusher flusher,
-        boolean autoFlush )
-    {
-        super( cba );
+    public CompositeByteArrayRelativeWriter(CompositeByteArray cba, Expander expander, Flusher flusher,
+            boolean autoFlush) {
+        super(cba);
         this.expander = expander;
         this.flusher = flusher;
         this.autoFlush = autoFlush;
     }
 
-
-    private void prepareForAccess( int size )
-    {
+    private void prepareForAccess(int size) {
         int underflow = cursor.getIndex() + size - last();
-        if ( underflow > 0 )
-        {
-            expander.expand( cba, underflow );
+        if (underflow > 0) {
+            expander.expand(cba, underflow);
         }
     }
 
-
     /**
      * Flush to the current index.
      */
-    public void flush()
-    {
-        flushTo( cursor.getIndex() );
+    public void flush() {
+        flushTo(cursor.getIndex());
     }
 
-
     /**
      * Flush to the given index.
      */
-    public void flushTo( int index )
-    {
-        ByteArray removed = cba.removeTo( index );
-        flusher.flush( removed );
+    public void flushTo(int index) {
+        ByteArray removed = cba.removeTo(index);
+        flusher.flush(removed);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void skip( int length )
-    {
-        cursor.skip( length );
+    public void skip(int length) {
+        cursor.skip(length);
     }
 
-
     @Override
-    protected void cursorPassedFirstComponent()
-    {
-        if ( autoFlush )
-        {
-            flushTo( cba.first() + cba.getFirst().length() );
+    protected void cursorPassedFirstComponent() {
+        if (autoFlush) {
+            flushTo(cba.first() + cba.getFirst().length());
         }
     }
 
-
     /**
      * @inheritDoc
      */
-    public void put( byte b )
-    {
-        prepareForAccess( 1 );
-        cursor.put( b );
+    public void put(byte b) {
+        prepareForAccess(1);
+        cursor.put(b);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void put( IoBuffer bb )
-    {
-        prepareForAccess( bb.remaining() );
-        cursor.put( bb );
+    public void put(IoBuffer bb) {
+        prepareForAccess(bb.remaining());
+        cursor.put(bb);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putShort( short s )
-    {
-        prepareForAccess( 2 );
-        cursor.putShort( s );
+    public void putShort(short s) {
+        prepareForAccess(2);
+        cursor.putShort(s);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putInt( int i )
-    {
-        prepareForAccess( 4 );
-        cursor.putInt( i );
+    public void putInt(int i) {
+        prepareForAccess(4);
+        cursor.putInt(i);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putLong( long l )
-    {
-        prepareForAccess( 8 );
-        cursor.putLong( l );
+    public void putLong(long l) {
+        prepareForAccess(8);
+        cursor.putLong(l);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putFloat( float f )
-    {
-        prepareForAccess( 4 );
-        cursor.putFloat( f );
+    public void putFloat(float f) {
+        prepareForAccess(4);
+        cursor.putFloat(f);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putDouble( double d )
-    {
-        prepareForAccess( 8 );
-        cursor.putDouble( d );
+    public void putDouble(double d) {
+        prepareForAccess(8);
+        cursor.putDouble(d);
     }
 
-
     /**
      * @inheritDoc
      */
-    public void putChar( char c )
-    {
-        prepareForAccess( 2 );
-        cursor.putChar( c );
+    public void putChar(char c) {
+        prepareForAccess(2);
+        cursor.putChar(c);
     }
 }

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteReader.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteReader.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteReader.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteReader.java Sun Sep 30 23:43:23 2012
@@ -19,94 +19,79 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides absolute read access to a sequence of bytes.
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoAbsoluteReader
-{
+public interface IoAbsoluteReader {
 
     /**
      * Get the index of the first byte that can be accessed.
      */
     int first();
 
-
     /**
      * Gets the index after the last byte that can be accessed.
      */
     int last();
 
-
     /**
      * Gets the total number of bytes that can be accessed.
      */
     int length();
 
-
     /**
      * Creates an array with a view of part of this array.
      */
-    ByteArray slice( int index, int length );
-
+    ByteArray slice(int index, int length);
 
     /**
      * Gets the order of the bytes.
      */
     ByteOrder order();
 
-
     /**
      * Gets a <code>byte</code> from the given index.
      */
-    byte get( int index );
-
+    byte get(int index);
 
     /**
      * Gets enough bytes to fill the <code>IoBuffer</code> from the given index.
      */
-    public void get( int index, IoBuffer bb );
-
+    public void get(int index, IoBuffer bb);
 
     /**
      * Gets a <code>short</code> from the given index.
      */
-    short getShort( int index );
-
+    short getShort(int index);
 
     /**
      * Gets an <code>int</code> from the given index.
      */
-    int getInt( int index );
-
+    int getInt(int index);
 
     /**
      * Gets a <code>long</code> from the given index.
      */
-    long getLong( int index );
-
+    long getLong(int index);
 
     /**
      * Gets a <code>float</code> from the given index.
      */
-    float getFloat( int index );
-
+    float getFloat(int index);
 
     /**
      * Gets a <code>double</code> from the given index.
      */
-    double getDouble( int index );
-
+    double getDouble(int index);
 
     /**
      * Gets a <code>char</code> from the given index.
      */
-    char getChar( int index );
+    char getChar(int index);
 }

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteWriter.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteWriter.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteWriter.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoAbsoluteWriter.java Sun Sep 30 23:43:23 2012
@@ -19,82 +19,69 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides absolute write access to a sequence of bytes.
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoAbsoluteWriter
-{
+public interface IoAbsoluteWriter {
 
     /**
      * Get the index of the first byte that can be accessed.
      */
     int first();
 
-
     /**
      * Gets the index after the last byte that can be accessed.
      */
     int last();
 
-
     /**
      * Gets the order of the bytes.
      */
     ByteOrder order();
 
-
     /**
      * Puts a <code>byte</code> at the given index.
      */
-    void put( int index, byte b );
-
+    void put(int index, byte b);
 
     /**
      * Puts bytes from the <code>IoBuffer</code> at the given index.
      */
-    public void put( int index, IoBuffer bb );
-
+    public void put(int index, IoBuffer bb);
 
     /**
      * Puts a <code>short</code> at the given index.
      */
-    void putShort( int index, short s );
-
+    void putShort(int index, short s);
 
     /**
      * Puts an <code>int</code> at the given index.
      */
-    void putInt( int index, int i );
-
+    void putInt(int index, int i);
 
     /**
      * Puts a <code>long</code> at the given index.
      */
-    void putLong( int index, long l );
-
+    void putLong(int index, long l);
 
     /**
      * Puts a <code>float</code> at the given index.
      */
-    void putFloat( int index, float f );
-
+    void putFloat(int index, float f);
 
     /**
      * Puts a <code>double</code> at the given index.
      */
-    void putDouble( int index, double d );
-
+    void putDouble(int index, double d);
 
     /**
      * Puts a <code>char</code> at the given index.
      */
-    void putChar( int index, char c );
+    void putChar(int index, char c);
 }

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeReader.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeReader.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeReader.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeReader.java Sun Sep 30 23:43:23 2012
@@ -19,92 +19,77 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides relative read access to a sequence of bytes.
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoRelativeReader
-{
+public interface IoRelativeReader {
 
     /**
      * Gets the number of remaining bytes that can be read.
      */
     int getRemaining();
 
-
     /**
      * Checks if there are any remaining bytes that can be read.
      */
     boolean hasRemaining();
 
-
     /**
      * Advances the reader by the given number of bytes.
      */
-    void skip( int length );
-
+    void skip(int length);
 
     /**
      * Creates an array with a view of part of this array.
      */
-    ByteArray slice( int length );
-
+    ByteArray slice(int length);
 
     /**
      * Gets the order of the bytes.
      */
     ByteOrder order();
 
-
     /**
      * Gets a <code>byte</code> and advances the reader.
      */
     byte get();
 
-
     /**
      * Gets enough bytes to fill the <code>IoBuffer</code> and advances the reader.
      */
-    void get( IoBuffer bb );
-
+    void get(IoBuffer bb);
 
     /**
      * Gets a <code>short</code> and advances the reader.
      */
     short getShort();
 
-
     /**
      * Gets an <code>int</code> and advances the reader.
      */
     int getInt();
 
-
     /**
      * Gets a <code>long</code> and advances the reader.
      */
     long getLong();
 
-
     /**
      * Gets a <code>float</code> and advances the reader.
      */
     float getFloat();
 
-
     /**
      * Gets a <code>double</code> and advances the reader.
      */
     double getDouble();
 
-
     /**
      * Gets a <code>char</code> and advances the reader.
      */

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeWriter.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeWriter.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeWriter.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/IoRelativeWriter.java Sun Sep 30 23:43:23 2012
@@ -19,88 +19,74 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import java.nio.ByteOrder;
 
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Provides relative read access to a sequence of bytes.
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public interface IoRelativeWriter
-{
+public interface IoRelativeWriter {
 
     /**
      * Gets the number of remaining bytes that can be read.
      */
     int getRemaining();
 
-
     /**
      * Checks if there are any remaining bytes that can be read.
      */
     boolean hasRemaining();
 
-
     /**
      * Advances the writer by the given number of bytes.
      */
-    void skip( int length );
-
+    void skip(int length);
 
     /**
      * Gets the order of the bytes.
      */
     ByteOrder order();
 
-
     /**
      * Puts a <code>byte</code> and advances the reader.
      */
-    void put( byte b );
-
+    void put(byte b);
 
     /**
      * Puts enough bytes to fill the <code>IoBuffer</code> and advances the reader.
      */
-    void put( IoBuffer bb );
-
+    void put(IoBuffer bb);
 
     /**
      * Puts a <code>short</code> and advances the reader.
      */
-    void putShort( short s );
-
+    void putShort(short s);
 
     /**
      * Puts an <code>int</code> and advances the reader.
      */
-    void putInt( int i );
-
+    void putInt(int i);
 
     /**
      * Puts a <code>long</code> and advances the reader.
      */
-    void putLong( long l );
-
+    void putLong(long l);
 
     /**
      * Puts a <code>float</code> and advances the reader.
      */
-    void putFloat( float f );
-
+    void putFloat(float f);
 
     /**
      * Puts a <code>double</code> and advances the reader.
      */
-    void putDouble( double d );
-
+    void putDouble(double d);
 
     /**
      * Puts a <code>char</code> and advances the reader.
      */
-    void putChar( char c );
+    void putChar(char c);
 }

Modified: mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/SimpleByteArrayFactory.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/SimpleByteArrayFactory.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/SimpleByteArrayFactory.java (original)
+++ mina/branches/2.0/mina-core/src/main/java/org/apache/mina/util/byteaccess/SimpleByteArrayFactory.java Sun Sep 30 23:43:23 2012
@@ -19,10 +19,8 @@
  */
 package org.apache.mina.util.byteaccess;
 
-
 import org.apache.mina.core.buffer.IoBuffer;
 
-
 /**
  * Creates <code>ByteArray</code> backed by a heap-allocated
  * <code>IoBuffer</code>. The free method on returned
@@ -30,35 +28,28 @@ import org.apache.mina.core.buffer.IoBuf
  * 
  * @author <a href="http://mina.apache.org">Apache MINA Project</a>
  */
-public class SimpleByteArrayFactory implements ByteArrayFactory
-{
+public class SimpleByteArrayFactory implements ByteArrayFactory {
     /**
      * 
      * Creates a new instance of SimpleByteArrayFactory.
      *
      */
-    public SimpleByteArrayFactory()
-    {
+    public SimpleByteArrayFactory() {
         super();
     }
 
-
     /**
      * @inheritDoc
      */
-    public ByteArray create( int size )
-    {
-        if ( size < 0 )
-        {
-            throw new IllegalArgumentException( "Buffer size must not be negative:" + size );
+    public ByteArray create(int size) {
+        if (size < 0) {
+            throw new IllegalArgumentException("Buffer size must not be negative:" + size);
         }
-        IoBuffer bb = IoBuffer.allocate( size );
-        ByteArray ba = new BufferByteArray( bb )
-        {
+        IoBuffer bb = IoBuffer.allocate(size);
+        ByteArray ba = new BufferByteArray(bb) {
 
             @Override
-            public void free()
-            {
+            public void free() {
                 // Nothing to do.
             }
 

Modified: mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/FutureTest.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/FutureTest.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/FutureTest.java (original)
+++ mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/FutureTest.java Sun Sep 30 23:43:23 2012
@@ -254,7 +254,7 @@ public class FutureTest {
         public TestListener() {
             super();
         }
-        
+
         public void operationComplete(IoFuture future) {
             this.notifiedFuture = future;
         }

Modified: mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoFilterChainTest.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoFilterChainTest.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoFilterChainTest.java (original)
+++ mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoFilterChainTest.java Sun Sep 30 23:43:23 2012
@@ -46,7 +46,9 @@ import static org.junit.Assert.assertSam
  */
 public class IoFilterChainTest {
     private DummySession dummySession;
+
     private IoFilterChain chain;
+
     String testResult;
 
     private final IoHandler handler = new IoHandlerAdapter() {
@@ -202,8 +204,7 @@ public class IoFilterChainTest {
     public void testChained() throws Exception {
         chain.addLast("A", new EventOrderTestFilter('A'));
         chain.addLast("B", new EventOrderTestFilter('B'));
-        run("AS0 BS0 HS0" + "ASO BSO HSO" + "AMR BMR HMR"
-                + "BFW AFW AMS BMS HMS" + "ASI BSI HSI" + "AEC BEC HEC"
+        run("AS0 BS0 HS0" + "ASO BSO HSO" + "AMR BMR HMR" + "BFW AFW AMS BMS HMS" + "ASI BSI HSI" + "AEC BEC HEC"
                 + "ASC BSC HSC");
     }
 
@@ -228,7 +229,7 @@ public class IoFilterChainTest {
         chain.fireSessionClosed();
 
         testResult = formatResult(testResult);
-        String formatedExpectedResult = formatResult(expectedResult); 
+        String formatedExpectedResult = formatResult(expectedResult);
 
         assertEquals(formatedExpectedResult, testResult);
     }
@@ -236,10 +237,10 @@ public class IoFilterChainTest {
     private String formatResult(String result) {
         String newResult = result.replaceAll("\\s", "");
         StringBuilder buf = new StringBuilder(newResult.length() * 4 / 3);
-        
+
         for (int i = 0; i < newResult.length(); i++) {
             buf.append(newResult.charAt(i));
-        
+
             if (i % 3 == 2) {
                 buf.append(' ');
             }
@@ -274,43 +275,37 @@ public class IoFilterChainTest {
         }
 
         @Override
-        public void sessionIdle(NextFilter nextFilter, IoSession session,
-                IdleStatus status) {
+        public void sessionIdle(NextFilter nextFilter, IoSession session, IdleStatus status) {
             testResult += id + "SI";
             nextFilter.sessionIdle(session, status);
         }
 
         @Override
-        public void exceptionCaught(NextFilter nextFilter, IoSession session,
-                Throwable cause) {
+        public void exceptionCaught(NextFilter nextFilter, IoSession session, Throwable cause) {
             testResult += id + "EC";
             nextFilter.exceptionCaught(session, cause);
         }
 
         @Override
-        public void filterWrite(NextFilter nextFilter, IoSession session,
-                WriteRequest writeRequest) {
+        public void filterWrite(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) {
             testResult += id + "FW";
             nextFilter.filterWrite(session, writeRequest);
         }
 
         @Override
-        public void messageReceived(NextFilter nextFilter, IoSession session,
-                Object message) {
+        public void messageReceived(NextFilter nextFilter, IoSession session, Object message) {
             testResult += id + "MR";
             nextFilter.messageReceived(session, message);
         }
 
         @Override
-        public void messageSent(NextFilter nextFilter, IoSession session,
-                WriteRequest writeRequest) {
+        public void messageSent(NextFilter nextFilter, IoSession session, WriteRequest writeRequest) {
             testResult += id + "MS";
             nextFilter.messageSent(session, writeRequest);
         }
 
         @Override
-        public void filterClose(NextFilter nextFilter, IoSession session)
-                throws Exception {
+        public void filterClose(NextFilter nextFilter, IoSession session) throws Exception {
             nextFilter.filterClose(session);
         }
     }
@@ -322,16 +317,14 @@ public class IoFilterChainTest {
         public AddRemoveTestFilter() {
             super();
         }
-        
+
         @Override
-        public void onPostAdd(IoFilterChain parent, String name,
-                NextFilter nextFilter) {
+        public void onPostAdd(IoFilterChain parent, String name, NextFilter nextFilter) {
             testResult += "ADDED";
         }
 
         @Override
-        public void onPostRemove(IoFilterChain parent, String name,
-                NextFilter nextFilter) {
+        public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) {
             testResult += "REMOVED";
         }
     }

Modified: mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoServiceListenerSupportTest.java
URL: http://svn.apache.org/viewvc/mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoServiceListenerSupportTest.java?rev=1392134&r1=1392133&r2=1392134&view=diff
==============================================================================
--- mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoServiceListenerSupportTest.java (original)
+++ mina/branches/2.0/mina-core/src/test/java/org/apache/mina/core/IoServiceListenerSupportTest.java Sun Sep 30 23:43:23 2012
@@ -49,8 +49,7 @@ public class IoServiceListenerSupportTes
 
     @Test
     public void testServiceLifecycle() throws Exception {
-        IoServiceListenerSupport support = new IoServiceListenerSupport(
-                mockService);
+        IoServiceListenerSupport support = new IoServiceListenerSupport(mockService);
 
         IoServiceListener listener = EasyMock.createStrictMock(IoServiceListener.class);
 
@@ -81,14 +80,13 @@ public class IoServiceListenerSupportTes
 
     @Test
     public void testSessionLifecycle() throws Exception {
-        IoServiceListenerSupport support = new IoServiceListenerSupport(
-                mockService);
+        IoServiceListenerSupport support = new IoServiceListenerSupport(mockService);
 
         DummySession session = new DummySession();
         session.setService(mockService);
         session.setLocalAddress(ADDRESS);
 
-        IoHandler handler = EasyMock.createStrictMock( IoHandler.class );
+        IoHandler handler = EasyMock.createStrictMock(IoHandler.class);
         session.setHandler(handler);
 
         IoServiceListener listener = EasyMock.createStrictMock(IoServiceListener.class);
@@ -135,8 +133,7 @@ public class IoServiceListenerSupportTes
     public void testDisconnectOnUnbind() throws Exception {
         IoAcceptor acceptor = EasyMock.createStrictMock(IoAcceptor.class);
 
-        final IoServiceListenerSupport support = new IoServiceListenerSupport(
-                acceptor);
+        final IoServiceListenerSupport support = new IoServiceListenerSupport(acceptor);
 
         final DummySession session = new DummySession();
         session.setService(acceptor);
@@ -210,8 +207,7 @@ public class IoServiceListenerSupportTes
     public void testConnectorActivation() throws Exception {
         IoConnector connector = EasyMock.createStrictMock(IoConnector.class);
 
-        IoServiceListenerSupport support = new IoServiceListenerSupport(
-                connector);
+        IoServiceListenerSupport support = new IoServiceListenerSupport(connector);
 
         final DummySession session = new DummySession();
         session.setService(connector);



Mime
View raw message