public class HTMLTableWriter extends DocumentedStreamStarTableWriter implements MultiStarTableWriter
standalone attribute,
the output may either be a complete HTML document or just a
<TABLE> element suitable for inserting into an existing document.
The output HTML is intended to conform to HTML 3.2 or 4.01,
depending on options.| Constructor and Description |
|---|
HTMLTableWriter()
Constructs a new writer with default characteristics.
|
HTMLTableWriter(boolean standalone,
boolean useRowGroups)
Constructs a new writer indicating whether it will produce complete
or partial HTML documents.
|
| 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.
|
String |
getFormatName()
Gives the name of the format which is written by this writer.
|
int |
getMaxWidth()
Returns the maximum output width in characters for a single cell.
|
String |
getMimeType()
Returns a string suitable for use as the value of a MIME
Content-Type header.
|
String |
getXmlDescription()
Returns user-directed documentation in XML format.
|
boolean |
isStandalone()
Indicates whether output tables will be complete HTML documents.
|
protected boolean |
isUrl(String txt)
Determines whether a string is apparently a URL.
|
protected void |
printFooter(OutputStream ostrm)
For standalone output, this method is invoked to output any text
following the </TABLE> end tag.
|
protected void |
printHeader(OutputStream ostrm,
StarTable table)
For standalone output, this method is invoked to output any text
preceding the <TABLE> start tag.
|
void |
setMaxWidth(int maxWidth)
Sets the maximum output width in characters for a single cell.
|
void |
setStandalone(boolean standalone)
Sets whether output tables should be complete HTML documents.
|
void |
writeStarTable(StarTable table,
OutputStream out)
Writes a
StarTable object to a given output stream. |
void |
writeStarTables(TableSequence tableSeq,
OutputStream out)
Writes an array of StarTable objects to a given output stream.
|
void |
writeStarTables(TableSequence tableSeq,
String location,
StarTableOutput sto)
Writes an array of StarTable objects to a given location.
|
getExtensions, looksLikeFile, writeStarTableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitlooksLikeFile, writeStarTablematchesExtension, readText, toLinkpublic HTMLTableWriter()
public HTMLTableWriter(boolean standalone,
boolean useRowGroups)
@ConfigMethod(property="standalone", doc="If true, the output is a freestanding HTML document complete with HTML, HEAD and BODY tags. If false, the output is just a TABLE element.") public void setStandalone(boolean standalone)
standalone - true if the output document should be a
complete HTML documentpublic boolean isStandalone()
@ConfigMethod(property="maxCell", doc="Maximum width in characters of an output table cell. Cells longer than this will be truncated.") public void setMaxWidth(int maxWidth)
maxWidth - new maximum cell widthpublic int getMaxWidth()
public String getFormatName()
StarTableWritergetFormatName in interface StarTableWriterpublic String getMimeType()
StarTableWriterapplication/octet-stream"
(for binary formats) or "text/plain" for ASCII ones)
is recommended.getMimeType in interface StarTableWriterpublic boolean docIncludesExample()
DocumentedIOHandlerDocumented.getXmlDescription()
method already includes some example output, should return false.docIncludesExample in interface DocumentedIOHandlerpublic 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 void writeStarTable(StarTable table, OutputStream out) throws IOException
StarTableWriterStarTable object to a given output stream.
The implementation can assume that out is suitable for
direct writing (for instance it should not normally wrap it in a
BufferedOutputStream), and should not close it
at the end of the call.
Not all table writers are capable of writing to a stream;
an implementation may throw a TableFormatException to
indicate that it cannot do so.
writeStarTable in interface StarTableWritertable - the table to writeout - the output stream to which startab should be
writtenTableFormatException - if this table cannot be written to a
streamIOException - if there is some I/O errorpublic void writeStarTables(TableSequence tableSeq, OutputStream out) throws IOException
MultiStarTableWriterBufferedOutputStream), and should not close it at
the end of the call.writeStarTables in interface MultiStarTableWritertableSeq - sequence of tables to writeout - destination streamIOExceptionpublic void writeStarTables(TableSequence tableSeq, String location, StarTableOutput sto) throws 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 instanceIOExceptionprotected void printHeader(OutputStream ostrm, StarTable table) throws IOException
ostrm - output streamtable - table for which header is required; may be null
for multi-table outputIOExceptionprotected void printFooter(OutputStream ostrm) throws IOException
ostrm - output streamIOExceptionprotected boolean isUrl(String txt)
txt - string to testCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.