public class TextTableWriter extends AbstractTextTableWriter implements MultiStarTableWriter
StarTableWriter which outputs text to
a human-readable text file.
Table parameters (per-table metadata) can optionally be output
as well as the table data themselves.| Constructor and Description |
|---|
TextTableWriter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
docIncludesExample()
Indicates whether the serialization of some (short) example table
should be added to the user documentation for this handler.
|
protected java.lang.String |
formatColumnHeads(int[] colwidths,
ColumnInfo[] cinfos)
Returns a string with headings for the table columns.
|
protected java.lang.String |
formatLine(int[] colwidths,
java.lang.String[] data)
Returns a line showing a row of table data.
|
protected java.lang.String |
formatParam(java.lang.String name,
java.lang.String value,
java.lang.Class<?> clazz)
Returns a formatted parameter-value pair.
|
protected java.lang.String |
formatSeparator(int[] colwidths)
Returns a decorative separator line, of the sort you might find
between the column headings and the table data.
|
protected java.lang.String |
formatValue(java.lang.Object val,
ValueInfo vinfo,
int width)
Formats a data value for output.
|
java.lang.String |
getFormatName()
Returns "text";
|
java.lang.String |
getMimeType()
Returns a string suitable for use as the value of a MIME
Content-Type header.
|
java.lang.String |
getXmlDescription()
Returns user-directed documentation in XML format.
|
boolean |
looksLikeFile(java.lang.String location)
Returns true if the location argument is equal to "-",
indicating standard output.
|
void |
writeStarTables(TableSequence tableSeq,
java.io.OutputStream out)
Writes an array of StarTable objects to a given output stream.
|
void |
writeStarTables(TableSequence tableSeq,
java.lang.String location,
StarTableOutput sto)
Writes an array of StarTable objects to a given location.
|
getEncoding, getMaximumParameterLength, getMaxWidth, getMinNameWidth, getSampledRows, getWriteParameters, setEncoding, setMaximumParameterLength, setMaxWidth, setSampledRows, setWriteParameters, writeStarTablegetExtensions, writeStarTableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteStarTable, writeStarTablematchesExtension, readText, toLinkpublic java.lang.String getFormatName()
getFormatName in interface StarTableWritergetFormatName in class AbstractTextTableWriterpublic java.lang.String getMimeType()
StarTableWriterapplication/octet-stream"
(for binary formats) or "text/plain" for ASCII ones)
is recommended.getMimeType in interface StarTableWritergetMimeType in class AbstractTextTableWriterpublic boolean docIncludesExample()
DocumentedIOHandlerDocumented.getXmlDescription()
method already includes some example output, should return false.docIncludesExample in interface DocumentedIOHandlerpublic java.lang.String getXmlDescription()
DocumentedThe output should be a sequence of one or more <P> elements, using XHTML-like XML. Since rendering may be done in a number of contexts however, use of the full range of XHTML elements is discouraged. Where possible, the content should stick to simple markup such as the elements P, A, UL, OL, LI, DL, DT, DD EM, STRONG, I, B, CODE, TT, PRE.
getXmlDescription in interface Documentedpublic boolean looksLikeFile(java.lang.String location)
looksLikeFile in interface StarTableWriterlooksLikeFile in class DocumentedStreamStarTableWriterlocation - the location name (probably filename)true iff it looks like a file this writer would
normally writepublic void writeStarTables(TableSequence tableSeq, java.io.OutputStream out) throws java.io.IOException
MultiStarTableWriterBufferedOutputStream), and should not close it at
the end of the call.writeStarTables in interface MultiStarTableWritertableSeq - sequence of tables to writeout - destination streamjava.io.IOExceptionpublic void writeStarTables(TableSequence tableSeq, java.lang.String location, StarTableOutput sto) throws java.io.IOException
MultiStarTableWriterlocation argument
in any way appropriate for them. Typically however the location
will simply be used to get an output stream (for instance interpreting
it as a filename). In this case the sto argument should
normally be used to turn location into a stream.writeStarTables in interface MultiStarTableWritertableSeq - sequence of tables to writelocation - destination for tablessto - StarTableOutput instancejava.io.IOExceptionprotected java.lang.String formatValue(java.lang.Object val,
ValueInfo vinfo,
int width)
AbstractTextTableWriterformatValue in class AbstractTextTableWriterval - the valuevinfo - the metadata object describing val's typewidth - maximum preferred width into which the value should
be formattedvalue,
preferably no longer than width charactersprotected java.lang.String formatSeparator(int[] colwidths)
AbstractTextTableWriterformatSeparator in class AbstractTextTableWritercolwidths - column widths in charactersprotected java.lang.String formatColumnHeads(int[] colwidths,
ColumnInfo[] cinfos)
AbstractTextTableWriterformatColumnHeads in class AbstractTextTableWritercolwidths - column widths in characterscinfos - array of column headingsprotected java.lang.String formatLine(int[] colwidths,
java.lang.String[] data)
AbstractTextTableWriterformatLine in class AbstractTextTableWritercolwidths - column widths in charactersdata - array of strings to be output, one per columnprotected java.lang.String formatParam(java.lang.String name,
java.lang.String value,
java.lang.Class<?> clazz)
AbstractTextTableWriterformatParam in class AbstractTextTableWritername - parameter namevalue - formatted parameter valueclazz - type of value