org.apache.directory.shared.ldap.codec.controls
Class ControlImpl
java.lang.Object
org.apache.directory.shared.asn1.AbstractAsn1Object
org.apache.directory.shared.ldap.codec.controls.AbstractControl
org.apache.directory.shared.ldap.codec.controls.ControlImpl
- All Implemented Interfaces:
- Asn1Object, CodecControl, Control
public class ControlImpl
- extends AbstractControl
A genericcodec Control.
- Version:
- $Rev: 764131 $, $Date: 2009-04-11 03:03:00 +0200 (Sat, 11 Apr 2009) $,
- Author:
- Apache Directory Project
ControlImpl
public ControlImpl(String oid)
- Default constructor.
setValue
public void setValue(byte[] value)
- Set the encoded control value
- Specified by:
setValue in interface Control- Overrides:
setValue in class AbstractControl
- Parameters:
encodedValue - The encoded control value to store
getValue
public byte[] getValue()
- Get the raw control encoded bytes
- Specified by:
getValue in interface Control- Overrides:
getValue in class AbstractControl
- Returns:
- the encoded bytes for the control
computeLength
public int computeLength()
- Compute the Control length
Control :
0x30 L1
|
+--> 0x04 L2 controlType
[+--> 0x01 0x01 criticality]
[+--> 0x04 L3 controlValue]
Control length = Length(0x30) + length(L1)
+ Length(0x04) + Length(L2) + L2
[+ Length(0x01) + 1 + 1]
[+ Length(0x04) + Length(L3) + L3]
- Specified by:
computeLength in interface Asn1Object- Specified by:
computeLength in interface CodecControl- Overrides:
computeLength in class AbstractControl
encode
public ByteBuffer encode(ByteBuffer buffer)
throws EncoderException
- Generate the PDU which contains the Control.
Control :
0x30 LL
0x04 LL type
[0x01 0x01 criticality]
[0x04 LL value]
- Specified by:
encode in interface Asn1Object- Specified by:
encode in interface CodecControl- Overrides:
encode in class AbstractControl
- Parameters:
buffer - The encoded PDU
- Returns:
- A ByteBuffer that contaons the PDU
- Throws:
EncoderException - If anything goes wrong.
Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.