STIL can deal with externally-stored tables in a number of different
formats. It does this using a set of handlers each of which knows
about turning an external data source into one or more java
or serializing one or more
StarTable objects into
an external form.
Such an "external table" will typically be a file on a local disk,
but might also be a URL pointing to a file on a remote host,
or an SQL query on a remote database, or something else.
The core I/O framework of STIL itself does not know about any table formats, but it knows how to talk to format-specific input or output handlers. A number of these (VOTable, FITS, ASCII and others, described in the following subsections) are supplied as part of the STIL package, so for dealing with tables in these formats you don't need to do any extra work. However, the fact that these are treated in a standard way means that it is possible to add new format-specific handlers and the rest of the library will work with tables in that format just the same as with the supplied formats.
If you have a table format which is unsupported by STIL as it stands, you can do one or both of the following:
TableBuilderinterface to take a stream of data and return a
StarTableobject. Optionally, you can also implement the
MultiTableBuildersubinterface if the format can contain multiple tables per file. Install it in a
StarTableFactory, either programmatically using the
getKnownBuildersmethods, or by setting the
startable.readerssystem property. This factory will then be able to pick up tables in this format as well as other known formats. Such a
TableBuildercan also be used directly to read tables by code which knows that it's dealing with data in that particular format.
StarTableWriterinterface to take a
StarTableand write it to a given destination. Optionally, you can also implement the
MultiStarTableWritersubinterface if the format can contain multiple tables per file. Install it in a
StarTableOutputeither programmatically using the
setHandlersmethod or by setting the
startable.writerssystem property. This StarTableOutput will be then be able to write tables in this format as well as others. Such a
StarTableWritercan also be used directly to write tables by code which wants to write data in that particular format.
Because setting the
system properties can be done by the user at runtime, an application
using STIL can be reconfigured to work with new table formats without
having to rebuild either STIL or the application in question.
This document does not currently offer a tutorial on writing new table I/O handlers; refer to the javadocs for the relevant classes.