public class NioArrayImpl extends Object implements ArrayImpl
Buffer for
the data storage. Can be used in such a way that the buffer itself
is not actually created until it is required (and hence is never created
if it is not required).Buffer| Modifier and Type | Class and Description |
|---|---|
static interface |
NioArrayImpl.BufferGetter
Defines an object which can provide deferred access to a
Buffer. |
| Constructor and Description |
|---|
NioArrayImpl(Buffer buf,
OrderedNDShape oshape,
Type type,
Number badval)
Constructs an ArrayImpl from a
Buffer. |
NioArrayImpl(NioArrayImpl.BufferGetter bufget,
OrderedNDShape oshape,
Type type,
Number badval)
Constructs an ArrayImpl using a deferred-access buffer object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canMap()
Indicates whether mapped access is available.
|
void |
close()
Shuts down this ArrayImpl for pixel access.
|
AccessImpl |
getAccess()
Returns an object which can access the pixels of this ArrayImpl.
|
Number |
getBadValue()
The magic bad value for data.
|
Object |
getMapped()
Returns a single primitive array holding all the pixel data of
this array.
|
OrderedNDShape |
getShape()
Returns an object representing the shape (origin and dimensions)
and pixel sequence of this object.
|
Type |
getType()
Returns the primitive type of the data held by this object.
|
boolean |
isRandom()
Indicates whether random access is possible.
|
boolean |
isReadable()
Indicates whether read access is possible.
|
boolean |
isWritable()
Indicates whether write access is possible.
|
boolean |
multipleAccess()
Indicates whether the getAccess method may be called more than once.
|
void |
open()
Prepares this ArrayImpl for pixel access.
|
public NioArrayImpl(NioArrayImpl.BufferGetter bufget, OrderedNDShape oshape, Type type, Number badval)
bufget - an object which can do deferred creation of a
Bufferoshape - the shape of the arraytype - the data type of the arraybadval - the magic bad value for the array (may be null)public NioArrayImpl(Buffer buf, OrderedNDShape oshape, Type type, Number badval)
Buffer.buf - an NIO bufferoshape - the shape of the arraytype - the data type of the arraybadval - the magic bad value for the array (may be null)public void open()
throws IOException
ArrayImplopen in interface ArrayImplIOException - if there is an IO errorpublic boolean canMap()
ArrayImplWill only be called after an open call, and before any close call.
public Object getMapped()
ArrayImplWill only be called if canMap returns true, and only after an open call and before any close call.
public void close()
throws IOException
ArrayImplclose in interface ArrayImplIOException - if there is an IO errorpublic OrderedNDShape getShape()
ArrayImplpublic Type getType()
ArrayImplpublic Number getBadValue()
ArrayImplnull
if there is no bad value.
The return value must not change over the lifetime of the object.getBadValue in interface ArrayImplpublic boolean isRandom()
ArrayImplpublic boolean isReadable()
ArrayImplisReadable in interface ArrayImplpublic boolean isWritable()
ArrayImplisWritable in interface ArrayImplpublic boolean multipleAccess()
ArrayImplmultipleAccess in interface ArrayImplpublic AccessImpl getAccess()
ArrayImplThis method will only be called after the sole call to open and before the sole call to close.
This method will only be called more than once if the multipleAccess method returns true.
It is the responsibility of the caller to close the returned AccessImpl when it is no longer required; this enables resources it may hold to be released.
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.