Package gnu.lists
Class PrintConsumer
java.lang.Object
java.io.Writer
java.io.PrintWriter
gnu.lists.PrintConsumer
- All Implemented Interfaces:
Consumer,XConsumer,Closeable,Flushable,Appendable,AutoCloseable,Consumer<Object>,DoubleConsumer,IntConsumer,LongConsumer
- Direct Known Subclasses:
HttpPrinter,XMLPrinter
A Consumer that extends a PrintWriter. Useful for formatting.
-
Field Summary
FieldsFields inherited from class java.io.PrintWriter
out -
Constructor Summary
ConstructorsConstructorDescriptionPrintConsumer(Consumer out, boolean autoFlush) PrintConsumer(OutputStream out, boolean autoFlush) PrintConsumer(Writer out) PrintConsumer(Writer out, boolean autoFlush) -
Method Summary
Modifier and TypeMethodDescriptionappend(char c) append(CharSequence csq) append(CharSequence csq, int start, int end) protected voidprotected voidvoidbeginEntity(Object baseUri) protected voidvoidEnd of an attribute or end of an actual parameter.voidvoidvoidvoidEnd section controled by a show/hide buttonvoidendLogicalBlock(String suffix) static voidendLogicalBlock(String suffix, Consumer out) protected voidvoidgnu.kawa.io.PrettyWriterbooleanignoring()True if consumer is ignoring rest of element.booleanvoidsetIndentation(int amount, boolean current) voidstartAttribute(Object attrType) Write a attribute for the current element.voidvoidstartElement(Object type) voidstartHiderSection(boolean show) Start section controled by a show/hide button.voidstartLogicalBlock(String prefix, boolean perLine, String suffix) static voidstartLogicalBlock(String prefix, boolean perLine, String suffix, Consumer out) voidstartLogicalBlock(String prefix, String suffix, int indent) protected voidvoidwrite(CharSequence csq, int start, int length) voidwriteBoolean(boolean v) voidwriteBreak(int kind) voidstatic voidwriteBreakFill(Consumer out) voidWrite a new-line iff the containing section cannot be printed on one line.voidwriteCDATA(char[] chars, int offset, int length) voidwriteComment(char[] chars, int offset, int length) voidwriteDouble(double v) voidwriteFloat(float v) voidwriteInt(int v) voidwriteLong(long v) voidvoidwriteProcessingInstruction(String target, char[] content, int offset, int length) protected voidwriteRaw(char[] chars, int start, int length) protected voidwriteRaw(int v) protected voidprotected voidvoidwriteShowHideButton(boolean show) If supported (i.e.voidwriteSpace(int kind) voidstatic voidwriteSpaceFill(Consumer out) voidvoidvoidMethods inherited from class java.io.PrintWriter
checkError, clearError, 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, writeMethods inherited from class java.io.Writer
nullWriterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gnu.lists.Consumer
accept, accept, accept, accept, write, write, writeMethods inherited from interface java.util.function.DoubleConsumer
andThenMethods inherited from interface java.util.function.IntConsumer
andThenMethods inherited from interface java.util.function.LongConsumer
andThen
-
Field Details
-
skipping
protected boolean skipping -
base
-
-
Constructor Details
-
PrintConsumer
-
PrintConsumer
-
PrintConsumer
-
PrintConsumer
-
-
Method Details
-
getPrettyWriter
public gnu.kawa.io.PrettyWriter getPrettyWriter() -
startNumber
protected void startNumber() -
endNumber
protected void endNumber() -
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceConsumer- Overrides:
appendin classPrintWriter
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceConsumer- Overrides:
appendin classPrintWriter
-
append
- Specified by:
appendin interfaceAppendable- Specified by:
appendin interfaceConsumer- Overrides:
appendin classPrintWriter
-
write
-
freshLine
public void freshLine() -
writeSpace
public void writeSpace(int kind) -
writeBreak
public void writeBreak(int kind) -
writeBreakFill
-
writeBreakFill
public void writeBreakFill() -
writeSpaceFill
-
writeSpaceFill
public void writeSpaceFill() -
writeSpaceLinear
public void writeSpaceLinear() -
writeBreakLinear
public void writeBreakLinear()Write a new-line iff the containing section cannot be printed on one line. Either all linear-style newlines in a logical block becomes spaces (if it all fits in a line), or none of them do. -
setIndentation
public void setIndentation(int amount, boolean current) -
isDomTerm
public boolean isDomTerm() -
writeShowHideButton
public void writeShowHideButton(boolean show) If supported (i.e. on DomTerm), "print" a show/hide button. -
startHiderSection
public void startHiderSection(boolean show) Start section controled by a show/hide button. Must be properly nested within/around logical blocks. Current only supported on DomTerm. -
endHiderSection
public void endHiderSection()End section controled by a show/hide button -
startLogicalBlock
-
startLogicalBlock
-
startLogicalBlock
-
endLogicalBlock
-
endLogicalBlock
-
beforeContent
protected void beforeContent() -
beforeNode
protected void beforeNode() -
writeWordStart
public void writeWordStart() -
writeWordEnd
public void writeWordEnd() -
clearWordEnd
protected void clearWordEnd() -
writeBoolean
public void writeBoolean(boolean v) - Specified by:
writeBooleanin interfaceConsumer
-
writeFloat
public void writeFloat(float v) - Specified by:
writeFloatin interfaceConsumer
-
writeDouble
public void writeDouble(double v) - Specified by:
writeDoublein interfaceConsumer
-
writeInt
public void writeInt(int v) -
writeLong
public void writeLong(long v) -
startDocument
public void startDocument()- Specified by:
startDocumentin interfaceConsumer
-
endDocument
public void endDocument()- Specified by:
endDocumentin interfaceConsumer
-
startElement
- Specified by:
startElementin interfaceConsumer
-
endElement
public void endElement()- Specified by:
endElementin interfaceConsumer
-
startAttribute
Description copied from interface:ConsumerWrite a attribute for the current element. This is only allowed immediately after a startElement.- Specified by:
startAttributein interfaceConsumer
-
endAttribute
public void endAttribute()Description copied from interface:ConsumerEnd of an attribute or end of an actual parameter. The former use matches a startAttribute; the latter may not, and can be used to separate parameters in a parameter list. This double duty suggsts the method should at least be re-named.- Specified by:
endAttributein interfaceConsumer
-
writeComment
public void writeComment(char[] chars, int offset, int length) - Specified by:
writeCommentin interfaceXConsumer
-
writeProcessingInstruction
- Specified by:
writeProcessingInstructionin interfaceXConsumer
-
writeCDATA
public void writeCDATA(char[] chars, int offset, int length) - Specified by:
writeCDATAin interfaceXConsumer
-
beginEntity
- Specified by:
beginEntityin interfaceXConsumer
-
endEntity
public void endEntity() -
writeRaw
protected void writeRaw(int v) -
writeRaw
-
writeRaw
-
writeRaw
protected void writeRaw(char[] chars, int start, int length) -
writeObject
- Specified by:
writeObjectin interfaceConsumer
-
ignoring
public boolean ignoring()Description copied from interface:ConsumerTrue if consumer is ignoring rest of element. The producer can use this information to skip ahead.
-