jsdsi.sexp
Class SexpList

java.lang.Object
  extended byjsdsi.sexp.Sexp
      extended byjsdsi.sexp.SexpList
All Implemented Interfaces:
java.io.Serializable

public class SexpList
extends Sexp

A parenthesized list of S-expressions, where the first element is always a SexpString and is called the list's "type".

Version:
$Revision: 1.2.2.1 $ $Date: 2005/11/08 03:12:52 $
Author:
Sameer Ajmani
See Also:
Sexp, SexpString, Serialized Form

Field Summary
 
Fields inherited from class jsdsi.sexp.Sexp
base64Digit, hexDigit
 
Constructor Summary
SexpList(SexpString type, Sexp[] expressions)
          Creates a new list from a type string and an array of S-expressions.
 
Method Summary
 java.lang.String getType()
          Returns the type of this list.
 boolean isEmpty()
          Returns true if this list is empty (i.e., only has a type), false otherwise.
 java.util.Iterator iterator()
          Returns an iterator over this list, including its type.
 int size()
          Returns the size of this list, including its type.
 void writeCanonical(java.io.OutputStream out)
          Writes this S-expression to a byte stream in canonical form.
 void writeReadable(java.io.Writer out, int offset, int width, int last)
          Writes this S-expression to a character stream in readable form.
 
Methods inherited from class jsdsi.sexp.Sexp
decodeString, encodeString, getEncoding, getReadableLen, isBase64Digit, isDecimalDigit, isHexDigit, isTokenChar, isWhiteSpace, writeTransport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SexpList

public SexpList(SexpString type,
                Sexp[] expressions)
Creates a new list from a type string and an array of S-expressions.

Parameters:
type - the list type string.
expressions - the elements of the list.
Method Detail

getType

public java.lang.String getType()
Returns the type of this list.

Returns:
the type of this list.

size

public int size()
Returns the size of this list, including its type.

Returns:
the size of this list, including its type.

iterator

public java.util.Iterator iterator()
Returns an iterator over this list, including its type. Each element is an Sexp.

Returns:
an iterator over this list, including its type.

isEmpty

public boolean isEmpty()
Returns true if this list is empty (i.e., only has a type), false otherwise.

Returns:
true if this list is empty (i.e., only has a type), false otherwise.

writeCanonical

public void writeCanonical(java.io.OutputStream out)
                    throws java.io.IOException
Description copied from class: Sexp
Writes this S-expression to a byte stream in canonical form.

Specified by:
writeCanonical in class Sexp
Throws:
java.io.IOException

writeReadable

public void writeReadable(java.io.Writer out,
                          int offset,
                          int width,
                          int last)
                   throws java.io.IOException
Description copied from class: Sexp
Writes this S-expression to a character stream in readable form.

Specified by:
writeReadable in class Sexp
Parameters:
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


Copyright © 2002-2006 JSDSI. All Rights Reserved.