Package uk.ac.starlink.votable
Class FitsPlusTableWriter
- java.lang.Object
-
- uk.ac.starlink.table.StreamStarTableWriter
-
- uk.ac.starlink.fits.AbstractFitsTableWriter
-
- uk.ac.starlink.votable.VOTableFitsTableWriter
-
- uk.ac.starlink.votable.FitsPlusTableWriter
-
- All Implemented Interfaces:
uk.ac.starlink.table.Documented
,uk.ac.starlink.table.formats.DocumentedIOHandler
,uk.ac.starlink.table.MultiStarTableWriter
,uk.ac.starlink.table.StarTableWriter
public class FitsPlusTableWriter extends VOTableFitsTableWriter implements uk.ac.starlink.table.formats.DocumentedIOHandler
TableWriter which writes table data into the first extension of a FITS file, UnlikeFitsTableWriter
however, the primary extension is not left contentless, instead it gets the text of a DATA-less VOTable written into it. This VOTable describes the metadata of the table, as if the DATA element contained a FITS element referencing the first extension HDU of the file. Tables stored in this format have all the rich metadata associated with VOTables, and benefit from the compactness of FITS tables, without the considerable disdvantage of being split into two files.The header cards in the primary HDU look like this:
SIMPLE = T / Standard FITS format BITPIX = 8 / Character data NAXIS = 1 / Text string NAXIS1 = nnnn / Number of characters VOTMETA = T / Table metadata in VOTABLE format EXTEND = T / There are standard extensions
the VOTMETA card in particular marking that this HDU contains VOTable metadata.- Since:
- 26 Aug 2004
- Author:
- Mark Taylor (Starlink)
-
-
Constructor Summary
Constructors Constructor Description FitsPlusTableWriter()
Default constructor.FitsPlusTableWriter(java.lang.String name, uk.ac.starlink.fits.WideFits wide)
Custom constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected uk.ac.starlink.fits.FitsTableSerializer
createSerializer(uk.ac.starlink.table.StarTable table)
protected void
customisePrimaryHeader(nom.tam.fits.Header hdr)
Hook for adding custom entries to the FITS header which is written to the primary HDU.boolean
docIncludesExample()
java.lang.String[]
getExtensions()
static uk.ac.starlink.table.StarTableWriter[]
getStarTableWriters()
Returns a list of FITS-plus table writers with variant values of attributes.java.lang.String
getXmlDescription()
protected boolean
isMagic(int icard, java.lang.String key, java.lang.String value)
Tests a header card to see if it looks like part of the magic number for the format written by this handler.boolean
looksLikeFile(java.lang.String location)
-
Methods inherited from class uk.ac.starlink.votable.VOTableFitsTableWriter
isMagic, setVotableVersion, writeStarTables
-
Methods inherited from class uk.ac.starlink.fits.AbstractFitsTableWriter
addMetadata, getCurrentDate, getFormatName, getMimeType, getWriteDate, setFormatName, setWriteDate, writePrimaryHDU, writeStarTable, writeStarTables, writeTableHDU
-
Methods inherited from class uk.ac.starlink.table.StreamStarTableWriter
writeStarTable, writeStarTable
-
-
-
-
Constructor Detail
-
FitsPlusTableWriter
public FitsPlusTableWriter()
Default constructor.
-
FitsPlusTableWriter
public FitsPlusTableWriter(java.lang.String name, uk.ac.starlink.fits.WideFits wide)
Custom constructor.- Parameters:
name
- writer namewide
- convention for representing over-wide tables; null to avoid this convention
-
-
Method Detail
-
getExtensions
public java.lang.String[] getExtensions()
- Specified by:
getExtensions
in interfaceuk.ac.starlink.table.formats.DocumentedIOHandler
-
looksLikeFile
public boolean looksLikeFile(java.lang.String location)
- Specified by:
looksLikeFile
in interfaceuk.ac.starlink.table.StarTableWriter
-
docIncludesExample
public boolean docIncludesExample()
- Specified by:
docIncludesExample
in interfaceuk.ac.starlink.table.formats.DocumentedIOHandler
-
getXmlDescription
public java.lang.String getXmlDescription()
- Specified by:
getXmlDescription
in interfaceuk.ac.starlink.table.Documented
-
customisePrimaryHeader
protected void customisePrimaryHeader(nom.tam.fits.Header hdr) throws nom.tam.fits.HeaderCardException
Description copied from class:VOTableFitsTableWriter
Hook for adding custom entries to the FITS header which is written to the primary HDU. This is called just after the required cards (SIMPLE, BITPIX, NAXIS, NAXIS1 ) are added and just before the EXTEND card.- Specified by:
customisePrimaryHeader
in classVOTableFitsTableWriter
- Parameters:
hdr
- header- Throws:
nom.tam.fits.HeaderCardException
-
isMagic
protected boolean isMagic(int icard, java.lang.String key, java.lang.String value)
Description copied from class:VOTableFitsTableWriter
Tests a header card to see if it looks like part of the magic number for the format written by this handler. TheVOTableFitsTableWriter
implementation tests that the first four cards read:SIMPLE = T BITPIX = 8 NAXIS = 1 NAXIS1 = ???
Subclasses may override this to add tests for later cards (as written inVOTableFitsTableWriter.customisePrimaryHeader(nom.tam.fits.Header)
).- Overrides:
isMagic
in classVOTableFitsTableWriter
- Parameters:
icard
- 0-based card indexkey
- card namevalue
- card value- Returns:
- true iff the presented card is one that could have been written by this writer
-
createSerializer
protected uk.ac.starlink.fits.FitsTableSerializer createSerializer(uk.ac.starlink.table.StarTable table) throws java.io.IOException
- Specified by:
createSerializer
in classuk.ac.starlink.fits.AbstractFitsTableWriter
- Throws:
java.io.IOException
-
getStarTableWriters
public static uk.ac.starlink.table.StarTableWriter[] getStarTableWriters()
Returns a list of FITS-plus table writers with variant values of attributes. In fact this just returns two functionally identical instances but with different format names: one is "fits" and the other is "fits-plus".- Returns:
- table writers
-
-