You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2005/03/30 00:50:53 UTC

svn commit: r159440 - directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java

Author: elecharny
Date: Tue Mar 29 14:50:51 2005
New Revision: 159440

URL: http://svn.apache.org/viewcvs?view=rev&rev=159440
Log:
Corrected a bug in the Value class, where a partial buffer wasn't correctly handled (ByteBuffer.array() function was misused)

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

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java?view=diff&r1=159439&r2=159440
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java Tue Mar 29 14:50:51 2005
@@ -19,6 +19,7 @@
 import org.apache.asn1.util.StringUtils;
 
 import java.io.Serializable;
+import java.nio.ByteBuffer;
 
 
 /**
@@ -80,6 +81,28 @@
     public byte[] getData()
     {
         return data;
+    }
+
+    /**
+     * Set a block of bytes in the Value
+     *
+     * @param data The data to set.
+     */
+    public void setData( ByteBuffer data )
+    {
+    	data.put(this.data, 0, data.remaining());
+        currentPos = this.data.length;
+    }
+
+    /**
+     * Append some bytes to the data buffer. 
+     *
+     * @param data The data to append.
+     */
+    public void addData( ByteBuffer data )
+    {
+    	data.put(this.data , currentPos, data.remaining());
+        currentPos = this.data.length;
     }
 
     /**