Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sexp
Class SexpOutputStream

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--java.io.FilterOutputStream
                  |
                  +--java.io.BufferedOutputStream
                        |
                        +--sexp.SexpOutputStream

public class SexpOutputStream
extends BufferedOutputStream

This class provides S-Expression stream output functionallity, in the same manner as Ron Rivest's reference S-Expression parser.

Version:
  $Id: SexpOutputStream.java,v 1.3 2001/10/15 19:11:09 tep Exp $
Author:
  Per Harald Myrvang <perm@pasta.cs.uit.no>
See Also:
  `SList`

Field Summary
`static String` | `__me`
`static int` | `ADVANCED`
`static int` | `BASE64`
`private long` | `base64Count`
`private static byte[]` | `base64Digits`
`private int` | `bits`
`private int` | `byteSize`
`static int` | `CANONICAL`
`private long` | `column`
`boolean` | `debug`
`static int` | `DEFAULTLINELENGTH`
`private static byte[]` | `hexDigits`
`private long` | `indent`
`private int` | `maxcolumn`
`private int` | `mode`
`private int` | `nBits`
`private OutputStream` | `output`

Fields inherited from class java.io.BufferedOutputStream
`buf, count`

Fields inherited from class java.io.FilterOutputStream
`out`

Constructor Summary
`SexpOutputStream(OutputStream stream)` Creates and initializes a new OutputStream object.

Method Summary
`int` | `advancedLengthList(SList list)`
`int` | `advancedLengthSimpleString(SimpleString ss)`
`int` | `advancedLengthSimpleStringBase64(SimpleString ss)`
`int` | `advancedLengthSimpleStringHexadecimal(SimpleString ss)`
`int` | `advancedLengthSimpleStringQuotedString(SimpleString ss)`
`int` | `advancedLengthSimpleStringToken(SimpleString ss)`
`int` | `advancedLengthSimpleStringVerbatim(SimpleString ss)`
`int` | `advancedLengthString(Sexp s)`
`void` | `advancedPrintBase64SimpleString(SimpleString ss)`
`void` | `advancedPrintHexSimpleString(SimpleString ss)`
`void` | `advancedPrintList(SList list)`
`void` | `advancedPrintObject(SExpression object)`
`void` | `advancedPrintQuotedStringSimpleString(SimpleString ss)`
`void` | `advancedPrintSimpleString(SimpleString ss)`
`void` | `advancedPrintString(Sexp s)`
`void` | `advancedPrintTokenSimpleString(SimpleString ss)`
`void` | `advancedPrintVerbatimSimpleString(SimpleString ss)`
`void` | `base64PrintWholeObject(SExpression object)`
`void` | `canonicalPrintList(SList list)`
`void` | `canonicalPrintObject(SExpression object)`
`void` | `canonicalPrintString(Sexp sexp)`
`void` | `canonicalPrintVerbatimSimpleString(SimpleString ss)`
`boolean` | `canPrintAsQuotedString(SimpleString ss)`
`boolean` | `canPrintAsToken(SimpleString ss)`
`void` | `changeByteSize(int base, int mode)` Change the output byte size.
`void` | `flush()` Flush out any remaining bits.
`void` | `newLine(int mode)` Outputs a newline symbol to this output stream.
`void` | `printDecimal(long l)` Print out a long value, in decimal, to this output stream.
`void` | `printObject(SExpression object, int how)`
`void` | `varWrite(int c)` Writes the specified byte to this output stream, with variable sized output bytes considered.
`void` | `write(int c)` Writes the specified byte to this output stream.

Methods inherited from class java.io.BufferedOutputStream
`flushBuffer, write`

Methods inherited from class java.io.FilterOutputStream
`close, write`

Methods inherited from class java.lang.Object
`, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait`

Field Detail

### __me

    public static final String __me

### hexDigits

    private static byte[] hexDigits

### base64Digits

    private static final byte[] base64Digits

### CANONICAL

    public static final int CANONICAL

### BASE64

    public static final int BASE64

### ADVANCED

    public static final int ADVANCED

### DEFAULTLINELENGTH

    public static final int DEFAULTLINELENGTH

### column

    private long column

### maxcolumn

    private int maxcolumn

### indent

    private long indent

### byteSize

    private int byteSize

### bits

    private int bits

### nBits

    private int nBits

### base64Count

    private long base64Count

### mode

    private int mode

### output

    private OutputStream output

### debug

    public boolean debug

Constructor Detail

### SexpOutputStream

    public SexpOutputStream(OutputStream stream)

  Creates and initializes a new OutputStream object.
  Parameters:
    `stream` - OutputStream that will receive this stream's output.

