public class XMLNdxHandler extends Object implements NdxHandler
<variance url="http://archive.org/data/stars-vars.fits"/>or
<variance>http://archive.org/data/stars-vars.fits</variance>URLs relative to the position of the XML file in question are allowed.
A URL is normally only considered suitable if it ends in '.xml'.
However, the special URL "file:-
" may be used to
indicate standard input/output.
Modifier and Type | Method and Description |
---|---|
static XMLNdxHandler |
getInstance()
Returns an XMLNdxHandler.
|
boolean |
makeBlankNdx(URL url,
Ndx template)
Writes an XML file representing a new NDX with writable array
components.
|
Ndx |
makeNdx(Source xsrc,
AccessMode mode)
Constructs a readable Ndx object from an XML source.
|
Ndx |
makeNdx(URL url,
AccessMode mode)
Constructs an Ndx object from a URL pointing to an appropriate
XML resource.
|
boolean |
outputNdx(URL xurl,
Ndx ndx)
Writes an XML representation of an existing Ndx object to the given
(writable) URL.
|
public static XMLNdxHandler getInstance()
public Ndx makeNdx(URL url, AccessMode mode) throws IOException
makeNdx
in interface NdxHandler
url
- a URL pointing to some XML representing an NDXmode
- read/write/update access mode for component arraysIOException
- if some error occurs in the I/Opublic Ndx makeNdx(Source xsrc, AccessMode mode) throws IOException
xsrc
- an XML source containing the XML representation of
the NDX. Must represent a document or element.
Note that the SystemId attribute, if present,
will be used to resolve relative URLsmode
- read/write/update access mode for component arraysIOException
- if some error occurs in the I/OIllegalArgumentException
- if xsrc
does not
correspond to a document or element XML sourcepublic boolean outputNdx(URL xurl, Ndx ndx) throws IOException
If any of the array components is virtual, then the array data
needs to be output too. Currently, for a URL 'blah.xml'
these are written into successive components of a new FITS file
'blah-data.fits'. If the FITS handlers are not installed,
or url
does not end in '.xml' an IOException will be thrown.
This behaviour may be subject to change in future releases.
outputNdx
in interface NdxHandler
xurl
- the URL to which the Ndx is to be serialised in XMLndx
- the Ndx object to serialiseUnknownServiceException
- if the URL does not support
output (most protocols, apart from file
, don't)IOException
- if some other I/O error occurspublic boolean makeBlankNdx(URL url, Ndx template) throws IOException
The array components themselves reside in a new fits file;
currently for a URL 'blah.xml' a new fits file called
'blah-data.fits' is written. If the FITS handlers are not installed,
or url
does not end in '.xml' an IOException will be thrown.
This behaviour may be subject to change in future releases.
makeBlankNdx
in interface NdxHandler
url
- a URL at which the new NDX should be writtentemplate
- a template Ndx object from which non-array data
should be initialised - any title, bad bits mask,
WCS component etc will be copied from hereIOException
- if the URL is understood but an NDArray cannot
be madeCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.