Package com.unboundid.ldap.protocol
Class LDAPMessage
- java.lang.Object
-
- com.unboundid.ldap.protocol.LDAPMessage
-
- All Implemented Interfaces:
java.io.Serializable
@InternalUseOnly @NotMutable @ThreadSafety(level=COMPLETELY_THREADSAFE) public final class LDAPMessage extends java.lang.Object implements java.io.Serializable
This class provides a data structure that may be used to represent LDAP protocol messages. Each LDAP message contains a message ID, a protocol op, and an optional set of controls.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static byte
MESSAGE_TYPE_CONTROLS
The BER type to use for the set of controls.static byte
PROTOCOL_OP_TYPE_ABANDON_REQUEST
The BER type to use for the abandon request protocol op.static byte
PROTOCOL_OP_TYPE_ADD_REQUEST
The BER type to use for the add request protocol op.static byte
PROTOCOL_OP_TYPE_ADD_RESPONSE
The BER type to use for the add response protocol op.static byte
PROTOCOL_OP_TYPE_BIND_REQUEST
The BER type to use for the bind request protocol op.static byte
PROTOCOL_OP_TYPE_BIND_RESPONSE
The BER type to use for the bind response protocol op.static byte
PROTOCOL_OP_TYPE_COMPARE_REQUEST
The BER type to use for the compare request protocol op.static byte
PROTOCOL_OP_TYPE_COMPARE_RESPONSE
The BER type to use for the compare response protocol op.static byte
PROTOCOL_OP_TYPE_DELETE_REQUEST
The BER type to use for the delete request protocol op.static byte
PROTOCOL_OP_TYPE_DELETE_RESPONSE
The BER type to use for the delete response protocol op.static byte
PROTOCOL_OP_TYPE_EXTENDED_REQUEST
The BER type to use for the extended request protocol op.static byte
PROTOCOL_OP_TYPE_EXTENDED_RESPONSE
The BER type to use for the extended response protocol op.static byte
PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE
The BER type to use for the intermediate response protocol op.static byte
PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST
The BER type to use for the modify DN request protocol op.static byte
PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE
The BER type to use for the modify DN response protocol op.static byte
PROTOCOL_OP_TYPE_MODIFY_REQUEST
The BER type to use for the modify request protocol op.static byte
PROTOCOL_OP_TYPE_MODIFY_RESPONSE
The BER type to use for the modify response protocol op.static byte
PROTOCOL_OP_TYPE_SEARCH_REQUEST
The BER type to use for the search request protocol op.static byte
PROTOCOL_OP_TYPE_SEARCH_RESULT_DONE
The BER type to use for the search result done protocol op.static byte
PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY
The BER type to use for the search result entry protocol op.static byte
PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE
The BER type to use for the search result reference protocol op.static byte
PROTOCOL_OP_TYPE_UNBIND_REQUEST
The BER type to use for the unbind request protocol op.
-
Constructor Summary
Constructors Constructor Description LDAPMessage(int messageID, ProtocolOp protocolOp, Control... controls)
Creates a new LDAP message with the provided information.LDAPMessage(int messageID, ProtocolOp protocolOp, java.util.List<Control> controls)
Creates a new LDAP message with the provided information.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LDAPMessage
decode(ASN1Element element)
Decodes the provided ASN.1 element as an LDAP message.ASN1Element
encode()
Encodes this LDAP message to an ASN.1 element.AbandonRequestProtocolOp
getAbandonRequestProtocolOp()
Retrieves the abandon request protocol op from this LDAP message.AddRequestProtocolOp
getAddRequestProtocolOp()
Retrieves the add request protocol op from this LDAP message.AddResponseProtocolOp
getAddResponseProtocolOp()
Retrieves the add response protocol op from this LDAP message.BindRequestProtocolOp
getBindRequestProtocolOp()
Retrieves the bind request protocol op from this LDAP message.BindResponseProtocolOp
getBindResponseProtocolOp()
Retrieves the bind response protocol op from this LDAP message.CompareRequestProtocolOp
getCompareRequestProtocolOp()
Retrieves the compare request protocol op from this LDAP message.CompareResponseProtocolOp
getCompareResponseProtocolOp()
Retrieves the compare response protocol op from this LDAP message.java.util.List<Control>
getControls()
Retrieves the set of controls for this LDAP message.DeleteRequestProtocolOp
getDeleteRequestProtocolOp()
Retrieves the delete request protocol op from this LDAP message.DeleteResponseProtocolOp
getDeleteResponseProtocolOp()
Retrieves the delete response protocol op from this LDAP message.ExtendedRequestProtocolOp
getExtendedRequestProtocolOp()
Retrieves the extended request protocol op from this LDAP message.ExtendedResponseProtocolOp
getExtendedResponseProtocolOp()
Retrieves the extended response protocol op from this LDAP message.IntermediateResponseProtocolOp
getIntermediateResponseProtocolOp()
Retrieves the intermediate response protocol op from this LDAP message.int
getMessageID()
Retrieves the message ID for this LDAP message.ModifyDNRequestProtocolOp
getModifyDNRequestProtocolOp()
Retrieves the modify DN request protocol op from this LDAP message.ModifyDNResponseProtocolOp
getModifyDNResponseProtocolOp()
Retrieves the modify DN response protocol op from this LDAP message.ModifyRequestProtocolOp
getModifyRequestProtocolOp()
Retrieves the modify request protocol op from this LDAP message.ModifyResponseProtocolOp
getModifyResponseProtocolOp()
Retrieves the modify response protocol op from this LDAP message.ProtocolOp
getProtocolOp()
Retrieves the protocol op for this LDAP message.byte
getProtocolOpType()
Retrieves the BER type for the protocol op contained in this LDAP message.SearchRequestProtocolOp
getSearchRequestProtocolOp()
Retrieves the search request protocol op from this LDAP message.SearchResultDoneProtocolOp
getSearchResultDoneProtocolOp()
Retrieves the search result done protocol op from this LDAP message.SearchResultEntryProtocolOp
getSearchResultEntryProtocolOp()
Retrieves the search result entry protocol op from this LDAP message.SearchResultReferenceProtocolOp
getSearchResultReferenceProtocolOp()
Retrieves the search result reference protocol op from this LDAP message.UnbindRequestProtocolOp
getUnbindRequestProtocolOp()
Retrieves the unbind request protocol op from this LDAP message.static LDAPMessage
readFrom(ASN1StreamReader reader, boolean ignoreSocketTimeout)
Reads an LDAP message from the provided ASN.1 stream reader.static LDAPResponse
readLDAPResponseFrom(ASN1StreamReader reader, boolean ignoreSocketTimeout)
ReadsLDAPResponse
object from the provided ASN.1 stream reader.static LDAPResponse
readLDAPResponseFrom(ASN1StreamReader reader, boolean ignoreSocketTimeout, Schema schema)
ReadsLDAPResponse
object from the provided ASN.1 stream reader.java.lang.String
toString()
Retrieves a string representation of this LDAP message.void
toString(java.lang.StringBuilder buffer)
Appends a string representation of this LDAP message to the provided buffer.void
writeTo(ASN1Buffer buffer)
Writes an encoded representation of this LDAP message to the provided ASN.1 buffer.
-
-
-
Field Detail
-
PROTOCOL_OP_TYPE_BIND_REQUEST
public static final byte PROTOCOL_OP_TYPE_BIND_REQUEST
The BER type to use for the bind request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_BIND_RESPONSE
public static final byte PROTOCOL_OP_TYPE_BIND_RESPONSE
The BER type to use for the bind response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_UNBIND_REQUEST
public static final byte PROTOCOL_OP_TYPE_UNBIND_REQUEST
The BER type to use for the unbind request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_SEARCH_REQUEST
public static final byte PROTOCOL_OP_TYPE_SEARCH_REQUEST
The BER type to use for the search request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_ENTRY
The BER type to use for the search result entry protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_REFERENCE
The BER type to use for the search result reference protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_SEARCH_RESULT_DONE
public static final byte PROTOCOL_OP_TYPE_SEARCH_RESULT_DONE
The BER type to use for the search result done protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_MODIFY_REQUEST
public static final byte PROTOCOL_OP_TYPE_MODIFY_REQUEST
The BER type to use for the modify request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_MODIFY_RESPONSE
public static final byte PROTOCOL_OP_TYPE_MODIFY_RESPONSE
The BER type to use for the modify response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_ADD_REQUEST
public static final byte PROTOCOL_OP_TYPE_ADD_REQUEST
The BER type to use for the add request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_ADD_RESPONSE
public static final byte PROTOCOL_OP_TYPE_ADD_RESPONSE
The BER type to use for the add response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_DELETE_REQUEST
public static final byte PROTOCOL_OP_TYPE_DELETE_REQUEST
The BER type to use for the delete request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_DELETE_RESPONSE
public static final byte PROTOCOL_OP_TYPE_DELETE_RESPONSE
The BER type to use for the delete response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST
public static final byte PROTOCOL_OP_TYPE_MODIFY_DN_REQUEST
The BER type to use for the modify DN request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE
public static final byte PROTOCOL_OP_TYPE_MODIFY_DN_RESPONSE
The BER type to use for the modify DN response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_COMPARE_REQUEST
public static final byte PROTOCOL_OP_TYPE_COMPARE_REQUEST
The BER type to use for the compare request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_COMPARE_RESPONSE
public static final byte PROTOCOL_OP_TYPE_COMPARE_RESPONSE
The BER type to use for the compare response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_ABANDON_REQUEST
public static final byte PROTOCOL_OP_TYPE_ABANDON_REQUEST
The BER type to use for the abandon request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_EXTENDED_REQUEST
public static final byte PROTOCOL_OP_TYPE_EXTENDED_REQUEST
The BER type to use for the extended request protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_EXTENDED_RESPONSE
public static final byte PROTOCOL_OP_TYPE_EXTENDED_RESPONSE
The BER type to use for the extended response protocol op.- See Also:
- Constant Field Values
-
PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE
public static final byte PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE
The BER type to use for the intermediate response protocol op.- See Also:
- Constant Field Values
-
MESSAGE_TYPE_CONTROLS
public static final byte MESSAGE_TYPE_CONTROLS
The BER type to use for the set of controls.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LDAPMessage
public LDAPMessage(int messageID, @NotNull ProtocolOp protocolOp, @Nullable 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 benull
.controls
- The set of controls for this LDAP message. It may benull
or empty if no controls are required.
-
LDAPMessage
public LDAPMessage(int messageID, @NotNull ProtocolOp protocolOp, @Nullable 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 benull
.controls
- The set of controls for this LDAP message. It may benull
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
@NotNull 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.
-
getAbandonRequestProtocolOp
@NotNull public AbandonRequestProtocolOp getAbandonRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the abandon request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The abandon request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an abandon request protocol op.
-
getAddRequestProtocolOp
@NotNull public AddRequestProtocolOp getAddRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the add request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The add request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an add request protocol op.
-
getAddResponseProtocolOp
@NotNull public AddResponseProtocolOp getAddResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the add response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The add response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an add response protocol op.
-
getBindRequestProtocolOp
@NotNull public BindRequestProtocolOp getBindRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the bind request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The bind request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a bind request protocol op.
-
getBindResponseProtocolOp
@NotNull public BindResponseProtocolOp getBindResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the bind response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The bind response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a bind response protocol op.
-
getCompareRequestProtocolOp
@NotNull public CompareRequestProtocolOp getCompareRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the compare request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The compare request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a compare request protocol op.
-
getCompareResponseProtocolOp
@NotNull public CompareResponseProtocolOp getCompareResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the compare response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The compare response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a compare response protocol op.
-
getDeleteRequestProtocolOp
@NotNull public DeleteRequestProtocolOp getDeleteRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the delete request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The delete request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a delete request protocol op.
-
getDeleteResponseProtocolOp
@NotNull public DeleteResponseProtocolOp getDeleteResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the delete response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The delete response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a delete response protocol op.
-
getExtendedRequestProtocolOp
@NotNull public ExtendedRequestProtocolOp getExtendedRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the extended request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The extended request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an extended request protocol op.
-
getExtendedResponseProtocolOp
@NotNull public ExtendedResponseProtocolOp getExtendedResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the extended response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The extended response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an extended response protocol op.
-
getModifyRequestProtocolOp
@NotNull public ModifyRequestProtocolOp getModifyRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the modify request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The modify request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a modify request protocol op.
-
getModifyResponseProtocolOp
@NotNull public ModifyResponseProtocolOp getModifyResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the modify response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The modify response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a modify response protocol op.
-
getModifyDNRequestProtocolOp
@NotNull public ModifyDNRequestProtocolOp getModifyDNRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the modify DN request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The modify DN request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a modify DN request protocol op.
-
getModifyDNResponseProtocolOp
@NotNull public ModifyDNResponseProtocolOp getModifyDNResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the modify DN response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The modify DN response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a modify DN response protocol op.
-
getSearchRequestProtocolOp
@NotNull public SearchRequestProtocolOp getSearchRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the search request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The search request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a search request protocol op.
-
getSearchResultEntryProtocolOp
@NotNull public SearchResultEntryProtocolOp getSearchResultEntryProtocolOp() throws java.lang.ClassCastException
Retrieves the search result entry protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The search result entry protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a search result entry protocol op.
-
getSearchResultReferenceProtocolOp
@NotNull public SearchResultReferenceProtocolOp getSearchResultReferenceProtocolOp() throws java.lang.ClassCastException
Retrieves the search result reference protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The search result reference protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a search result reference protocol op.
-
getSearchResultDoneProtocolOp
@NotNull public SearchResultDoneProtocolOp getSearchResultDoneProtocolOp() throws java.lang.ClassCastException
Retrieves the search result done protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The search result done protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not a search result done protocol op.
-
getUnbindRequestProtocolOp
@NotNull public UnbindRequestProtocolOp getUnbindRequestProtocolOp() throws java.lang.ClassCastException
Retrieves the unbind request protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The unbind request protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an unbind request protocol op.
-
getIntermediateResponseProtocolOp
@NotNull public IntermediateResponseProtocolOp getIntermediateResponseProtocolOp() throws java.lang.ClassCastException
Retrieves the intermediate response protocol op from this LDAP message. This may only be used if this LDAP message was obtained using thereadFrom(com.unboundid.asn1.ASN1StreamReader, boolean)
method.- Returns:
- The intermediate response protocol op from this LDAP message.
- Throws:
java.lang.ClassCastException
- If the protocol op for this LDAP message is not an intermediate response protocol op.
-
getControls
@NotNull public java.util.List<Control> getControls()
Retrieves the set of controls for this LDAP message.- Returns:
- The set of controls for this LDAP message.
-
encode
@NotNull 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
@NotNull public static LDAPMessage decode(@NotNull 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(@NotNull 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
@Nullable public static LDAPMessage readFrom(@NotNull 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 betrue
when the associated connection is operating in asynchronous mode, andfalse
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
@Nullable public static LDAPResponse readLDAPResponseFrom(@NotNull ASN1StreamReader reader, boolean ignoreSocketTimeout) throws LDAPException
ReadsLDAPResponse
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 betrue
when the associated connection is operating in asynchronous mode, andfalse
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
@Nullable public static LDAPResponse readLDAPResponseFrom(@NotNull ASN1StreamReader reader, boolean ignoreSocketTimeout, @Nullable Schema schema) throws LDAPException
ReadsLDAPResponse
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 betrue
when the associated connection is operating in asynchronous mode, andfalse
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
@NotNull public java.lang.String toString()
Retrieves a string representation of this LDAP message.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string representation of this LDAP message.
-
-