directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r159440 - directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ber/tlv/Value.java
Date Tue, 29 Mar 2005 22:50:53 GMT
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;
     }
 
     /**



Mime
View raw message