public class FitsArrayBuilder
extends java.lang.Object
implements uk.ac.starlink.array.ArrayBuilder
URLs are given in the format
fits-url.fitor
fits-url.fit[hdu-num]where the [] represent literal square brackets or
fits-url.fit#hdu-numwhere the # represents a literal hash sign. The fits-url.fit represents the full absolute or relative URL of a FITS file, and the hdu-num, if present, is the index of the HDU within it. If no HDU is given, the first HDU (hdu-num=0) is understood.
When writing a new NDArray, if hdu-num==0 then any existing FITS file of the same name will be erased. It is possible to write to HDUs after the first one by specifying the appropriate hdu-num, but only if this refers to the first non-existent HDU in an existing FITS file.
This is a singleton class; use getInstance()
to get an instance.
Modifier and Type | Method and Description |
---|---|
static FitsArrayBuilder |
getInstance()
Returns a FitsArrayBuilder.
|
uk.ac.starlink.array.NDArray |
makeNDArray(nom.tam.util.ArrayDataInput stream,
uk.ac.starlink.array.AccessMode mode)
Makes a readable NDArray from a data input stream.
|
uk.ac.starlink.array.NDArray |
makeNDArray(java.net.URL url,
uk.ac.starlink.array.AccessMode mode) |
uk.ac.starlink.array.NDArray |
makeNewNDArray(java.io.OutputStream stream,
uk.ac.starlink.array.NDShape shape,
uk.ac.starlink.array.Type type,
uk.ac.starlink.array.BadHandler bh,
boolean primary,
nom.tam.fits.HeaderCard[] cards)
Makes a new HDU written into a given stream containing an NDArray
with the type and shape as specified.
|
uk.ac.starlink.array.NDArray |
makeNewNDArray(java.net.URL url,
uk.ac.starlink.array.NDShape shape,
uk.ac.starlink.array.Type type,
uk.ac.starlink.array.BadHandler bh)
Makes a new HDU at a given URL containing an NDArray with the
shape and type as specified.
|
public static FitsArrayBuilder getInstance()
public uk.ac.starlink.array.NDArray makeNDArray(java.net.URL url, uk.ac.starlink.array.AccessMode mode) throws java.io.IOException
makeNDArray
in interface uk.ac.starlink.array.ArrayBuilder
java.io.IOException
public uk.ac.starlink.array.NDArray makeNDArray(nom.tam.util.ArrayDataInput stream, uk.ac.starlink.array.AccessMode mode) throws java.io.IOException
ArrayDataOutput
.stream
- the input stream supplying the HDU at which the
FITS array data can be foundmode
- read/write/update access modejava.io.IOException
- if some I/O error occurs or the stream does
not contain FITS array datapublic uk.ac.starlink.array.NDArray makeNewNDArray(java.net.URL url, uk.ac.starlink.array.NDShape shape, uk.ac.starlink.array.Type type, uk.ac.starlink.array.BadHandler bh) throws java.io.IOException
makeNewNDArray
in interface uk.ac.starlink.array.ArrayBuilder
url
- the URL at which the resource backing the NDArray is
to be writtenshape
- the shape of the new NDArray to constructtype
- the primitive data type of the new NDArray to constructbh
- requested bad value handling policyjava.io.IOException
- if the URL is a FITS URL but the requested
NDArray cannot be constructed for some reasonpublic uk.ac.starlink.array.NDArray makeNewNDArray(java.io.OutputStream stream, uk.ac.starlink.array.NDShape shape, uk.ac.starlink.array.Type type, uk.ac.starlink.array.BadHandler bh, boolean primary, nom.tam.fits.HeaderCard[] cards) throws java.io.IOException
stream
- the stream down which the NDArray is to be writtenshape
- the shape of the new NDArray to constructtype
- the primitive data type of the new NDArray to constructbh
- requested bad value handling policyprimary
- whether this is the primary HDU (first in file)cards
- array of additional FITS header cards to add - may be nulljava.io.IOException
- if there is some I/O errorCopyright © 2017 Central Laboratory of the Research Councils. All Rights Reserved.