uk.ac.starlink.votable
Class VOTableFitsTableWriter

java.lang.Object
  |
  +--uk.ac.starlink.table.StreamStarTableWriter
        |
        +--uk.ac.starlink.fits.AbstractFitsTableWriter
              |
              +--uk.ac.starlink.votable.VOTableFitsTableWriter
All Implemented Interfaces:
StarTableWriter
Direct Known Subclasses:
ColFitsPlusTableWriter, FitsPlusTableWriter

public abstract class VOTableFitsTableWriter
extends AbstractFitsTableWriter

TableWriter which writes table data into the first extension of a FITS file, Unlike FitsTableWriter 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. Tables stored using this (non-standard) mechanism have all the rich metadata associated with VOTables, and benefit from the compactness of FITS tables, withouth the considerable disadvantage of being split into two files.

Since:
26 Aug 2004

Constructor Summary
protected VOTableFitsTableWriter(String formatName)
          Constructor.
 
Method Summary
protected abstract  void customisePrimaryHeader(Header hdr)
          Hook for adding custom entries to the FITS header which is written to the primary HDU.
 boolean isMagic(byte[] buffer)
          Determines whether a given byte buffer looks like it contains the start of a primary header written by this writer.
protected  boolean isMagic(int icard, String key, String value)
          Tests a header card to see if it looks like part of the magic number for the format written by this handler.
 void writePrimaryHDU(StarTable table, FitsTableSerializer fitser, DataOutput strm)
          Writes the primary HDU.
 
Methods inherited from class uk.ac.starlink.fits.AbstractFitsTableWriter
addMetadata, createSerializer, getCurrentDate, getFormatName, getMimeType, setFormatName, writeStarTable, writeTableHDU
 
Methods inherited from class uk.ac.starlink.table.StreamStarTableWriter
writeStarTable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.starlink.table.StarTableWriter
looksLikeFile
 

Constructor Detail

VOTableFitsTableWriter

protected VOTableFitsTableWriter(String formatName)
Constructor.

Parameters:
formatName - handler format name
Method Detail

writePrimaryHDU

public void writePrimaryHDU(StarTable table,
                            FitsTableSerializer fitser,
                            DataOutput strm)
                     throws IOException
Description copied from class: AbstractFitsTableWriter
Writes the primary HDU. This cannot contain the table since BINTABLE HDUs can only be extensions.

Specified by:
writePrimaryHDU in class AbstractFitsTableWriter
Parameters:
table - the table which will be written into the next HDU
fitser - fits serializer initialised from table
strm - destination stream
IOException

customisePrimaryHeader

protected abstract void customisePrimaryHeader(Header hdr)
                                        throws HeaderCardException
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.

Parameters:
hdr -
HeaderCardException

isMagic

public boolean isMagic(byte[] buffer)
Determines whether a given byte buffer looks like it contains the start of a primary header written by this writer. Calls the protected isMagic(int,java.lang.String,java.lang.String) method.

Parameters:
buffer - start of a file
Returns:
true iff buffer looks like it contains a file written by this handler

isMagic

protected boolean isMagic(int icard,
                          String key,
                          String value)
Tests a header card to see if it looks like part of the magic number for the format written by this handler. The VOTableFitsTableWriter 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 in customisePrimaryHeader(nom.tam.fits.Header)).

Parameters:
icard - 0-based card index
key - card name
value - card value
Returns:
true iff the presented card is one that could have been written by this writer

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.