Package uk.ac.starlink.votable
Class FitsPlusTableBuilder
java.lang.Object
uk.ac.starlink.votable.FitsPlusTableBuilder
- All Implemented Interfaces:
uk.ac.starlink.table.MultiTableBuilder
,uk.ac.starlink.table.TableBuilder
public class FitsPlusTableBuilder
extends Object
implements uk.ac.starlink.table.TableBuilder, uk.ac.starlink.table.MultiTableBuilder
Table builder which can read files in 'fits-plus' format (as written
by
FitsPlusTableWriter
). This looks for a primary header
in the FITS file which contains the VOTMETA header (in fact it is
quite inflexible about what it recognises as this format -
see isMagic(byte[])
) and tries to interpret the data array as a
1-d array of bytes representing the XML of a VOTable document.
This VOTable document should have one or more TABLE elements with no DATA
content - the table data is got from the extension extension HDUs,
one per table, and they must be BINTABLE extensions matching the
metadata described by the VOTable.
The point of all this is so that you can store VOTables in the efficient FITS format (it can be mapped if it's on local disk, which makes table creation practically instantaneous, even for random access) without sacrificing any of the metadata that you want to encode in VOTable format.
- Since:
- 27 Aug 2004
- Author:
- Mark Taylor (Starlink)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.FitsPlusTableBuilder
(uk.ac.starlink.fits.WideFits wide) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
canImport
(DataFlavor flavor) Returns true for a flavor with the MIME type "application/fits".static boolean
isMagic
(byte[] buffer) Tests whether a given buffer contains bytes which might be the first few bytes of a FitsPlus table.boolean
looksLikeFile
(String location) uk.ac.starlink.table.StarTable
makeStarTable
(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy) uk.ac.starlink.table.TableSequence
makeStarTables
(uk.ac.starlink.util.DataSource datsrc, uk.ac.starlink.table.StoragePolicy storagePolicy) void
streamStarTable
(InputStream in, uk.ac.starlink.table.TableSink sink, String pos)
-
Constructor Details
-
FitsPlusTableBuilder
public FitsPlusTableBuilder()Default constructor. -
FitsPlusTableBuilder
public FitsPlusTableBuilder(uk.ac.starlink.fits.WideFits wide) Constructor.- Parameters:
wide
- convention for representing extended columns; use null to avoid use of extended columns
-
-
Method Details
-
getFormatName
- Specified by:
getFormatName
in interfaceuk.ac.starlink.table.TableBuilder
-
looksLikeFile
- Specified by:
looksLikeFile
in interfaceuk.ac.starlink.table.TableBuilder
-
makeStarTable
public uk.ac.starlink.table.StarTable makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy) throws IOException - Specified by:
makeStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
IOException
-
makeStarTables
public uk.ac.starlink.table.TableSequence makeStarTables(uk.ac.starlink.util.DataSource datsrc, uk.ac.starlink.table.StoragePolicy storagePolicy) throws IOException - Specified by:
makeStarTables
in interfaceuk.ac.starlink.table.MultiTableBuilder
- Throws:
IOException
-
streamStarTable
public void streamStarTable(InputStream in, uk.ac.starlink.table.TableSink sink, String pos) throws IOException - Specified by:
streamStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
IOException
-
canImport
Returns true for a flavor with the MIME type "application/fits".- Specified by:
canImport
in interfaceuk.ac.starlink.table.TableBuilder
-
isMagic
public static boolean isMagic(byte[] buffer) Tests whether a given buffer contains bytes which might be the first few bytes of a FitsPlus table. The criterion is that it looks like the start of a FITS header, and the first few cards look roughly like this:SIMPLE = T BITPIX = 8 NAXIS = 1 NAXIS1 = ??? VOTMETA = T
- Parameters:
buffer
- byte buffer containing leading few bytes of data- Returns:
- true if it looks like a FitsPlus file
-