From 5a80d1c62159402efe10a645445e6487b8bc989d Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Tue, 9 Aug 2011 20:57:10 +0200
Subject: CachedBufferFactory: Cosmetic changes - comments, -1 -> 0

---
 src/java/com/jogamp/common/nio/CachedBufferFactory.java | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

(limited to 'src')

diff --git a/src/java/com/jogamp/common/nio/CachedBufferFactory.java b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
index dbeed2d..b9d75db 100644
--- a/src/java/com/jogamp/common/nio/CachedBufferFactory.java
+++ b/src/java/com/jogamp/common/nio/CachedBufferFactory.java
@@ -153,18 +153,27 @@ public class CachedBufferFactory {
     
     /**
      * Returns the allocation size used to create new internal buffers.
-     * This represents the initial size if {@link #isFixed()} == true.
+     * 0 means that the buffer will not grows, see {@link #isFixed()}.
      */
     public int getAllocationSize() {
         return ALLOCATION_SIZE;
     }
     
+    /**
+     * @return true if buffer cannot grow, otherwise false
+     */
     private void checkIfFixed() {
-        if(ALLOCATION_SIZE == -1) {
+        if(ALLOCATION_SIZE == 0) {
             throw new RuntimeException("fixed size buffer factory ran out ouf bounds.");
         }
     }
 
+    public void destroy() {
+        if(null != currentBuffer) {
+            currentBuffer.clear();
+            currentBuffer = null;
+        }
+    }
     public ByteBuffer newDirectByteBuffer(int size) {
         
         // if large enough... just create it
-- 
cgit v1.2.3