public abstract class LdapMessageCodec extends AbstractAsn1Object
Modifier and Type | Field and Description |
---|---|
protected int |
ldapMessageLength
The LdapMessage length
|
parent
Constructor and Description |
---|
LdapMessageCodec()
Creates a new LdapMessage object.
|
Modifier and Type | Method and Description |
---|---|
void |
addControl(Control control)
Add a control to the Controls array
|
void |
addControls(List<Control> controls)
Set or add a list of controls to the Controls array.
|
int |
computeLength()
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
|
protected abstract int |
computeLengthProtocolOp() |
ByteBuffer |
encode()
Generate the PDU which contains the encoded object.
|
protected abstract void |
encodeProtocolOp(ByteBuffer buffer) |
Control |
getCodecControl(String oid) |
List<Control> |
getControls()
Get the Control Objects
|
Control |
getControls(int i)
Get the Control Object at a specific index
|
Control |
getCurrentControl()
Get the current Control Object
|
int |
getMessageId()
Get the message ID
|
abstract MessageTypeEnum |
getMessageType()
Get the message type
|
abstract String |
getMessageTypeName()
Get the message type Name
|
void |
initControls()
Init the controls array
|
void |
setMessageId(int messageId)
Set the message ID
|
protected String |
toString(String protocolOp)
Get a String representation of a LdapMessage
|
addLength, encode, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
public Control getControls(int i)
i
- The index of the Control Object to getpublic Control getCurrentControl()
public void addControl(Control control)
control
- The Control to addpublic void addControls(List<Control> controls)
controls
- The list of Controls to set or addpublic void initControls()
public int getMessageId()
public void setMessageId(int messageId)
messageId
- The message IDpublic abstract MessageTypeEnum getMessageType()
public abstract String getMessageTypeName()
protected abstract int computeLengthProtocolOp()
public int computeLength()
computeLength
in interface Asn1Object
computeLength
in class AbstractAsn1Object
protected abstract void encodeProtocolOp(ByteBuffer buffer) throws EncoderException
EncoderException
public ByteBuffer encode() 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
buffer
- The encoded PDUEncoderException
- If anything goes wrong.Copyright © 2003–2013 The Apache Software Foundation. All rights reserved.