|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.table.StreamStarTableWriter
uk.ac.starlink.table.formats.AbstractTextTableWriter
uk.ac.starlink.table.formats.TextTableWriter
public class TextTableWriter
A 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 Summary | |
---|---|
TextTableWriter()
|
Method Summary | |
---|---|
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"; |
int |
getMaxWidth()
Returns the maximum width for a given column. |
java.lang.String |
getMimeType()
Returns a string suitable for use as the value of a MIME Content-Type header. |
boolean |
looksLikeFile(java.lang.String location)
Returns true if the location argument is equal to "-", indicating standard output. |
protected void |
printColumnHeads(java.io.OutputStream strm,
int[] colwidths,
ColumnInfo[] cinfos)
Outputs headings for the table columns. |
protected void |
printLine(java.io.OutputStream strm,
int[] colwidths,
java.lang.String[] data)
Outputs a line of table data. |
protected void |
printParam(java.io.OutputStream strm,
java.lang.String name,
java.lang.String value,
java.lang.Class clazz)
Outputs a parameter and its value. |
protected void |
printSeparator(java.io.OutputStream strm,
int[] colwidths)
Outputs a decorative separator line, of the sort you might find between the column headings and the table data. |
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. |
Methods inherited from class uk.ac.starlink.table.formats.AbstractTextTableWriter |
---|
getBytes, getMaximumParameterLength, getMinNameWidth, getSampledRows, getWriteParameters, setWriteParameters, writeStarTable |
Methods inherited from class uk.ac.starlink.table.StreamStarTableWriter |
---|
writeStarTable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface uk.ac.starlink.table.StarTableWriter |
---|
writeStarTable, writeStarTable |
Constructor Detail |
---|
public TextTableWriter()
Method Detail |
---|
public java.lang.String getFormatName()
getFormatName
in interface StarTableWriter
getFormatName
in class AbstractTextTableWriter
public java.lang.String getMimeType()
StarTableWriter
application/octet-stream
"
(for binary formats) or "text/plain
" for ASCII ones)
is recommended.
getMimeType
in interface StarTableWriter
getMimeType
in class AbstractTextTableWriter
public boolean looksLikeFile(java.lang.String location)
looksLikeFile
in interface StarTableWriter
location
- the location name (probably filename)
public void writeStarTables(TableSequence tableSeq, java.io.OutputStream out) throws java.io.IOException
MultiStarTableWriter
BufferedOutputStream
), and should not close it at
the end of the call.
writeStarTables
in interface MultiStarTableWriter
tableSeq
- sequence of tables to writeout
- destination stream
java.io.IOException
public void writeStarTables(TableSequence tableSeq, java.lang.String location, StarTableOutput sto) throws java.io.IOException
MultiStarTableWriter
writeStarTables
in interface MultiStarTableWriter
tableSeq
- sequence of tables to writelocation
- destination for tablessto
- StarTableOutput instance
java.io.IOException
public int getMaxWidth()
AbstractTextTableWriter
getMaxWidth
in class AbstractTextTableWriter
protected java.lang.String formatValue(java.lang.Object val, ValueInfo vinfo, int width)
AbstractTextTableWriter
formatValue
in class AbstractTextTableWriter
val
- the valuevinfo
- the metadata object describing val's typewidth
- maximum preferred width into which the value should
be formatted
protected void printSeparator(java.io.OutputStream strm, int[] colwidths) throws java.io.IOException
AbstractTextTableWriter
printSeparator
in class AbstractTextTableWriter
strm
- stream to write intocolwidths
- column widths in characters
java.io.IOException
protected void printColumnHeads(java.io.OutputStream strm, int[] colwidths, ColumnInfo[] cinfos) throws java.io.IOException
AbstractTextTableWriter
printColumnHeads
in class AbstractTextTableWriter
strm
- stream to write intocolwidths
- column widths in characterscinfos
- array of column headings
java.io.IOException
protected void printLine(java.io.OutputStream strm, int[] colwidths, java.lang.String[] data) throws java.io.IOException
AbstractTextTableWriter
printLine
in class AbstractTextTableWriter
strm
- stream to write intocolwidths
- column widths in charactersdata
- array of strings to be output, one per column
java.io.IOException
protected void printParam(java.io.OutputStream strm, java.lang.String name, java.lang.String value, java.lang.Class clazz) throws java.io.IOException
AbstractTextTableWriter
printParam
in class AbstractTextTableWriter
strm
- stream to write intoname
- parameter namevalue
- formatted parameter valueclazz
- type of value
java.io.IOException
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |