Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 19416 invoked from network); 31 Jul 2005 12:04:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 31 Jul 2005 12:04:51 -0000 Received: (qmail 69655 invoked by uid 500); 31 Jul 2005 12:04:50 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 69631 invoked by uid 500); 31 Jul 2005 12:04:50 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 69618 invoked by uid 99); 31 Jul 2005 12:04:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 31 Jul 2005 05:04:50 -0700 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 31 Jul 2005 05:04:42 -0700 Received: (qmail 19405 invoked by uid 65534); 31 Jul 2005 12:04:49 -0000 Message-ID: <20050731120449.19404.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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); } /**