public class TextWriterStream extends Object
Modifier and Type | Field and Description |
---|---|
private StringBuilder |
comment
Buffer for comment data to output.
|
static String |
COMMENTSEP
Comment separator line.
|
private TextWriterObjectComment |
fallbackwriter
Fallback writer, using toString.
|
private boolean |
forceincomments
Force incomments flag
|
private StringBuilder |
inline
Buffer for inline data to output.
|
private static String |
NEWLINE
System newline character(s)
|
private PrintStream |
outStream
Actual stream to write to.
|
static String |
QUOTE
String to separate different entries while printing.
|
static String |
SEPARATOR
String to separate different entries while printing.
|
static String |
SER_MARKER
Marker used in text serialization (and re-parsing)
|
private HandlerList<TextWriterWriterInterface<?>> |
writers
Handlers for various object types.
|
Constructor and Description |
---|
TextWriterStream(PrintStream out,
HandlerList<TextWriterWriterInterface<?>> writers)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
commentPrint(Object line)
Print an object into the comments section
|
void |
commentPrintLn()
Print a newline into the comments section.
|
void |
commentPrintLn(Object line)
Print an object into the comments section with trailing newline.
|
void |
commentPrintSeparator()
Print a separator line in the comments section.
|
void |
flush()
Flush output: write inline data, then write comment section.
|
TextWriterWriterInterface<?> |
getWriterFor(Object o)
Retrieve an appropriate writer from the handler list.
|
void |
inlinePrint(Object o)
Print data into the inline part of the file.
|
void |
inlinePrintNoQuotes(Object o)
Print data into the inline part of the file WITHOUT checking for separators
(and thus quoting).
|
protected boolean |
isForceincomments()
Test force-in-comments flag.
|
<O> O |
normalizationRestore(O v)
Restore a vector undoing any normalization that was applied.
|
private void |
quotePrintln(PrintStream outStream,
String data)
Quoted println.
|
protected void |
setForceincomments(boolean forceincomments)
Set the force-in-comments flag.
|
private PrintStream outStream
private StringBuilder inline
private StringBuilder comment
private HandlerList<TextWriterWriterInterface<?>> writers
public static final String SEPARATOR
public static final String QUOTE
public static final String COMMENTSEP
QUOTE
infront, it should be quoted string itself.private static final String NEWLINE
public static final String SER_MARKER
private boolean forceincomments
private TextWriterObjectComment fallbackwriter
public TextWriterStream(PrintStream out, HandlerList<TextWriterWriterInterface<?>> writers)
out
- Actual stream to write towriters
- Handlers for various data typespublic void commentPrint(Object line)
line
- object to print into commmentspublic void commentPrintLn(Object line)
line
- object to print into commentspublic void commentPrintLn()
public void commentPrintSeparator()
public void inlinePrint(Object o)
o
- object to printpublic void inlinePrintNoQuotes(Object o)
o
- object to print.public void flush()
private void quotePrintln(PrintStream outStream, String data)
QUOTE
outStream
- output stream to write todata
- data to printpublic TextWriterWriterInterface<?> getWriterFor(Object o)
o
- query objectpublic <O> O normalizationRestore(O v)
O
- Object classv
- vector to restoreprotected boolean isForceincomments()
protected void setForceincomments(boolean forceincomments)
forceincomments
- the new flag value