public class LdapEncoder
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private LdapApiService |
codec
The LdapCodecService
|
| Constructor and Description |
|---|
LdapEncoder(LdapApiService codec)
Creates an instance of Ldap message encoder
|
| Modifier and Type | Method and Description |
|---|---|
private int |
computeControlLength(Control control)
Compute the control's encoded length
|
private int |
computeMessageLength(MessageDecorator<? extends Message> messageDecorator)
Compute the LdapMessage length LdapMessage :
0x30 L1
|
+--> 0x02 0x0(1-4) [0..2^31-1] (MessageId)
+--> protocolOp
[+--> Controls]
MessageId length = Length(0x02) + length(MessageId) + MessageId.length
L1 = length(ProtocolOp)
LdapMessage length = Length(0x30) + Length(L1) + MessageId length + L1
|
static int |
computeReferralLength(Referral referral)
Compute the referral's encoded length
|
private java.nio.ByteBuffer |
encodeControl(java.nio.ByteBuffer buffer,
Control control)
Encode a control to a byte[]
|
java.nio.ByteBuffer |
encodeMessage(Message message)
Generate the PDU which contains the encoded object.
|
static void |
encodeReferral(java.nio.ByteBuffer buffer,
Referral referral)
Encode the Referral message to a PDU.
|
private LdapApiService codec
public LdapEncoder(LdapApiService codec)
codec - The Codec service to use to handle Controls and extended operations,
plus to get access to the underlying services.private int computeControlLength(Control control)
private java.nio.ByteBuffer encodeControl(java.nio.ByteBuffer buffer,
Control control)
throws EncoderException
EncoderExceptionpublic java.nio.ByteBuffer encodeMessage(Message message) throws EncoderException
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
message - The message to encodeEncoderException - If anything goes wrong.private int computeMessageLength(MessageDecorator<? extends Message> messageDecorator)
messageDecorator - the decorated Message who's length is to be encodedpublic static void encodeReferral(java.nio.ByteBuffer buffer,
Referral referral)
throws EncoderException
buffer - The buffer where to put the PDUreferral - The referral to encodeEncoderException - If the encoding failedpublic static int computeReferralLength(Referral referral)
referral - The referral to encode