*/
private ByteBuffer encodeControl( ByteBuffer buffer, Control control ) throws EncoderException
{
if ( buffer == null )
{
throw new EncoderException( I18n.err( I18n.ERR_04023 ) );
}
try
{
// The LdapMessage Sequence
buffer.put( UniversalTag.SEQUENCE.getValue() );
// The length has been calculated by the computeLength method
int controlLength = computeControlLength( control );
buffer.put( TLV.getBytes( controlLength ) );
}
catch ( BufferOverflowException boe )
{
throw new EncoderException( I18n.err( I18n.ERR_04005 ) );
}
// The control type
Value.encode( buffer, control.getOid().getBytes() );