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
| Methods inherited from class java.lang.Object |
,
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
registerNatives,
toString,
wait,
wait,
wait |
__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
SexpOutputStream
public SexpOutputStream(OutputStream stream)
- Creates and initializes a new OutputStream object.
- Parameters:
stream - OutputStream that will receive this stream's output.
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