gnu.lists
Class PrintConsumer

java.lang.Object
  extended by java.io.Writer
      extended by java.io.PrintWriter
          extended by gnu.lists.PrintConsumer
All Implemented Interfaces:
Consumer, java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
OutPort, XMLPrinter

public class PrintConsumer
extends java.io.PrintWriter
implements java.lang.Appendable, Consumer

A Consumer that extends a PrintWriter. Useful for formatting.


Field Summary
 
Fields inherited from class java.io.PrintWriter
out
 
Fields inherited from class java.io.Writer
lock
 
Constructor Summary
PrintConsumer(Consumer out, boolean autoFlush)
           
PrintConsumer(java.io.OutputStream out, boolean autoFlush)
           
PrintConsumer(java.io.Writer out)
           
PrintConsumer(java.io.Writer out, boolean autoFlush)
           
 
Method Summary
 PrintConsumer append(char c)
           
 PrintConsumer append(java.lang.CharSequence csq)
           
 PrintConsumer append(java.lang.CharSequence csq, int start, int end)
           
 void beginAttribute(java.lang.String attrName, java.lang.Object attrType)
          Write a attribute for the current group.
 void beginDocument()
           
 void beginGroup(java.lang.String typeName, java.lang.Object type)
           
 void endAttribute()
           
 void endDocument()
           
 void endGroup(java.lang.String typeName)
           
 boolean ignoring()
          True if consumer is ignoring rest of group.
protected  void startNumber()
           
 void writeBoolean(boolean v)
           
 void writeChar(int v)
           
 void writeChars(java.lang.String str)
           
 void writeDouble(double v)
           
 void writeFloat(float v)
           
 void writeInt(int v)
           
 void writeLong(long v)
           
 void writeObject(java.lang.Object v)
           
 
Methods inherited from class java.io.PrintWriter
checkError, close, flush, format, format, print, print, print, print, print, print, print, print, print, printf, printf, println, println, println, println, println, println, println, println, println, println, setError, write, write, write, write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gnu.lists.Consumer
write
 

Constructor Detail

PrintConsumer

public PrintConsumer(Consumer out,
                     boolean autoFlush)

PrintConsumer

public PrintConsumer(java.io.OutputStream out,
                     boolean autoFlush)

PrintConsumer

public PrintConsumer(java.io.Writer out,
                     boolean autoFlush)

PrintConsumer

public PrintConsumer(java.io.Writer out)
Method Detail

startNumber

protected void startNumber()

append

public PrintConsumer append(char c)
Specified by:
append in interface Consumer
Specified by:
append in interface java.lang.Appendable
Overrides:
append in class java.io.PrintWriter

append

public PrintConsumer append(java.lang.CharSequence csq)
Specified by:
append in interface Consumer
Specified by:
append in interface java.lang.Appendable
Overrides:
append in class java.io.PrintWriter

append

public PrintConsumer append(java.lang.CharSequence csq,
                            int start,
                            int end)
Specified by:
append in interface Consumer
Specified by:
append in interface java.lang.Appendable
Overrides:
append in class java.io.PrintWriter

writeChar

public void writeChar(int v)
Specified by:
writeChar in interface Consumer

writeBoolean

public void writeBoolean(boolean v)
Specified by:
writeBoolean in interface Consumer

writeFloat

public void writeFloat(float v)
Specified by:
writeFloat in interface Consumer

writeDouble

public void writeDouble(double v)
Specified by:
writeDouble in interface Consumer

writeInt

public void writeInt(int v)
Specified by:
writeInt in interface Consumer

writeLong

public void writeLong(long v)
Specified by:
writeLong in interface Consumer

beginDocument

public void beginDocument()
Specified by:
beginDocument in interface Consumer

endDocument

public void endDocument()
Specified by:
endDocument in interface Consumer

beginGroup

public void beginGroup(java.lang.String typeName,
                       java.lang.Object type)
Specified by:
beginGroup in interface Consumer

endGroup

public void endGroup(java.lang.String typeName)
Specified by:
endGroup in interface Consumer

beginAttribute

public void beginAttribute(java.lang.String attrName,
                           java.lang.Object attrType)
Description copied from interface: Consumer
Write a attribute for the current group. This is only allowed immediately after a beginGroup.

Specified by:
beginAttribute in interface Consumer

endAttribute

public void endAttribute()
Specified by:
endAttribute in interface Consumer

writeObject

public void writeObject(java.lang.Object v)
Specified by:
writeObject in interface Consumer

ignoring

public boolean ignoring()
Description copied from interface: Consumer
True if consumer is ignoring rest of group. The producer can use this information to skip ahead.

Specified by:
ignoring in interface Consumer

writeChars

public void writeChars(java.lang.String str)
Specified by:
writeChars in interface Consumer