public class HDSArrayBuilder extends Object implements ArrayBuilder
URLs are given in the format:
container.sdfor
container.sdf#pathwhere the container.sdf part is a full absolute or relative URL referring to the HDS container file, and the optional fragment identifier gives the HDS path within that container file in the traditional dot-separated format. If there is no fragment identifier (no #), the object at the top level of the HDS container file is understood.
This is a singleton class; use getInstance()
to get an instance.
HDSReference
Modifier and Type | Method and Description |
---|---|
static HDSArrayBuilder |
getInstance()
Returns an HDSArrayBuilder.
|
NDArray |
makeNDArray(ArrayStructure ary,
AccessMode mode)
Constructs an NDArray based on an existing HDS array object.
|
NDArray |
makeNDArray(URL url,
AccessMode mode)
Constructs an NDArray based on the existing resource at a given URL.
|
NDArray |
makeNewNDArray(URL url,
NDShape shape,
Type type,
BadHandler bh)
Constructs a new NDArray with the given characteristics in a
location determined by a given URL.
|
public static HDSArrayBuilder getInstance()
LinkageError
- if the JNIHDS package is not availablepublic NDArray makeNDArray(URL url, AccessMode mode) throws IOException
ArrayBuilder
If the resource storing the NDArray is incapable of storing bad values,
an NDArray using the
default bad value handling policy
should be returned.
makeNDArray
in interface ArrayBuilder
url
- the URL of the resource from which an NDArray is to
be constructedmode
- the read/update/write mode with which to create the arrayIOException
- if the URL is understood but an NDArray cannot
be madepublic NDArray makeNDArray(ArrayStructure ary, AccessMode mode) throws HDSException
ary
- the ArrayStructure to be viewed as an NDArraymode
- the read/write/update mode for the NDArrayHDSException
- if there is an error in HDSpublic NDArray makeNewNDArray(URL url, NDShape shape, Type type, BadHandler bh) throws IOException
ArrayBuilder
The bh parameter indicates a requested bad value handling
policy. If it is not null, this handler should attempt to create
a new NDArray resource with the same policy. However, if it is
not possible because of limitations in the storage format it may
use a different bad value policy, bearing in mind the behaviour
documented in ArrayBuilder.makeNDArray(java.net.URL, uk.ac.starlink.array.AccessMode)
.
makeNewNDArray
in interface ArrayBuilder
url
- the URL at which the resource backing the NDArray is
to be writtenshape
- the shape of the new NDArray to construct. If this
object is an OrderedNDShape
, its Order
may be used as a hint about the pixel ordering
scheme of the NDArray to be created, but no guarantee
is made that the orderings will matchtype
- the primitive data type of the new NDArray to constructbh
- requested bad value handling policy - see aboveIOException
- if the URL is understood but the requested
NDArray cannot be constructed thereCopyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.