Search in sources :

Example 51 with ASN1Buffer

use of com.unboundid.asn1.ASN1Buffer in project ldapsdk by pingidentity.

the class Attribute method writeTo.

/**
 * Writes an ASN.1-encoded representation of this attribute to the provided
 * ASN.1 buffer.
 *
 * @param  buffer  The ASN.1 buffer to which the encoded representation should
 *                 be written.
 */
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence attrSequence = buffer.beginSequence();
    buffer.addOctetString(name);
    final ASN1BufferSet valueSet = buffer.beginSet();
    for (final ASN1OctetString value : values) {
        buffer.addElement(value);
    }
    valueSet.end();
    attrSequence.end();
}
Also used : ASN1OctetString(com.unboundid.asn1.ASN1OctetString) ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) ASN1BufferSet(com.unboundid.asn1.ASN1BufferSet)

Example 52 with ASN1Buffer

use of com.unboundid.asn1.ASN1Buffer in project ldapsdk by pingidentity.

the class ModifyDNRequestProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST);
    buffer.addOctetString(dn);
    buffer.addOctetString(newRDN);
    buffer.addBoolean(deleteOldRDN);
    if (newSuperiorDN != null) {
        buffer.addOctetString(TYPE_NEW_SUPERIOR, newSuperiorDN);
    }
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence)

Example 53 with ASN1Buffer

use of com.unboundid.asn1.ASN1Buffer in project ldapsdk by pingidentity.

the class SearchRequestProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_SEARCH_REQUEST);
    buffer.addOctetString(baseDN);
    buffer.addEnumerated(scope.intValue());
    buffer.addEnumerated(derefPolicy.intValue());
    buffer.addInteger(sizeLimit);
    buffer.addInteger(timeLimit);
    buffer.addBoolean(typesOnly);
    filter.writeTo(buffer);
    final ASN1BufferSequence attrSequence = buffer.beginSequence();
    for (final String s : attributes) {
        buffer.addOctetString(s);
    }
    attrSequence.end();
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) ASN1OctetString(com.unboundid.asn1.ASN1OctetString)

Example 54 with ASN1Buffer

use of com.unboundid.asn1.ASN1Buffer in project ldapsdk by pingidentity.

the class SearchResultEntryProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY);
    buffer.addOctetString(dn);
    final ASN1BufferSequence attrSequence = buffer.beginSequence();
    for (final Attribute a : attributes) {
        a.writeTo(buffer);
    }
    attrSequence.end();
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) Attribute(com.unboundid.ldap.sdk.Attribute)

Example 55 with ASN1Buffer

use of com.unboundid.asn1.ASN1Buffer in project ldapsdk by pingidentity.

the class SearchResultReferenceProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE);
    for (final String s : referralURLs) {
        buffer.addOctetString(s);
    }
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) ASN1OctetString(com.unboundid.asn1.ASN1OctetString)

Aggregations

ASN1Buffer (com.unboundid.asn1.ASN1Buffer)100 ASN1StreamReader (com.unboundid.asn1.ASN1StreamReader)91 ByteArrayInputStream (java.io.ByteArrayInputStream)91 Test (org.testng.annotations.Test)91 ASN1BufferSequence (com.unboundid.asn1.ASN1BufferSequence)47 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)32 LinkedList (java.util.LinkedList)28 DN (com.unboundid.ldap.sdk.DN)21 Control (com.unboundid.ldap.sdk.Control)17 ASN1Element (com.unboundid.asn1.ASN1Element)8 Attribute (com.unboundid.ldap.sdk.Attribute)6 SimpleBindRequest (com.unboundid.ldap.sdk.SimpleBindRequest)4 ASN1BufferSet (com.unboundid.asn1.ASN1BufferSet)3 Modification (com.unboundid.ldap.sdk.Modification)3 RDN (com.unboundid.ldap.sdk.RDN)2 JSONObjectFilter (com.unboundid.ldap.sdk.unboundidds.jsonfilter.JSONObjectFilter)2 OutputStream (java.io.OutputStream)2 ExtendedResponseProtocolOp (com.unboundid.ldap.protocol.ExtendedResponseProtocolOp)1 LDAPMessage (com.unboundid.ldap.protocol.LDAPMessage)1 ExtendedRequest (com.unboundid.ldap.sdk.ExtendedRequest)1