directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r226636 - in /directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo: CompareResponse.java DelResponse.java ModifyDNResponse.java ModifyResponse.java
Date Sun, 31 Jul 2005 12:04:48 GMT
Author: elecharny
Date: Sun Jul 31 05:04:44 2005
New Revision: 226636

URL: http://svn.apache.org/viewcvs?rev=226636&view=rev
Log:
Added the encode method

Modified:
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/CompareResponse.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/DelResponse.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyDNResponse.java
    directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyResponse.java

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/CompareResponse.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/CompareResponse.java?rev=226636&r1=226635&r2=226636&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/CompareResponse.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/CompareResponse.java
Sun Jul 31 05:04:44 2005
@@ -16,7 +16,12 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.tlv.Length;
+import org.apache.asn1.ldap.codec.LdapConstants;
 
 /**
  * An CompareResponse Message. Its syntax is :
@@ -56,6 +61,34 @@
         int ldapResponseLength = super.computeLength();
         
         return 1 + Length.getNbBytes( ldapResponseLength ) + ldapResponseLength;
+    }
+
+    /**
+     * Encode the CompareResponse message to a PDU.
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer )  throws EncoderException
+    {
+        if (buffer == null)
+        {
+            throw new EncoderException("Cannot put a PDU in a null buffer !");
+        }
+        
+        try
+        {
+            // The tag
+            buffer.put( LdapConstants.COMPARE_RESPONSE_TAG );
+            buffer.put( Length.getBytes( getLdapResponseLength() ) );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException("The PDU buffer size is too small !"); 
+        }
+        
+        // The ldapResult
+        return super.encode( buffer);
     }
 
     /**

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/DelResponse.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/DelResponse.java?rev=226636&r1=226635&r2=226636&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/DelResponse.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/DelResponse.java
Sun Jul 31 05:04:44 2005
@@ -16,7 +16,12 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.tlv.Length;
+import org.apache.asn1.ldap.codec.LdapConstants;
 
 /**
  * An DelResponse Message. Its syntax is :
@@ -54,6 +59,34 @@
         int ldapResponseLength = super.computeLength();
         
         return 1 + Length.getNbBytes( ldapResponseLength ) + ldapResponseLength;
+    }
+
+    /**
+     * Encode the DelResponse message to a PDU.
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer )  throws EncoderException
+    {
+        if (buffer == null)
+        {
+            throw new EncoderException("Cannot put a PDU in a null buffer !");
+        }
+        
+        try
+        {
+            // The tag
+            buffer.put( LdapConstants.DEL_RESPONSE_TAG );
+            buffer.put( Length.getBytes( getLdapResponseLength() ) );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException("The PDU buffer size is too small !"); 
+        }
+        
+        // The ldapResult
+        return super.encode( buffer);
     }
 
     /**

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyDNResponse.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyDNResponse.java?rev=226636&r1=226635&r2=226636&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyDNResponse.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyDNResponse.java
Sun Jul 31 05:04:44 2005
@@ -16,7 +16,12 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.tlv.Length;
+import org.apache.asn1.ldap.codec.LdapConstants;
 
 /**
  * An ModifyDNResponse Message. Its syntax is :
@@ -54,6 +59,34 @@
         int ldapResponseLength = super.computeLength();
         
         return 1 + Length.getNbBytes( ldapResponseLength ) + ldapResponseLength;
+    }
+
+    /**
+     * Encode the ModifyDNResponse message to a PDU.
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer )  throws EncoderException
+    {
+        if (buffer == null)
+        {
+            throw new EncoderException("Cannot put a PDU in a null buffer !");
+        }
+        
+        try
+        {
+            // The tag
+            buffer.put( LdapConstants.MODIFY_DN_RESPONSE_TAG );
+            buffer.put( Length.getBytes( getLdapResponseLength() ) );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException("The PDU buffer size is too small !"); 
+        }
+        
+        // The ldapResult
+        return super.encode( buffer);
     }
 
     /**

Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyResponse.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyResponse.java?rev=226636&r1=226635&r2=226636&view=diff
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyResponse.java
(original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/pojo/ModifyResponse.java
Sun Jul 31 05:04:44 2005
@@ -16,7 +16,12 @@
  */
 package org.apache.asn1.ldap.pojo;
 
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
+
+import org.apache.asn1.EncoderException;
 import org.apache.asn1.ber.tlv.Length;
+import org.apache.asn1.ldap.codec.LdapConstants;
 
 /**
  * An ModifyResponse Message. Its syntax is :
@@ -54,6 +59,34 @@
         int ldapResponseLength = super.computeLength();
         
         return 1 + Length.getNbBytes( ldapResponseLength ) + ldapResponseLength;
+    }
+
+    /**
+     * Encode the ModifyResponse message to a PDU.
+     * 
+     * @param buffer The buffer where to put the PDU
+     * @return The PDU.
+     */
+    public ByteBuffer encode( ByteBuffer buffer )  throws EncoderException
+    {
+        if (buffer == null)
+        {
+            throw new EncoderException("Cannot put a PDU in a null buffer !");
+        }
+        
+        try
+        {
+            // The tag
+            buffer.put( LdapConstants.MODIFY_RESPONSE_TAG );
+            buffer.put( Length.getBytes( getLdapResponseLength() ) );
+        }
+        catch ( BufferOverflowException boe )
+        {
+            throw new EncoderException("The PDU buffer size is too small !"); 
+        }
+        
+        // The ldapResult
+        return super.encode( buffer);
     }
 
     /**



Mime
View raw message