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 java.lang.Object implements uk.ac.starlink.table.TableBuilder, uk.ac.starlink.table.MultiTableBuilder
Table builder which can read files in 'fits-plus' format (as written byFitsPlusTableWriter
). 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 - seeisMagic(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:
FitsPlusTableWriter
-
-
Constructor Summary
Constructors Constructor Description FitsPlusTableBuilder()
Default constructor.FitsPlusTableBuilder(uk.ac.starlink.fits.WideFits wide)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canImport(java.awt.datatransfer.DataFlavor flavor)
Returns true for a flavor with the MIME type "application/fits".java.lang.String
getFormatName()
static boolean
isMagic(byte[] buffer)
Tests whether a given buffer contains bytes which might be the first few bytes of a FitsPlus table.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(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
-
-
-
Method Detail
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatName
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 java.io.IOException
- Specified by:
makeStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
java.io.IOException
-
makeStarTables
public uk.ac.starlink.table.TableSequence makeStarTables(uk.ac.starlink.util.DataSource datsrc, uk.ac.starlink.table.StoragePolicy storagePolicy) throws java.io.IOException
- Specified by:
makeStarTables
in interfaceuk.ac.starlink.table.MultiTableBuilder
- Throws:
java.io.IOException
-
streamStarTable
public void streamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos) throws java.io.IOException
- Specified by:
streamStarTable
in interfaceuk.ac.starlink.table.TableBuilder
- Throws:
java.io.IOException
-
canImport
public boolean canImport(java.awt.datatransfer.DataFlavor flavor)
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
-
-