|
|||||||||
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.CsvTableWriter
public class CsvTableWriter
A StarTableWriter which outputs to Comma-Separated Value format.
This format is readable by CsvTableBuilder
.
Constructor Summary | |
---|---|
CsvTableWriter()
Constructs a default CSV table writer. |
|
CsvTableWriter(boolean writeHeader)
Constructs a CSV table writer which optionally writes headers. |
Method Summary | |
---|---|
String |
getFormatName()
Returns "CSV" or "CSV-noheader". |
int |
getMaxFieldChars()
Returns the limit on the number of characters that will be written in a single field. |
String |
getMimeType()
Returns a string suitable for use as the value of a MIME Content-Type header. |
static StarTableWriter[] |
getStarTableWriters()
Returns a selection of useful CsvTableWriters. |
boolean |
getWriteHeader()
Indicates whether an initial row containing column names will be written. |
boolean |
looksLikeFile(String location)
Returns true for locations ending ".csv" or ".CSV". |
void |
setMaxFieldChars(int maxFieldChars)
Sets a limit on the number of characters that will be written in a single field. |
void |
setWriteHeader(boolean writeHeader)
Indicate whether an initial row containing column names should be written. |
void |
writeStarTable(StarTable table,
OutputStream ostrm)
Writes a StarTable object to a given output stream. |
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 |
Constructor Detail |
---|
public CsvTableWriter()
public CsvTableWriter(boolean writeHeader)
writeHeader
- true iff you want the first output line to contain
column namesMethod Detail |
---|
public void setWriteHeader(boolean writeHeader)
writeHeader
- true iff you want the first output line to contain
column namespublic boolean getWriteHeader()
public void setMaxFieldChars(int maxFieldChars)
maxFieldChars
- new limitpublic int getMaxFieldChars()
public String getFormatName()
public String getMimeType()
StarTableWriter
application/octet-stream
"
(for binary formats) or "text/plain
" for ASCII ones)
is recommended.
public boolean looksLikeFile(String location)
location
- the location name (probably filename)
public void writeStarTable(StarTable table, OutputStream ostrm) throws IOException
StarTableWriter
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.
table
- the table to writeostrm
- the output stream to which startab should be
written
TableFormatException
- if this table cannot be written to a
stream
IOException
- if there is some I/O errorpublic static StarTableWriter[] getStarTableWriters()
|
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 |