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.MultiTableBuilderTable 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 booleancanImport(java.awt.datatransfer.DataFlavor flavor)Returns true for a flavor with the MIME type "application/fits".java.lang.StringgetFormatName()static booleanisMagic(byte[] buffer)Tests whether a given buffer contains bytes which might be the first few bytes of a FitsPlus table.booleanlooksLikeFile(java.lang.String location)uk.ac.starlink.table.StarTablemakeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy)uk.ac.starlink.table.TableSequencemakeStarTables(uk.ac.starlink.util.DataSource datsrc, uk.ac.starlink.table.StoragePolicy storagePolicy)voidstreamStarTable(java.io.InputStream in, uk.ac.starlink.table.TableSink sink, java.lang.String pos)
-
-
-
Method Detail
-
getFormatName
public java.lang.String getFormatName()
- Specified by:
getFormatNamein interfaceuk.ac.starlink.table.TableBuilder
-
looksLikeFile
public boolean looksLikeFile(java.lang.String location)
- Specified by:
looksLikeFilein 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:
makeStarTablein 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:
makeStarTablesin 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:
streamStarTablein 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:
canImportin 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
-
-