jicarilla-sandbox/platform/components/http/api/src/java/org/jicarilla/http/util NioUtil.java,1.2,1.3
| 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-serv23839/platform/components/http/api/src/java/org/jicarilla/http/util
Modified Files:
NioUtil.java
Log Message:
Initial version of the really big message redirector.
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.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- NioUtil.java 4 Jan 2004 16:10:17 -0000 1.2
+++ NioUtil.java 20 Feb 2004 14:21:42 -0000 1.3
@@ -94,6 +94,28 @@
return new String( toCharArray( byteBuffer ) );
}
+ /**
+ * Convert the bytes in a set of buffers to characters and return
+ * them (where 1 byte -> 1 char, not 2 bytes -> 1 char) as
+ * a String.
+ *
+ * @param byteBuffers
+ * @return
+ */
+ public static String toString( ByteBuffer[] byteBuffers )
+ {
+ if( byteBuffers == null || byteBuffers.length == 0 )
+ return null;
+
+ StringBuffer buffer = new StringBuffer();
+ for( int i = 0; i < byteBuffers.length; i++ )
+ {
+ ByteBuffer byteBuffer = byteBuffers[i];
+ buffer.append( toCharArray( byteBuffer ) );
+ }
+ return buffer.toString();
+ }
+
public static ByteBuffer toByteBuffer( String string )
{
if( string == null )
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click