com.objsys.asn1j.runtime
Class Asn1CharOutputStream

java.lang.Object
  extended by java.io.Writer
      extended by com.objsys.asn1j.runtime.Asn1CharOutputStream
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
Asn1JsonOutputStream

public class Asn1CharOutputStream
extends java.io.Writer

Base class for character-based output. This class also aides in managing indentation. By default, the indent() method will output whitespace, but this can be disabled using setWriteWhitespace. This class is preferable to Asn1OutputStream when character data is being written.


Field Summary
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
Asn1CharOutputStream(java.io.Writer writer)
          Create character output stream on the given Writer.
 
Method Summary
 void close()
           
 void decrLevel()
          This method decrements the indentation level.
 void flush()
           
 void incrLevel()
          This method increments the indentation level.
 void indent()
          This methods indents by adding a new-line followed by whitespace corresponding to the current nesting level to the output stream.
 void setWriteWhitespace(boolean value)
          Turn whitespace writing by the indent() method on/off.
 void write(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Writer
append, append, append, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Asn1CharOutputStream

public Asn1CharOutputStream(java.io.Writer writer)
Create character output stream on the given Writer. This constructor allows you to send output to any Writer at all.

Method Detail

decrLevel

public void decrLevel()
This method decrements the indentation level.


incrLevel

public void incrLevel()
This method increments the indentation level.


indent

public void indent()
            throws java.io.IOException,
                   Asn1Exception
This methods indents by adding a new-line followed by whitespace corresponding to the current nesting level to the output stream.

Throws:
java.io.IOException - Any exception thrown by the underlying OutputStream.
Asn1Exception - Thrown, if operation is failed.

setWriteWhitespace

public void setWriteWhitespace(boolean value)
Turn whitespace writing by the indent() method on/off.

Parameters:
value -

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Writer
Throws:
java.io.IOException

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Specified by:
flush in class java.io.Writer
Throws:
java.io.IOException

write

public void write(char[] cbuf,
                  int off,
                  int len)
           throws java.io.IOException
Specified by:
write in class java.io.Writer
Throws:
java.io.IOException