public class CsvTableWriter extends StreamStarTableWriter
CsvTableBuilder
.Constructor and Description |
---|
CsvTableWriter()
Constructs a default CSV table writer.
|
CsvTableWriter(boolean writeHeader)
Constructs a CSV table writer which optionally writes headers.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getFormatName()
Returns "CSV" or "CSV-noheader".
|
java.lang.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(java.lang.String location)
Returns true for locations ending ".csv" or ".CSV".
|
void |
setWriteHeader(boolean writeHeader)
Indicate whether an initial row containing column names should be
written.
|
void |
writeStarTable(StarTable table,
java.io.OutputStream ostrm)
Writes a StarTable object to a given output stream.
|
writeStarTable
public CsvTableWriter()
public CsvTableWriter(boolean writeHeader)
writeHeader
- true iff you want the first output line to contain
column namespublic void setWriteHeader(boolean writeHeader)
writeHeader
- true iff you want the first output line to contain
column namespublic boolean getWriteHeader()
public java.lang.String getFormatName()
public java.lang.String getMimeType()
StarTableWriter
application/octet-stream
"
(for binary formats) or "text/plain
" for ASCII ones)
is recommended.public boolean looksLikeFile(java.lang.String location)
location
- the location name (probably filename)public void writeStarTable(StarTable table, java.io.OutputStream ostrm) throws java.io.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
writtenTableFormatException
- if this table cannot be written to a
streamjava.io.IOException
- if there is some I/O errorpublic static StarTableWriter[] getStarTableWriters()
Copyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.