org.apache.directory.shared.ldap.codec
Class LdapEncoder

java.lang.Object
  extended by org.apache.directory.shared.ldap.codec.LdapEncoder

public class LdapEncoder
extends Object

LDAP BER encoder.

Author:
Apache Directory Project

Constructor Summary
LdapEncoder()
           
 
Method Summary
static int computeReferralLength(Referral referral)
           
 ByteBuffer encodeMessage(Message message)
          Generate the PDU which contains the encoded object.
static void encodeReferral(ByteBuffer buffer, Referral referral)
          Encode the Referral message to a PDU.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LdapEncoder

public LdapEncoder()
Method Detail

encodeMessage

public ByteBuffer encodeMessage(Message message)
                         throws EncoderException
Generate the PDU which contains the encoded object. The generation is done in two phases : - first, we compute the length of each part and the global PDU length - second, we produce the PDU.
 0x30 L1 
   | 
   +--> 0x02 L2 MessageId  
   +--> ProtocolOp 
   +--> Controls 
   
 L2 = Length(MessageId)
 L1 = Length(0x02) + Length(L2) + L2 + Length(ProtocolOp) + Length(Controls)
 LdapMessageLength = Length(0x30) + Length(L1) + L1
 

Parameters:
message - The message to encode
Returns:
A ByteBuffer that contains the PDU
Throws:
EncoderException - If anything goes wrong.

encodeReferral

public static void encodeReferral(ByteBuffer buffer,
                                  Referral referral)
                           throws EncoderException
Encode the Referral message to a PDU.

Parameters:
buffer - The buffer where to put the PDU
Throws:
EncoderException

computeReferralLength

public static int computeReferralLength(Referral referral)


Copyright © 2003-2011 The Apache Software Foundation. All Rights Reserved.