jsdsi.sexp
Class SexpString

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

public class SexpString
extends Sexp

A byte string with an optional display hint.

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

Field Summary
 
Fields inherited from class jsdsi.sexp.Sexp
base64Digit, hexDigit
 
Constructor Summary
SexpString(byte[] c)
          Creates a new SexpString with no display-hint.
SexpString(byte[] d, byte[] c)
          Creates a new SexpString with the given display-hint and content.
SexpString(java.lang.String c)
          Creates a new SexpString with no display-hint.
SexpString(java.lang.String d, byte[] c)
          Creates a new SexpString with the given display-hint and content.
SexpString(java.lang.String d, java.lang.String c)
          Creates a new SexpString with the given display-hint and content.
 
Method Summary
 byte[] toByteArray()
          Returns the content of this string as a byte array.
 java.lang.String toString()
          Returns the content of this string as a String.
 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, wait, wait, wait
 

Constructor Detail

SexpString

public SexpString(byte[] d,
                  byte[] c)
Creates a new SexpString with the given display-hint and content.

Parameters:
d - the display hint.
c - the content of the string.

SexpString

public SexpString(java.lang.String c)
Creates a new SexpString with no display-hint.

Parameters:
c - the content of the string.

SexpString

public SexpString(java.lang.String d,
                  java.lang.String c)
Creates a new SexpString with the given display-hint and content.

Parameters:
d - the display hint.
c - the content of the string.

SexpString

public SexpString(byte[] c)
Creates a new SexpString with no display-hint.

Parameters:
c - the content of the string.

SexpString

public SexpString(java.lang.String d,
                  byte[] c)
Creates a new SexpString with the given display-hint and content.

Parameters:
d - the display hint
c - the content of the string.
Method Detail

toString

public java.lang.String toString()
Returns the content of this string as a String.

Returns:
the content of this string as a String.

toByteArray

public byte[] toByteArray()
Returns the content of this string as a byte array.

Returns:
the content of this string as a byte array.

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.