uk.ac.starlink.fits
Class VariableFitsTableWriter

java.lang.Object
  extended byuk.ac.starlink.table.StreamStarTableWriter
      extended byuk.ac.starlink.fits.AbstractFitsTableWriter
          extended byuk.ac.starlink.fits.VariableFitsTableWriter
All Implemented Interfaces:
StarTableWriter

public class VariableFitsTableWriter
extends AbstractFitsTableWriter

TableWriter which writes FITS BINTABLEs with variable-length arrays where appropriate. Array-valued columns in the input StarTable which are declared with variable shapes (the last element of ColumnInfo.getShape() is negative) will be written in the output FITS file using the 'P' or 'Q' data type specifier with the actual data written in the BINTABLE extension heap - see the FITS document for details. Any other columns will get written in just the same way as by the FitsTableWriter.

Strings and String arrays ('A' descriptor) are not currently written in variable-length form.

Since:
11 Jul 2008

Constructor Summary
VariableFitsTableWriter()
          Constructs a writer which chooses sensibly between using 'P' and 'Q' format.
VariableFitsTableWriter(boolean longIndexing)
          Constructs a writer forcing use of either 'P' or 'Q' format for variable-length array columns.
 
Method Summary
protected  FitsTableSerializer createSerializer(StarTable table)
          Provides a suitable serializer for a given table.
 boolean looksLikeFile(String location)
          Always returns false.
 void setStoragePolicy(StoragePolicy storagePolicy)
          Sets the storage policy which will be used for temporary storage during writing.
 void writePrimaryHDU(StarTable startab, FitsTableSerializer fitser, DataOutput out)
          Writes the primary HDU.
 
Methods inherited from class uk.ac.starlink.fits.AbstractFitsTableWriter
addMetadata, 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
 

Constructor Detail

VariableFitsTableWriter

public VariableFitsTableWriter()
Constructs a writer which chooses sensibly between using 'P' and 'Q' format. 'Q' (64-bit) indexing is only used if the heap is going to be larger than 2^31 bytes.


VariableFitsTableWriter

public VariableFitsTableWriter(boolean longIndexing)
Constructs a writer forcing use of either 'P' or 'Q' format for variable-length array columns.

Parameters:
longIndexing - true for 'Q' (64-bit) indexing into the heap, false for 'P' (32-bit) indexing into the heap
Method Detail

setStoragePolicy

public void setStoragePolicy(StoragePolicy storagePolicy)
Sets the storage policy which will be used for temporary storage during writing. Temporary storage is required for the heap contents while the table body itself is being written. By default the system default storage policy is used.

Parameters:
storagePolicy - policy to use

looksLikeFile

public boolean looksLikeFile(String location)
Always returns false.

Parameters:
location - the location name (probably filename)
Returns:
true iff it looks like a file this writer would normally write

writePrimaryHDU

public void writePrimaryHDU(StarTable startab,
                            FitsTableSerializer fitser,
                            DataOutput out)
                     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:
startab - the table which will be written into the next HDU
fitser - fits serializer initialised from table
out - destination stream
Throws:
IOException

createSerializer

protected FitsTableSerializer createSerializer(StarTable table)
                                        throws IOException
Description copied from class: AbstractFitsTableWriter
Provides a suitable serializer for a given table.

Specified by:
createSerializer in class AbstractFitsTableWriter
Parameters:
table - table to serialize
Returns:
FITS serializer
Throws:
IOException

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