org.opends.server.tools
Class LDAPReader

java.lang.Object
  extended by org.opends.server.tools.LDAPReader

public class LDAPReader
extends java.lang.Object

This class defines a utility that can be used to read LDAP messages from a provided socket.


Constructor Summary
LDAPReader(java.net.Socket socket)
          Creates a new LDAP reader that will read messages from the provided socket.
LDAPReader(java.net.Socket socket, VerboseTracer tracer)
          Creates a new LDAP reader that will read messages from the provided socket and trace the messages using a provided tracer.
 
Method Summary
 void close()
          Closes this LDAP reader and the underlying socket.
 ASN1Reader getASN1Reader()
          Get the underlying ASN1 reader.
 LDAPMessage readMessage()
          Reads an LDAP message from the associated input stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LDAPReader

public LDAPReader(java.net.Socket socket)
           throws java.io.IOException
Creates a new LDAP reader that will read messages from the provided socket.

Parameters:
socket - The socket from which to read the LDAP messages.
Throws:
java.io.IOException - If a problem occurs while attempting to obtain an ASN.1 reader for the socket.

LDAPReader

public LDAPReader(java.net.Socket socket,
                  VerboseTracer tracer)
           throws java.io.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.
tracer - Specifies a tracer to be used for tracing messages read.
Throws:
java.io.IOException - If a problem occurs while attempting to obtain an input stream for the socket.
Method Detail

readMessage

public LDAPMessage readMessage()
                        throws java.io.IOException,
                               ASN1Exception,
                               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:
java.io.IOException - If a problem occurs while attempting to read from the input stream.
ASN1Exception - 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.


getASN1Reader

public ASN1Reader getASN1Reader()
Get the underlying ASN1 reader.

Returns:
The underlying ASN1 reader.