jsdsi.sexp
Class SexpString

java.lang.Object
  |
  +--jsdsi.sexp.Sexp
        |
        +--jsdsi.sexp.SexpString
All Implemented Interfaces:
java.io.Serializable

public class SexpString
extends Sexp

A byte string with an optional display hint.

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

Field Summary
 
Fields inherited from class jsdsi.sexp.Sexp
base64Digit, hexDigit
 
Constructor Summary
(package private) SexpString()
           
  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
(package private)  int getReadableLenImpl()
          Returns the length of this S-expression as if it were printed on one line.
 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, 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, wait, wait, wait
 

Constructor Detail

SexpString

SexpString()

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.

Overrides:
toString in class java.lang.Object

toByteArray

public byte[] toByteArray()
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
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