jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/util NioUtil.java,1.5,1.6

Leo Simons <[email protected]> Thu, 15 Apr 2004 09:42:54 +0000
Newsgroups gmane.comp.java.jicarilla.cvs
Message-ID <[email protected]>
Update of /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/util
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4871/platform/components/http/api/src/java/org/jicarilla/http/util

Modified Files:
	NioUtil.java 
Log Message:
I forgot to commit some work the other day. Mostly plumbing work on the HTTP server.

Index: NioUtil.java
===================================================================
RCS file: /cvsroot/jicarilla/jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/util/NioUtil.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- NioUtil.java	9 Apr 2004 18:55:59 -0000	1.5
+++ NioUtil.java	15 Apr 2004 09:42:52 -0000	1.6
@@ -144,4 +144,25 @@
 
         return new Integer(new String( toCharArray( byteBuffer ) )).intValue();
     }
+
+    public static ByteBuffer mergeBuffers( ByteBuffer[] body )
+    {
+        int size = getTotalSize( body );
+        ByteBuffer mergedBody = ByteBuffer.allocate( size );
+        for( int i = 0; i < body.length; i++ )
+            mergedBody.put( body[1] );
+        
+        return mergedBody;
+    }
+
+    public static int getTotalSize( ByteBuffer[] body )
+    {
+        int size = 0;
+        for( int i = 0; i < body.length; i++ )
+        {
+            ByteBuffer buffer = body[i];
+            size += buffer.remaining();
+        }
+        return size;
+    }
 }



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click