StarTableWriter
public class CsvTableWriter extends StreamStarTableWriter
CsvTableBuilder
.Constructor | Description |
---|---|
CsvTableWriter() |
Constructs a default CSV table writer.
|
CsvTableWriter(boolean writeHeader) |
Constructs a CSV table writer which optionally writes headers.
|
Modifier and Type | Method | Description |
---|---|---|
java.lang.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.
|
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 |
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,
java.io.OutputStream ostrm) |
Writes a StarTable object to a given output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
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 void setMaxFieldChars(int maxFieldChars)
maxFieldChars
- new limitpublic int getMaxFieldChars()
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 © 2018 Central Laboratory of the Research Councils. All Rights Reserved.