directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1066814 - /directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java
Date Thu, 03 Feb 2011 13:35:41 GMT
Author: elecharny
Date: Thu Feb  3 13:35:41 2011
New Revision: 1066814

URL: http://svn.apache.org/viewvc?rev=1066814&view=rev
Log:
Added a copy( byte[] ) method

Modified:
    directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java

Modified: directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java?rev=1066814&r1=1066813&r2=1066814&view=diff
==============================================================================
--- directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java
(original)
+++ directory/shared/branches/m1/util/src/main/java/org/apache/directory/shared/util/Strings.java
Thu Feb  3 13:35:41 2011
@@ -1977,4 +1977,24 @@ public final class Strings
 
         return bytes;
     }
+    
+    
+    /**
+     * Copy a byte array into a new byte array
+     * 
+     * @param value the byte array to copy
+     * @return The copied byte array
+     */
+    public static byte[] copy( byte[] value )
+    {
+    	if ( isEmpty( value ) )
+    	{
+    		return StringConstants.EMPTY_BYTES;
+    	}
+    	
+    	byte[] copy = new byte[value.length];
+    	System.arraycopy( value, 0, copy, 0, value.length );
+    	
+    	return copy;
+    }
 }



Mime
View raw message