org.opends.server.protocols.asn1
Class ASN1Writer

java.lang.Object
  extended by org.opends.server.protocols.asn1.ASN1Writer

@PublicAPI(stability=UNCOMMITTED,
           mayInstantiate=true,
           mayExtend=false,
           mayInvoke=true)
public final class ASN1Writer
extends java.lang.Object

This class defines a utility that can be used to write ASN.1 elements over a provided socket or output stream.


Constructor Summary
ASN1Writer(java.io.OutputStream outputStream)
          Creates a new ASN.1 writer that will write elements over the provided output stream.
ASN1Writer(java.net.Socket socket)
          Creates a new ASN.1 writer that will write elements over the provided socket.
 
Method Summary
 void close()
          Closes this ASN.1 writer and the underlying output stream/socket.
 int writeElement(ASN1Element element)
          Writes the provided ASN.1 element over the output stream associated with this ASN.1 writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASN1Writer

public ASN1Writer(java.net.Socket socket)
           throws java.io.IOException
Creates a new ASN.1 writer that will write elements over the provided socket.

Parameters:
socket - The socket to use to write ASN.1 elements.
Throws:
java.io.IOException - If a problem occurs while trying to get the output stream for the socket.

ASN1Writer

public ASN1Writer(java.io.OutputStream outputStream)
Creates a new ASN.1 writer that will write elements over the provided output stream.

Parameters:
outputStream - The output stream to use to write ASN.1 elements.
Method Detail

writeElement

public int writeElement(ASN1Element element)
                 throws java.io.IOException
Writes the provided ASN.1 element over the output stream associated with this ASN.1 writer.

Parameters:
element - The element to be written.
Returns:
The number of bytes actually written over the output stream.
Throws:
java.io.IOException - If a problem occurs while trying to write the information over the output stream.

close

public void close()
Closes this ASN.1 writer and the underlying output stream/socket.