public class TextOutput extends OutputBase
Takes a ResultSet object and creates displayable formatted output in plain text.
Note: this is compute intensive and memory intensive. It needs to read all the results first (all the results are then in-memory) in order to find things the maximum width of a column value; then it needs to pass over the results again, turning them into output.
| Constructor and Description |
|---|
TextOutput(PrefixMapping pMap) |
TextOutput(Prologue prologue) |
TextOutput(SerializationContext cxt) |
| Modifier and Type | Method and Description |
|---|---|
void |
format(OutputStream out,
boolean answer)
Format a boolean result - output on the given stream
|
void |
format(OutputStream outs,
ResultSet resultSet)
Format a result set - output on the given stream
|
void |
format(Writer w,
ResultSet resultSet)
Writer should be UTF-8 encoded - better to an OutputStream
|
void |
write(OutputStream outs,
ResultSet resultSet)
Output a result set.
|
void |
write(OutputStream outs,
ResultSet resultSet,
String colStart,
String colSep,
String colEnd)
Output a result set.
|
void |
write(PrintWriter pw,
ResultSet resultSet)
Textual representation : default layout using " | " to separate columns.
|
void |
write(PrintWriter pw,
ResultSet resultSet,
String colStart,
String colSep,
String colEnd)
Textual representation : layout using given separator.
|
asString, asStringpublic TextOutput(Prologue prologue)
public TextOutput(PrefixMapping pMap)
public TextOutput(SerializationContext cxt)
public void format(OutputStream outs, ResultSet resultSet)
OutputFormatterpublic void format(Writer w, ResultSet resultSet)
public void write(PrintWriter pw, ResultSet resultSet)
pw - A PrintWriterresultSet - ResultSetpublic void write(OutputStream outs, ResultSet resultSet)
outs - OutputStreamresultSet - ResultSetpublic void write(OutputStream outs, ResultSet resultSet, String colStart, String colSep, String colEnd)
outs - OutputStreamresultSet - ResultSetcolStart - Left columncolSep - Inter-columncolEnd - Right columnpublic void write(PrintWriter pw, ResultSet resultSet, String colStart, String colSep, String colEnd)
pw - PrintWritercolSep - Column separatorpublic void format(OutputStream out, boolean answer)
OutputFormatterLicenced under the Apache License, Version 2.0