directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r291310 - /directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java
Date Sat, 24 Sep 2005 15:24:01 GMT
Author: elecharny
Date: Sat Sep 24 08:23:57 2005
New Revision: 291310

URL: http://svn.apache.org/viewcvs?rev=291310&view=rev
Log:
- Added two constructors for Value
- simplified the toString method

Modified:
    directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java

Modified: directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java
URL: http://svn.apache.org/viewcvs/directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java?rev=291310&r1=291309&r2=291310&view=diff
==============================================================================
--- directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java (original)
+++ directory/asn1/trunk/ber-new/src/java/main/org/apache/asn1new/ber/tlv/Value.java Sat Sep
24 08:23:57 2005
@@ -68,6 +68,24 @@
     //~ Methods ------------------------------------------------------------------------------------
 
     /**
+     * The constructor.
+     */
+    public Value( byte[] value )
+    {
+        data = value;
+        currentPos = 0;
+    }
+    
+    /**
+     * The constructor.
+     */
+    public Value()
+    {
+        data = null;
+        currentPos = 0;
+    }
+    
+    /**
      * Initialize the Value
      *
      * @param size The data size to allocate.
@@ -509,22 +527,7 @@
         if ( data != null )
         {
             sb.append( '[' );
-
-            for ( int i = 0; i < data.length; i++ )
-            {
-
-                int b = ( data[i] & 0x00FF );
-
-                if ( ( b < 32 ) || ( b > 127 ) )
-                {
-                    sb.append( "0x" ).append( StringUtils.dumpByte( ( byte ) b ) );
-                }
-                else
-                {
-                    sb.append( ' ' ).append( ( char ) b );
-                }
-            }
-
+            sb.append( StringUtils.dumpBytes( data ) );
             sb.append( ']' );
         }
         else



Mime
View raw message