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

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.shared.ldap.codec.Control
All Implemented Interfaces:
Asn1Object

public class Control
extends AbstractAsn1Object

A Asn1Object to store a Control.

Version:
$Rev: 664290 $, $Date: 2008-06-07 08:28:06 +0200 (Sa, 07 Jun 2008) $,
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
Control()
          Default constructor.
 
Method Summary
 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]
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Generate the PDU which contains the Control.
 java.lang.String getControlType()
          Get the control type
 java.lang.Object getControlValue()
          Get the control value
 boolean getCriticality()
          Get the criticality
 byte[] getEncodedValue()
          Get the raw control encoded bytes
 void setControlType(java.lang.String controlType)
          Set the control type
 void setControlValue(java.lang.Object controlValue)
          Set the control value
 void setCriticality(boolean criticality)
          Set the criticality
 void setEncodedValue(byte[] encodedValue)
          Set the encoded control value
 java.lang.String toString()
          Return a String representing a Control
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Control

public Control()
Default constructor.

Method Detail

getControlType

public java.lang.String getControlType()
Get the control type

Returns:
A string which represent the control type

setControlType

public void setControlType(java.lang.String controlType)
Set the control type

Parameters:
controlType - The OID to be stored

getControlValue

public java.lang.Object getControlValue()
Get the control value

Returns:
The control value

setEncodedValue

public void setEncodedValue(byte[] encodedValue)
Set the encoded control value

Parameters:
encodedValue - The encoded control value to store

getEncodedValue

public byte[] getEncodedValue()
Get the raw control encoded bytes

Returns:
the encoded bytes for the control

setControlValue

public void setControlValue(java.lang.Object controlValue)
Set the control value

Parameters:
controlValue - The control value to store

getCriticality

public boolean getCriticality()
Get the criticality

Returns:
true if the criticality flag is true.

setCriticality

public void setCriticality(boolean criticality)
Set the criticality

Parameters:
criticality - The criticality value

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 class AbstractAsn1Object
Returns:
The object's computed length

encode

public java.nio.ByteBuffer encode(java.nio.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
Overrides:
encode in class AbstractAsn1Object
Parameters:
buffer - The encoded PDU
Returns:
A ByteBuffer that contaons the PDU
Throws:
EncoderException - If anything goes wrong.

toString

public java.lang.String toString()
Return a String representing a Control

Overrides:
toString in class java.lang.Object


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.