public class StarTableOutput
extends java.lang.Object
FitsPlusTableWriter
FitsTableWriter
VariableFitsTableWriter
HealpixFitsTableWriter
VOTableWriter
EcsvTableWriter
ParquetTableWriter
FeatherTableWriter
TextTableWriter
AsciiTableWriter
CsvTableWriter
IpacTableWriter
TstTableWriter
ColFitsPlusTableWriter
HTMLTableWriter
LatexTableWriter
MirageTableWriter
StarTableWriter
interface and have a no-arg constructor will be
instantiated and added to this list of handlers.
It can additionally write to JDBC tables.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_HANDLER
Special output handler name indicating automatic format selection.
|
static java.lang.String |
EXTRA_WRITERS_PROPERTY
System property which can contain a list of
StarTableWriter
classes for addition to the list of known output handlers. |
Constructor and Description |
---|
StarTableOutput()
Constructs a StarTableOutput with a default list of handlers.
|
Modifier and Type | Method and Description |
---|---|
TableSink |
createOutputSink(java.io.OutputStream out,
StarTableWriter handler)
Returns a sink which allows you to write data to an output table.
|
TableSink |
createOutputSink(java.lang.String location,
java.lang.String format)
Returns a sink which allows you to write data to an output table.
|
StarTableWriter |
getHandler(java.lang.String format)
Returns a StarTableWriter object given an output format name.
|
StarTableWriter |
getHandler(java.lang.String format,
java.lang.String location)
Returns a StarTableWriter object given an output format name
and/or a location to write to.
|
java.util.List<StarTableWriter> |
getHandlers()
Gets the list of handlers which can actually do table output.
|
JDBCHandler |
getJDBCHandler()
Returns the JDBCHandler object used for writing tables to JDBC
connections.
|
java.util.List<java.lang.String> |
getKnownFormats()
Returns a list of the format strings which are defined by the
handlers registered with this object.
|
java.io.OutputStream |
getOutputStream(java.lang.String location)
Returns an output stream which points to a given location.
|
void |
setHandlers(StarTableWriter[] handlers)
Sets the list of handlers which can actually do table output.
|
void |
setJDBCHandler(JDBCHandler handler)
Sets the JDBCHandler object used for writing tables to JDBC
connections.
|
java.awt.datatransfer.Transferable |
transferStarTable(StarTable startab)
Returns a Transferable object associated with a given
StarTable, for use at the drag end of a drag and drop operation.
|
void |
writeStarTable(StarTable startab,
java.io.OutputStream out,
StarTableWriter handler)
Writes a StarTable to an output stream.
|
void |
writeStarTable(StarTable startab,
java.lang.String location,
java.lang.String format)
Writes a StarTable object out to some external storage.
|
void |
writeStarTables(StarTable[] tables,
java.io.OutputStream out,
MultiStarTableWriter handler)
Writes an array of StarTables to an output stream.
|
void |
writeStarTables(StarTable[] tables,
java.lang.String location,
java.lang.String format)
Writes an array of StarTable objects to some external storage.
|
public static final java.lang.String AUTO_HANDLER
public static final java.lang.String EXTRA_WRITERS_PROPERTY
StarTableWriter
classes for addition to the list of known output handlers.public StarTableOutput()
public java.util.List<StarTableWriter> getHandlers()
public void setHandlers(StarTableWriter[] handlers)
handlers
- an array of StarTableWriter objectspublic void writeStarTable(StarTable startab, java.lang.String location, java.lang.String format) throws TableFormatException, java.io.IOException
startab
- the table to outputlocation
- the location at which to write the new table.
This may be a filename or URL, including a jdbc:
protocol if suitable JDBC drivers are installedformat
- a string which indicates in some way what format
should be used for output. This may be the class name of
a StarTableWriter object (which may or may not be
registered with this StarTableOutput), or else
a string which matches the format name of one of the registered
StarTableWriters (first match is used,
case-insensitive, starting substrings OK)
or null or AUTO_HANDLER
to indicate that a handler should be
selected based on the value of location.
Ignored for jdbc:-protocol locationsTableFormatException
- if no suitable handler is knownjava.io.IOException
public void writeStarTable(StarTable startab, java.io.OutputStream out, StarTableWriter handler) throws java.io.IOException
startab
- table to writeout
- raw output streamhandler
- output handlerjava.io.IOException
getHandler(java.lang.String)
public void writeStarTables(StarTable[] tables, java.lang.String location, java.lang.String format) throws TableFormatException, java.io.IOException
MultiStarTableWriter
.tables
- the tables to outputlocation
- the location at which to write the tables;
this may be a filename or URLformat
- a string which indicates in some way what format
should be used for output. This may be the class name of
a MultiStarTableWriter object (which may or may not be
registered with this StarTableOutput), or else
a string which matches the format name of one of the registered
MultiStarTableWriters (first match is used,
case-insensitive, starting substrings OK)
or null or AUTO_HANDLER
to indicate that a handler should be
selected based on the value of location.TableFormatException
java.io.IOException
public void writeStarTables(StarTable[] tables, java.io.OutputStream out, MultiStarTableWriter handler) throws java.io.IOException
tables
- tables to writeout
- destination streamhandler
- output handlerjava.io.IOException
public TableSink createOutputSink(java.io.OutputStream out, StarTableWriter handler)
handler
can write
the table using a single pass of the data. If it requires multiple
passes, a UnrepeatableSequenceException
will be thrown.out
- raw output streamhandler
- output handlerpublic TableSink createOutputSink(java.lang.String location, java.lang.String format)
handler
can write
the table using a single pass of the data. If it requires multiple
passes, a UnrepeatableSequenceException
will be thrown.location
- the location at which to write the new table.
This may be a filename or URL, including a jdbc:
protocol if suitable JDBC drivers are installedformat
- a string which indicates in some way what format
should be used for output. This may be the class name of
a StarTableWriter object (which may or may not be
registered with this StarTableOutput), or else
a string which matches the format name of one of the registered
StarTableWriters (first match is used,
case-insensitive, starting substrings OK)
or null or AUTO_HANDLER
to indicate that a handler should be
selected based on the value of location.
Ignored for jdbc:-protocol locationspublic java.io.OutputStream getOutputStream(java.lang.String location) throws java.io.IOException
BufferedOutputStream
may be a good idea.location
- name of destinationjava.io.IOException
- if no stream pointing to location
can be openedpublic StarTableWriter getHandler(java.lang.String format) throws TableFormatException
format
- a string which indicates in some way what format
should be used for output. This may be the class name of
a StarTableWriter object (which may or may not be
registered with this StarTableOutput), or else
a string which matches the format name of one of the registered
StarTableWriters (first match is used,
case-insensitive, starting substrings OK).TableFormatException
- if no handler suitable for the arguments
can be foundpublic StarTableWriter getHandler(java.lang.String format, java.lang.String location) throws TableFormatException
format
- a string which indicates in some way what format
should be used for output. This may be the class name of
a StarTableWriter object (which may or may not be
registered with this StarTableOutput), or else
a string which matches the format name of one of the registered
StarTableWriters (first match is used,
case-insensitive, starting substrings OK)
or null to indicate that a handler should be
selected based on the value of location.location
- destination of the table to be written.
If format is null, the value of this will be used
to try to determine which handler to use, typically on the
basis of filename extensionTableFormatException
- if no handler suitable for the arguments
can be foundpublic java.util.List<java.lang.String> getKnownFormats()
writeStarTable(uk.ac.starlink.table.StarTable, java.lang.String, java.lang.String)
method.public JDBCHandler getJDBCHandler()
public void setJDBCHandler(JDBCHandler handler)
handler
- the handler to usepublic java.awt.datatransfer.Transferable transferStarTable(StarTable startab)
startab
- the table which is to be draggedStarTableFactory.makeStarTable(java.awt.datatransfer.Transferable)