jsdsi.sexp
Class SexpList

java.lang.Object
  |
  +--jsdsi.sexp.Sexp
        |
        +--jsdsi.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".

Author:
Alexander Morcos, Sameer Ajmani
See Also:
Sexp, SexpString, Serialized Form

Field Summary
 
Fields inherited from class jsdsi.sexp.Sexp
base64Digit, hexDigit
 
Constructor Summary
(package private) SexpList()
           
  SexpList(SexpString type, Sexp[] expressions)
          Creates a new list from a type string and an array of S-expressions.
 
Method Summary
(package private)  int getReadableLenImpl()
          Returns the length of this S-expression as if it were printed on one line.
 java.lang.String getType()
          Returns the type of this list.
 boolean isEmpty()
          Returns true if this list is empty, false otherwise.
 java.util.Iterator iterator()
          Returns an iterator over this list.
 int size()
          Returns the size of this list.
 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, getReadableLen, isBase64Digit, isDecimalDigit, isHexDigit, isTokenChar, isWhiteSpace, writeBase64, writeBase64, writeHex, writeHex, writeTransport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SexpList

SexpList()

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.


size

public int size()
Returns the size of this list.


iterator

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


isEmpty

public boolean isEmpty()
Returns true if this list is empty, 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
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)
java.io.IOException

getReadableLenImpl

int getReadableLenImpl()
Description copied from class: Sexp
Returns the length of this S-expression as if it were printed on one line.

Specified by:
getReadableLenImpl in class Sexp