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 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

      public String getFormatName()
      Specified by:
      getFormatName in interface uk.ac.starlink.table.TableBuilder
    • looksLikeFile

      public boolean looksLikeFile(String location)
      Specified by:
      looksLikeFile in interface uk.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 interface uk.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 interface uk.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 interface uk.ac.starlink.table.TableBuilder
      Throws:
      IOException
    • canImport

      public boolean canImport(DataFlavor flavor)
      Returns true for a flavor with the MIME type "application/fits".
      Specified by:
      canImport in interface uk.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