uk.ac.starlink.table.formats
Class CsvTableWriter

java.lang.Object
  |
  +--uk.ac.starlink.table.formats.CsvTableWriter
All Implemented Interfaces:
StarTableWriter

public class CsvTableWriter
extends Object
implements StarTableWriter

A StarTableWriter which outputs to Comma-Separated Value format. This format is readable by CsvTableBuilder.

Since:
21 Sep 2004

Constructor Summary
CsvTableWriter()
           
 
Method Summary
 String getFormatName()
          Returns "CSV".
 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 setWriteHeader(boolean writeHeader)
          Indicate whether an initial row containing column names should be written.
 void writeStarTable(StarTable table, String location)
          Writes a StarTable object to a given location.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CsvTableWriter

public CsvTableWriter()
Method Detail

setWriteHeader

public void setWriteHeader(boolean writeHeader)
Indicate whether an initial row containing column names should be written.

Parameters:
writeHeader - true iff you want the first output line to contain column names

getWriteHeader

public boolean getWriteHeader()
Indicates whether an initial row containing column names will be written.

Returns:
whether the first output line will contain column names

getFormatName

public String getFormatName()
Returns "CSV".

Specified by:
getFormatName in interface StarTableWriter

looksLikeFile

public boolean looksLikeFile(String location)
Returns true for locations ending ".csv" or ".CSV".

Specified by:
looksLikeFile in interface StarTableWriter
Parameters:
location - the location name (probably filename)
Returns:
true iff it looks like a file this writer would normally write

writeStarTable

public void writeStarTable(StarTable table,
                           String location)
                    throws IOException
Description copied from interface: StarTableWriter
Writes a StarTable object to a given location. If possible, a location of "-" should be taken as a request to write to standard output.

Specified by:
writeStarTable in interface StarTableWriter
Parameters:
table - the table to write
location - the destination of the written object (probably, but not necessarily, a filename)
IOException

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.