com.sun.slamd.asn1
Class ASN1Writer

java.lang.Object
  extended by com.sun.slamd.asn1.ASN1Writer

public class ASN1Writer
extends java.lang.Object

This class provides a mechanism for sending ASN.1 elements over an output stream. It is not a true java.io.Writer, but it should be good enough for most purposes.

Author:
Neil A. Wilson

Constructor Summary
ASN1Writer(java.io.OutputStream outputStream)
          Creates a new ASN.1 writer configured to use the specified output stream.
ASN1Writer(java.net.Socket socket)
          Creates a new ASN.1 writer configured to use the specified socket.
 
Method Summary
 void close()
          Closes this writer so that it may no longer be used to send ASN.1 elements over the specified output stream.
 void flush()
          Causes the output stream to be flushed and any buffered data to be sent immediately rather than waiting for the buffer to fill.
 void writeElement(ASN1Element element)
          Writes the specified ASN.1 element over the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASN1Writer

public ASN1Writer(java.io.OutputStream outputStream)
Creates a new ASN.1 writer configured to use the specified output stream.

Parameters:
outputStream - The output stream over which the ASN.1 elements will be written.

ASN1Writer

public ASN1Writer(java.net.Socket socket)
           throws java.io.IOException
Creates a new ASN.1 writer configured to use the specified socket.

Parameters:
socket - The socket over which the ASN.1 elements will be written.
Throws:
java.io.IOException - If the output stream of the provided socket cannot be obtained.
Method Detail

writeElement

public void writeElement(ASN1Element element)
                  throws java.io.IOException
Writes the specified ASN.1 element over the output stream.

Parameters:
element - The element to be written over the output stream.
Throws:
java.io.IOException - If there is a problem writing the specified element over the output stream.

flush

public void flush()
           throws java.io.IOException
Causes the output stream to be flushed and any buffered data to be sent immediately rather than waiting for the buffer to fill.

Throws:
java.io.IOException - If there is a problem flushing the output stream.

close

public void close()
           throws java.io.IOException
Closes this writer so that it may no longer be used to send ASN.1 elements over the specified output stream.

Throws:
java.io.IOException - If there is a problem encountered while closing the writer.