jsdsi.sexp
Class SexpOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--java.io.FilterOutputStream
              |
              +--jsdsi.sexp.SexpOutputStream

public class SexpOutputStream
extends java.io.FilterOutputStream

Writes serialized S-expressions to an underlying stream. Supports the canonical, transport, and readable S-expression encodings.

Author:
Sameer Ajmani
See Also:
SexpInputStream

Field Summary
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
SexpOutputStream(java.io.OutputStream os)
          Creates a new SexpOutputStream that writes to the given stream.
 
Method Summary
 void writeCanonical(Sexp s)
          Writes an S-expression to the stream in canonical form.
 void writeReadable(Sexp s, int offset, int width, int last)
          Writes an S-expression to the stream in readable form.
 void writeTransport(Sexp s)
          Writes an S-expression to the stream in transport form.
 
Methods inherited from class java.io.FilterOutputStream
close, flush, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SexpOutputStream

public SexpOutputStream(java.io.OutputStream os)
Creates a new SexpOutputStream that writes to the given stream.

Method Detail

writeReadable

public void writeReadable(Sexp s,
                          int offset,
                          int width,
                          int last)
                   throws java.io.IOException
Writes an S-expression to the stream in readable form.

Parameters:
s - the S-expression to write
offset - spaces indented from left
width - total width of window, in characters
last - spaces reserved on right (e.g., for closing parens)
Throws:
java.io.IOException - if there is an IO error

writeTransport

public void writeTransport(Sexp s)
                    throws java.io.IOException
Writes an S-expression to the stream in transport form.

Parameters:
s - the S-expression to write
Throws:
java.io.IOException - if there is an IO error

writeCanonical

public void writeCanonical(Sexp s)
                    throws java.io.IOException
Writes an S-expression to the stream in canonical form.

Parameters:
s - the S-expression to write
Throws:
java.io.IOException - if there is an IO error