You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2009/02/26 18:05:42 UTC

svn commit: r748210 - in /mina/trunk/core/src/main/java/org/apache/mina/core/buffer: AbstractIoBuffer.java IoBuffer.java

Author: elecharny
Date: Thu Feb 26 17:05:40 2009
New Revision: 748210

URL: http://svn.apache.org/viewvc?rev=748210&view=rev
Log:
o Removed the allocator field in the AbstractIoBuffer as it's already declared in the IoBuffer class
o Added Javadoc

Modified:
    mina/trunk/core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java
    mina/trunk/core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java

Modified: mina/trunk/core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java?rev=748210&r1=748209&r2=748210&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/buffer/AbstractIoBuffer.java Thu Feb 26 17:05:40 2009
@@ -55,9 +55,6 @@
  * @see IoBufferAllocator
  */
 public abstract class AbstractIoBuffer extends IoBuffer {
-    /** The allocator used to creat new buffers */
-    private final IoBufferAllocator allocator;
-
     /** Tells if a buffer has been created from an existing buffer */
     private final boolean derived;
 
@@ -95,7 +92,7 @@
      * @param initialCapacity The initial buffer capacity when created
      */
     protected AbstractIoBuffer(IoBufferAllocator allocator, int initialCapacity) {
-        this.allocator = allocator;
+        setAllocator(allocator);
         this.recapacityAllowed = true;
         this.derived = false;
         this.minimumCapacity = initialCapacity;
@@ -108,7 +105,7 @@
      * @param parent The buffer we get the properties from
      */
     protected AbstractIoBuffer(AbstractIoBuffer parent) {
-        this.allocator = parent.allocator;
+        setAllocator(parent.getAllocator());
         this.recapacityAllowed = false;
         this.derived = true;
         this.minimumCapacity = parent.minimumCapacity;
@@ -186,7 +183,7 @@
 
             //// Reallocate.
             ByteBuffer oldBuf = buf();
-            ByteBuffer newBuf = allocator.allocateNioBuffer(newCapacity,
+            ByteBuffer newBuf = getAllocator().allocateNioBuffer(newCapacity,
                     isDirect());
             oldBuf.clear();
             newBuf.put(oldBuf);
@@ -339,7 +336,7 @@
 
         //// Reallocate.
         ByteBuffer oldBuf = buf();
-        ByteBuffer newBuf = allocator
+        ByteBuffer newBuf = getAllocator()
                 .allocateNioBuffer(newCapacity, isDirect());
         oldBuf.position(0);
         oldBuf.limit(limit);
@@ -611,7 +608,7 @@
 
             //// Reallocate.
             ByteBuffer oldBuf = buf();
-            ByteBuffer newBuf = allocator.allocateNioBuffer(newCapacity,
+            ByteBuffer newBuf = getAllocator().allocateNioBuffer(newCapacity,
                     isDirect());
             newBuf.put(oldBuf);
             buf(newBuf);

Modified: mina/trunk/core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java?rev=748210&r1=748209&r2=748210&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/buffer/IoBuffer.java Thu Feb 26 17:05:40 2009
@@ -145,19 +145,21 @@
  * @version $Rev$, $Date$
  */
 public abstract class IoBuffer implements Comparable<IoBuffer> {
+    /** The allocator used to create new buffers */
     private static IoBufferAllocator allocator = new SimpleBufferAllocator();
 
+    /** An immutable allocated empty direct buffer */
     private static final IoBuffer EMPTY_DIRECT_BUFFER = allocator.allocate(0,
             true);
 
+    /** An immutable allocated empty heap buffer */
     private static final IoBuffer EMPTY_HEAP_BUFFER = allocator.allocate(0,
             false);
 
+    /** A flag indicating which type of buffer we are using : heap or direct */
     private static boolean useDirectBuffer = false;
 
-    /**
-     * An immutable empty buffer.
-     */
+    /** An immutable empty buffer. */
     public static final IoBuffer EMPTY_BUFFER = wrap(new byte[0]);
 
     /**