public class StarTableOutput extends Object
UnifiedFitsTableWriter
VOTableWriter
HealpixFitsTableWriter
EcsvTableWriter
ParquetTableWriter
TextTableWriter
AsciiTableWriter
CsvTableWriter
IpacTableWriter
HTMLTableWriter
LatexTableWriter
TstTableWriter
FeatherTableWriter
MirageTableWriter
startable.writers
system property (as a colon-separated list) which implement the
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 String |
AUTO_HANDLER
Special output handler name indicating automatic format selection.
|
static 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(OutputStream out,
StarTableWriter handler)
Returns a sink which allows you to write data to an output table.
|
TableSink |
createOutputSink(String location,
String format)
Returns a sink which allows you to write data to an output table.
|
StarTableWriter |
getHandler(String format)
Returns a StarTableWriter object given an output format name.
|
StarTableWriter |
getHandler(String format,
String location)
Returns a StarTableWriter object given an output format name
and/or a location to write to.
|
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.
|
List<String> |
getKnownFormats()
Returns a list of the format strings which are defined by the
handlers registered with this object.
|
OutputStream |
getOutputStream(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.
|
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,
OutputStream out,
StarTableWriter handler)
Writes a StarTable to an output stream.
|
void |
writeStarTable(StarTable startab,
String location,
String format)
Writes a
StarTable object out to some external storage. |
void |
writeStarTables(StarTable[] tables,
OutputStream out,
MultiStarTableWriter handler)
Writes an array of StarTables to an output stream.
|
void |
writeStarTables(StarTable[] tables,
String location,
String format)
Writes an array of StarTable objects to some external storage.
|
public static final String AUTO_HANDLER
public static final String EXTRA_WRITERS_PROPERTY
StarTableWriter
classes for addition to the list of known output handlers.public StarTableOutput()
public List<StarTableWriter> getHandlers()
StarTableWriter
objectspublic void setHandlers(StarTableWriter[] handlers)
handlers
- an array of StarTableWriter
objectspublic void writeStarTable(StarTable startab, String location, String format) throws TableFormatException, IOException
StarTable
object out to some external storage.
The format in which it is written is determined by some
combination of the given output location and a format indicator.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
StarTableWriter
s (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 knownIOException
public void writeStarTable(StarTable startab, OutputStream out, StarTableWriter handler) throws IOException
handler
to perform
the write, closing the stream afterwards.startab
- table to writeout
- raw output streamhandler
- output handlerIOException
getHandler(java.lang.String)
public void writeStarTables(StarTable[] tables, String location, String format) throws TableFormatException, 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
MultiStarTableWriter
s (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
IOException
public void writeStarTables(StarTable[] tables, OutputStream out, MultiStarTableWriter handler) throws IOException
handler
to perform
the write, closing the stream afterwards.tables
- tables to writeout
- destination streamhandler
- output handlerIOException
public TableSink createOutputSink(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(String location, 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
StarTableWriter
s (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 OutputStream getOutputStream(String location) throws IOException
location
is a filename and a corresponding
FileOutputStream
is returned, but there may be other
possibilities. The stream returned by this method will not
in general be buffered; for high performance writes, wrapping it
in a BufferedOutputStream
may be a good idea.location
- name of destinationlocation
IOException
- if no stream pointing to location
can be openedpublic StarTableWriter getHandler(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
StarTableWriter
s (first match is used,
case-insensitive, starting substrings OK).TableFormatException
- if no handler suitable for the arguments
can be foundpublic StarTableWriter getHandler(String format, 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
StarTableWriter
s (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 List<String> getKnownFormats()
format
argument to the
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 Transferable transferStarTable(StarTable startab)
Transferable
object associated with a given
StarTable, for use at the drag end of a drag and drop operation.startab
- the table which is to be draggedStarTableFactory.makeStarTable(java.awt.datatransfer.Transferable)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.