Method Detail

### write

    public void write(int c)
               throws IOException

  Writes the specified byte to this output stream.
  Overrides:
    write in class BufferedOutputStream
  Parameters:
    `c` - byte to be written (nevermind that it's an int!).
  Throws:
    IOException - if an I/O error occured

### varWrite

    public void varWrite(int c)
                  throws IOException

  Writes the specified byte to this output stream, with variable sized output bytes considered.
  Parameters:
    `c` - byte to be written (nevermind that it's an int!), and is always an eight-bit byte.
  Throws:
    IOException - if an I/O error occured

### changeByteSize

    public void changeByteSize(int base,
                               int mode)
                        throws IOException

  Change the output byte size. Recods the mode in outputstream for automatic line breaks.
  Parameters:
    `base` - 4 (hexadecimal), 6 (Base64), or 8 (binary raw data).
    `mode` - SexpOutputStream.CANONICAL, SexpOutputStream.BASE64 or SexpOutputStream.ADVANCED.
  Throws:
    IOException - if an I/O error occured

### flush

    public void flush()
               throws IOException

  Flush out any remaining bits. This forces any buffered output bytes to be written out to the underlying output stream.
  Overrides:
    flush in class BufferedOutputStream
  Throws:
    IOException - if an I/O error occured

### newLine

    public void newLine(int mode)
                 throws IOException

  Outputs a newline symbol to this output stream. For ADVANCED mode, also outputs indentation as one blank per indentation level (but never indents more than half of maxcolumn). Resets column for next output character.
  Parameters:
    `mode` - SexpOutputStream.CANONICAL, SexpOutputStream.BASE64 or SexpOutputStream.ADVANCED.
  Throws:
    IOException - if an I/O error occured

### printDecimal

    public void printDecimal(long l)
                      throws IOException

  Print out a long value, in decimal, to this output stream.
  Parameters:
    `mode` - value to output in decimal notation.
  Throws:
    IOException - if an I/O error occured

### canonicalPrintVerbatimSimpleString

    public void canonicalPrintVerbatimSimpleString(SimpleString ss)
                                            throws IOException

### canonicalPrintString

    public void canonicalPrintString(Sexp sexp)
                              throws IOException

### canonicalPrintObject

    public void canonicalPrintObject(SExpression object)
                              throws IOException

### canonicalPrintList

    public void canonicalPrintList(SList list)
                            throws IOException

### base64PrintWholeObject

    public void base64PrintWholeObject(SExpression object)
                                throws IOException

### canPrintAsToken

    public boolean canPrintAsToken(SimpleString ss)

### advancedPrintTokenSimpleString

    public void advancedPrintTokenSimpleString(SimpleString ss)
                                        throws IOException

### advancedLengthSimpleStringToken

    public int advancedLengthSimpleStringToken(SimpleString ss)

### advancedPrintVerbatimSimpleString

    public void advancedPrintVerbatimSimpleString(SimpleString ss)
                                           throws IOException

### advancedLengthSimpleStringVerbatim

    public int advancedLengthSimpleStringVerbatim(SimpleString ss)

### advancedPrintBase64SimpleString

    public void advancedPrintBase64SimpleString(SimpleString ss)
                                         throws IOException

### advancedPrintHexSimpleString

    public void advancedPrintHexSimpleString(SimpleString ss)
                                      throws IOException

### advancedLengthSimpleStringHexadecimal

    public int advancedLengthSimpleStringHexadecimal(SimpleString ss)

### canPrintAsQuotedString

    public boolean canPrintAsQuotedString(SimpleString ss)

### advancedPrintQuotedStringSimpleString

    public void advancedPrintQuotedStringSimpleString(SimpleString ss)
                                               throws IOException

### advancedLengthSimpleStringQuotedString

    public int advancedLengthSimpleStringQuotedString(SimpleString ss)

### advancedPrintSimpleString

    public void advancedPrintSimpleString(SimpleString ss)
                                   throws IOException

### advancedPrintString

    public void advancedPrintString(Sexp s)
                             throws IOException

### advancedLengthSimpleStringBase64

    public int advancedLengthSimpleStringBase64(SimpleString ss)

### advancedLengthSimpleString

    public int advancedLengthSimpleString(SimpleString ss)

### advancedLengthString

    public int advancedLengthString(Sexp s)

### advancedLengthList

    public int advancedLengthList(SList list)
                           throws IOException

### advancedPrintList

    public void advancedPrintList(SList list)
                           throws IOException

### advancedPrintObject

    public void advancedPrintObject(SExpression object)
                             throws IOException

### printObject

    public void printObject(SExpression object,
                            int how)
                     throws IOException

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD