Class LDAPReader

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class LDAPReader
    extends Object
    implements Closeable
    This class defines a utility that can be used to read LDAP messages from a provided socket.
    • Constructor Detail

      • LDAPReader

        public LDAPReader​(Socket socket)
                   throws IOException
        Creates a new LDAP reader that will read messages from the provided socket and trace the messages using a provided tracer.
        Parameters:
        socket - The socket from which to read the LDAP messages.
        Throws:
        IOException - If a problem occurs while attempting to obtain an input stream for the socket.
    • Method Detail

      • readMessage

        public LDAPMessage readMessage()
                                throws IOException,
                                       DecodeException,
                                       LDAPException
        Reads an LDAP message from the associated input stream.
        Returns:
        The LDAP message read from the associated input stream, or null if the end of the stream has been reached.
        Throws:
        IOException - If a problem occurs while attempting to read from the input stream.
        DecodeException - If a problem occurs while attempting to decode the data read as an ASN.1 sequence.
        LDAPException - If a problem occurs while attempting to decode the LDAP message.
      • close

        public void close()
        Closes this LDAP reader and the underlying socket.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Closeable