public interface NdxHandler
makeNdx(java.net.URL, uk.ac.starlink.array.AccessMode)
constructs an Ndx from an existing resource
and outputNdx(java.net.URL, uk.ac.starlink.ndx.Ndx)
constructs a new resource containing a copy
of an existing Ndx.
If the URL fed to outputNdx
is subsequently fed to
makeNdx
the factory should understand it to reference the
resource which was created by the earlier call (given that it still
exists).Modifier and Type | Method and Description |
---|---|
boolean |
makeBlankNdx(URL url,
Ndx template)
Constructs a new Ndx containing writable and uninitialised
array components at the given URL with characteristics
matching those of a given template Ndx.
|
Ndx |
makeNdx(URL url,
AccessMode mode)
Constructs a readable Ndx based on the existing resource at a given URL.
|
boolean |
outputNdx(URL url,
Ndx original)
Constructs a new Ndx which is a copy of the given Ndx at a
location determined by a given URL.
|
Ndx makeNdx(URL url, AccessMode mode) throws IOException
null
should be returned.
If the resource exists but some error occurs in processing it,
or if this factory knows that it understands the URL but is
unable to locate such a resource then an IOException should be
thrown; however, if it is possible that a different factory could
correctly construct an Ndx from this URL then a null return
is preferred.url
- the URL of the resource from which an Ndx is to
be constructedmode
- read/write/update access mode for component arraysIOException
- if the URL is understood but an Ndx cannot
be madeboolean makeBlankNdx(URL url, Ndx template) throws IOException
If the URL is not recognised by this handler or it is not known
how to construct such an Ndx then false
should be returned.
If the handler recognises the URL but some error occurs in
creating the new Ndx, then an IOException should be thrown;
however, if it is possible that a different handler could
correctly construct a writable Ndx as requested then a false
return is preferred.
url
- a URL at which the new NDX should be writtentemplate
- a template Ndx object from which non-array data
should be initialised - all scalar components
will be copied from it, and new blank writable
array components matching the ones in it will be
createdurl
,
false if it doesn't understand this URLIOException
- if the URL is understood but an NDArray cannot
be madeboolean outputNdx(URL url, Ndx original) throws IOException
The return status indicates whether such a resource was successfully created. If the URL is not recognised or this factory does not feel qualified to construct an Ndx with the given URL then it must return false. If some error occurs during construction then an IOException should in general be thrown; however if this factory thinks that another factory might have more luck then a false return is preferred.
url
- the URL at which the resource backing the Ndx is
to be writtenoriginal
- an Ndx whose data is to be copied to the resource
given by url
IOException
- if an error occurred during the resource
creation or data copyingCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.