jsdsi.sexp
Class SexpOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended byjsdsi.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.

Version:
$Revision: 1.1.6.1 $ $Date: 2005/11/08 03:12:52 $
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
 SexpOutput toCanonical()
          Returns a new SexpOutput object that writes S-expressions to this stream in canonical form.
 SexpOutput toReadable(int offset, int width, int last)
          Returns a new SexpOutput object that writes S-expressions to this stream in readable form.
 SexpOutput toTransport()
          Returns a new SexpOutput object that writes S-expressions to this stream in transport form.
 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

toReadable

public SexpOutput toReadable(int offset,
                             int width,
                             int last)
Returns a new SexpOutput object that writes S-expressions to this stream in readable form.

Parameters:
offset - spaces indented from left.
width - total width of window, in characters.
last - spaces reserved on right (e.g., for closing parens).

toCanonical

public SexpOutput toCanonical()
Returns a new SexpOutput object that writes S-expressions to this stream in canonical form.


toTransport

public SexpOutput toTransport()
Returns a new SexpOutput object that writes S-expressions to this stream in transport form.



Copyright © 2002-2006 JSDSI. All Rights Reserved.