|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.array.NDArrayFactory
public class NDArrayFactory
Manufactures NDArray objects from URLs. Methods are available to construct a readable NDArray from a URL pointing to an existing array resource, or to construct a new NDArray with a location given by a URL.
This factory delegates the actual NDArray creation to external ArrayBuilder objects; the URL is passed to each one in turn until one can make an NDArray object from it, which object is returned to the caller.
By default, if the corresponding classes are present, the following ArrayBuilders are installed:
Consult the documentation of these classes to find out about the format of URLs understood by each.
Constructor Summary | |
---|---|
NDArrayFactory()
Constructs an NDArrayFactory with a default list of builders. |
Method Summary | |
---|---|
List |
getBuilders()
Gets the list of builders which actually do the URL->NDArray construction. |
NDArray |
makeNDArray(String location,
AccessMode mode)
Constructs a readable NDArray from a location representing an existing resource. |
NDArray |
makeNDArray(URL url,
AccessMode mode)
Constructs a readable NDArray from a URL representing an exisiting resource. |
NDArray |
makeNewNDArray(String location,
NDArray template)
Constructs a new NDArray to which data can be written given a location and another template NDArray. |
NDArray |
makeNewNDArray(String location,
NDShape shape,
Type type,
BadHandler bh)
Constructs a new NDArray to which data can be written given a location and the array characteristics. |
NDArray |
makeNewNDArray(URL url,
NDArray template)
Constructs a new NDArray to which data can be written given a URL and another template NDArray. |
NDArray |
makeNewNDArray(URL url,
NDShape shape,
Type type,
BadHandler bh)
Constructs a new NDArray to which data can be written given a URL and the array characteristics. |
void |
setBuilders(ArrayBuilder[] builders)
Sets the list of builders which actually do the URL->NDArray construction Builders earlier in the list are given a chance to handle a URL before ones later in the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NDArrayFactory()
Method Detail |
---|
public List getBuilders()
ArrayBuilder
objects used
for turning URLs into NDArrayspublic void setBuilders(ArrayBuilder[] builders)
builders
- an array of ArrayBuilder objects used for
turning URLs into NDArrayspublic NDArray makeNDArray(URL url, AccessMode mode) throws IOException
url
- a URL pointing to a resource holding array datamode
- the mode with which it should be accessed
IOException
- if there is any I/O errorpublic NDArray makeNewNDArray(URL url, NDShape shape, Type type, BadHandler bh) throws IOException
The bh parameter indicates a requested bad value handling scheme, but does not guarantee that it will be used, since not all storage formats are capable of storing bad values in arbitrary ways. According to the resource type, bad value handling will be provided on a best-efforts basis. If bh is null, the implementation will choose a bad value handling policy of its own.
url
- a URL pointing to a writable resource. This may be
a suitable file:
-protocol URL or one
with some other protocol which can provide an
output-capable connectionshape
- the shape of the new arraytype
- a Type object indicating the type of data in the arraybh
- the requested bad value handling policy - see above.
IOException
- if an I/O error occurs
IllegalArgumentException
- if the type of bh does not
match typepublic NDArray makeNewNDArray(URL url, NDArray template) throws IOException
makeNewNDArray(URL,NDShape,Type,BadHandler)
with the shape, type and bh
parameters copied from the template NDArray.
url
- a URL pointing to a writable resource. This may be
a suitable file:
-protocol URL or one
with some other protocol which can provide an
output-capable connectiontemplate
- an NDArray whose characteristics are to be
copied when the new one is created
IOException
- if an I/O error occurspublic NDArray makeNDArray(String location, AccessMode mode) throws IOException
makeNDArray(URL,AccessMode)
.
location
- the location of the resource. If it cannot be
parsed as a URL, it will be treated as a filenamemode
- the mode with which it should be accessed
IOException
- if there is any I/O errorpublic NDArray makeNewNDArray(String location, NDShape shape, Type type, BadHandler bh) throws IOException
makeNewNDArray(URL,NDShape,Type,BadHandler)
location
- the location of the resource. If it cannot be
parsed as a URL, it will be treated as a filenameshape
- the shape of the new arraytype
- a Type object indicating the type of data in the arraybh
- requested bad value handling policy
IOException
- if an I/O error occurspublic NDArray makeNewNDArray(String location, NDArray template) throws IOException
makeNewNDArray(URL,NDArray)
.
location
- the location of the resource. If it cannot be
parsed as a URL, it will be treated as a filenametemplate
- an NDArray whose characteristics are to be
copied when the new one is created
IOException
- if an I/O error occurs
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |