public abstract class AbstractFitsTableWriter extends StreamStarTableWriter implements MultiStarTableWriter
A couple of Auxiliary metadata items of the ColumnInfo metadata from written tables are respected:
Tables.NULL_VALUE_INFO
:
sets the value of TNULLn
"magic" blank value for
integer columnsTables.UBYTE_FLAG_INFO
:
if set to Boolean.TRUE
and if the column has content class
Short
or short[]
, the data will be written
as unsigned bytes (TFORMn='B'
)
not 16-bit signed integers (TFORMn='I'
).BintableStarTable.LONGOFF_INFO
:
if this is set to a string representation of an integer value,
and the column has content class String or String[],
then the data will be written as long integers (TFORMn='K'
)
with the given offset (TZEROn=...
).
This option supports round-tripping of offset long values
(typically representing unsigned longs) which are converted to
strings on read.Modifier | Constructor and Description |
---|---|
protected |
AbstractFitsTableWriter(java.lang.String formatName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addMetadata(nom.tam.fits.Header hdr)
Adds some standard metadata header cards to a FITS table header.
|
protected abstract FitsTableSerializer |
createSerializer(StarTable table)
Provides a suitable serializer for a given table.
|
static java.lang.String |
getCurrentDate()
Returns an ISO-8601 data string representing the time at which this
method is called.
|
java.lang.String |
getFormatName()
Gives the name of the format which is written by this writer.
|
java.lang.String |
getMimeType()
Returns "application/fits".
|
boolean |
getWriteDate()
Indicates whether a datestamp is written to output FITS files.
|
void |
setFormatName(java.lang.String formatName)
Sets the declared format name.
|
void |
setWriteDate(boolean writeDate)
Configures whether a datestamp is written to output FITS files.
|
void |
writePrimaryHDU(java.io.DataOutput out)
Writes the primary HDU.
|
void |
writeStarTable(StarTable table,
java.io.OutputStream out)
Writes a single table.
|
void |
writeStarTables(TableSequence tableSeq,
java.io.OutputStream out)
Writes tables.
|
void |
writeStarTables(TableSequence tableSeq,
java.lang.String location,
StarTableOutput sto)
|
void |
writeTableHDU(StarTable table,
FitsTableSerializer fitser,
java.io.DataOutput out)
Writes a data HDU.
|
writeStarTable, writeStarTable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
looksLikeFile, writeStarTable
protected AbstractFitsTableWriter(java.lang.String formatName)
formatName
- format namepublic java.lang.String getFormatName()
StarTableWriter
getFormatName
in interface StarTableWriter
public void setFormatName(java.lang.String formatName)
formatName
- format namepublic java.lang.String getMimeType()
getMimeType
in interface StarTableWriter
public void writeStarTable(StarTable table, java.io.OutputStream out) throws java.io.IOException
writeStarTables(uk.ac.starlink.table.TableSequence, java.io.OutputStream)
.writeStarTable
in interface StarTableWriter
table
- the table to writeout
- 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 void writeStarTables(TableSequence tableSeq, java.io.OutputStream out) throws java.io.IOException
writePrimaryHDU(java.io.DataOutput)
to write the primary HDU.
Subclasses which want to put something related to the input tables
into the primary HDU will need to override this method
(writeStarTables).writeStarTables
in interface MultiStarTableWriter
tableSeq
- sequence of tables to writeout
- destination streamjava.io.IOException
public void writeStarTables(TableSequence tableSeq, java.lang.String location, StarTableOutput sto) throws java.io.IOException
writeStarTables
in interface MultiStarTableWriter
tableSeq
- sequence of tables to writelocation
- destination for tablessto
- StarTableOutput instancejava.io.IOException
public void writePrimaryHDU(java.io.DataOutput out) throws java.io.IOException
out
- destination streamjava.io.IOException
public void writeTableHDU(StarTable table, FitsTableSerializer fitser, java.io.DataOutput out) throws java.io.IOException
table
- the table to be written into the HDUfitser
- fits serializer initalised from table
out
- destination streamjava.io.IOException
protected abstract FitsTableSerializer createSerializer(StarTable table) throws java.io.IOException
table
- table to serializejava.io.IOException
- if the table can't be writtenprotected void addMetadata(nom.tam.fits.Header hdr)
hdr
- header to modify@ConfigMethod(property="date", doc="<p>If true, the DATE-HDU header is filled in with the current date; otherwise it is not included.</p>") public void setWriteDate(boolean writeDate)
writeDate
- true to include DATE-HDU, false to omit itpublic boolean getWriteDate()
public static java.lang.String getCurrentDate()