Class LDAPMessage

    • Constructor Detail

      • LDAPMessage

        public LDAPMessage​(int messageID,
                           ProtocolOp protocolOp,
                           Control... controls)
        Creates a new LDAP message with the provided information.
        Parameters:
        messageID - The message ID for this LDAP message.
        protocolOp - The protocol op for this LDAP message. It must not be null.
        controls - The set of controls for this LDAP message. It may be null or empty if no controls are required.
      • LDAPMessage

        public LDAPMessage​(int messageID,
                           ProtocolOp protocolOp,
                           java.util.List<Control> controls)
        Creates a new LDAP message with the provided information.
        Parameters:
        messageID - The message ID for this LDAP message.
        protocolOp - The protocol op for this LDAP message. It must not be null.
        controls - The set of controls for this LDAP message. It may be null or empty if no controls are required.
    • Method Detail

      • getMessageID

        public int getMessageID()
        Retrieves the message ID for this LDAP message.
        Returns:
        The message ID for this LDAP message.
      • getProtocolOp

        public ProtocolOp getProtocolOp()
        Retrieves the protocol op for this LDAP message.
        Returns:
        The protocol op for this LDAP message.
      • getProtocolOpType

        public byte getProtocolOpType()
        Retrieves the BER type for the protocol op contained in this LDAP message.
        Returns:
        The BER type for the protocol op contained in this LDAP message.
      • getControls

        public java.util.List<ControlgetControls()
        Retrieves the set of controls for this LDAP message.
        Returns:
        The set of controls for this LDAP message.
      • encode

        public ASN1Element encode()
        Encodes this LDAP message to an ASN.1 element.
        Returns:
        The ASN.1 element containing the encoded representation of this LDAP message.
      • decode

        public static LDAPMessage decode​(ASN1Element element)
                                  throws LDAPException
        Decodes the provided ASN.1 element as an LDAP message.
        Parameters:
        element - The ASN.1 element to be decoded.
        Returns:
        The LDAP message decoded from the provided ASN.1 element.
        Throws:
        LDAPException - If the provided ASN.1 element cannot be decoded as a valid LDAP message.
      • writeTo

        public void writeTo​(ASN1Buffer buffer)
        Writes an encoded representation of this LDAP message to the provided ASN.1 buffer.
        Parameters:
        buffer - The ASN.1 buffer to which the encoded representation should be written.
      • readFrom

        public static LDAPMessage readFrom​(ASN1StreamReader reader,
                                           boolean ignoreSocketTimeout)
                                    throws LDAPException
        Reads an LDAP message from the provided ASN.1 stream reader.
        Parameters:
        reader - The ASN.1 stream reader from which the LDAP message should be read.
        ignoreSocketTimeout - Indicates whether to ignore socket timeout exceptions caught during processing. This should be true when the associated connection is operating in asynchronous mode, and false when operating in synchronous mode. In either case, exceptions will not be ignored for the first read, since that will be handled by the connection reader.
        Returns:
        The decoded LDAP message, or null if the end of the input stream has been reached..
        Throws:
        LDAPException - If an error occurs while attempting to read or decode the LDAP message.
      • readLDAPResponseFrom

        public static LDAPResponse readLDAPResponseFrom​(ASN1StreamReader reader,
                                                        boolean ignoreSocketTimeout)
                                                 throws LDAPException
        Reads LDAPResponse object from the provided ASN.1 stream reader.
        Parameters:
        reader - The ASN.1 stream reader from which the LDAP message should be read.
        ignoreSocketTimeout - Indicates whether to ignore socket timeout exceptions caught during processing. This should be true when the associated connection is operating in asynchronous mode, and false when operating in synchronous mode. In either case, exceptions will not be ignored for the first read, since that will be handled by the connection reader.
        Returns:
        The decoded LDAP message, or null if the end of the input stream has been reached..
        Throws:
        LDAPException - If an error occurs while attempting to read or decode the LDAP message.
      • readLDAPResponseFrom

        public static LDAPResponse readLDAPResponseFrom​(ASN1StreamReader reader,
                                                        boolean ignoreSocketTimeout,
                                                        Schema schema)
                                                 throws LDAPException
        Reads LDAPResponse object from the provided ASN.1 stream reader.
        Parameters:
        reader - The ASN.1 stream reader from which the LDAP message should be read.
        ignoreSocketTimeout - Indicates whether to ignore socket timeout exceptions caught during processing. This should be true when the associated connection is operating in asynchronous mode, and false when operating in synchronous mode. In either case, exceptions will not be ignored for the first read, since that will be handled by the connection reader.
        schema - The schema to use to select the appropriate matching rule for attributes included in the response.
        Returns:
        The decoded LDAP message, or null if the end of the input stream has been reached..
        Throws:
        LDAPException - If an error occurs while attempting to read or decode the LDAP message.
      • toString

        public java.lang.String toString()
        Retrieves a string representation of this LDAP message.
        Overrides:
        toString in class java.lang.Object
        Returns:
        A string representation of this LDAP message.
      • toString

        public void toString​(java.lang.StringBuilder buffer)
        Appends a string representation of this LDAP message to the provided buffer.
        Parameters:
        buffer - The buffer to which the string representation should be appended.