All Packages Class Hierarchy This Package Previous Next Index
Class neutron.nexus.NexusFile
java.lang.Object
|
+----neutron.nexus.NexusFile
- public class NexusFile
- extends Object
- implements NeXusFileInterface
-
handle
- This is the handle to the NeXus file handle.
-
MAXNAMELEN
- Maximum name length, must be VGNAMELENMAX in hlimits.h
-
NX_CHAR
-
-
NX_COMP_HUF
-
-
NX_COMP_LZW
-
-
NX_COMP_NONE
- constants for compression schemes
-
NX_COMP_RLE
-
-
NX_FLOAT32
- constants for number types.
-
NX_FLOAT64
-
-
NX_INT16
-
-
NX_INT32
-
-
NX_INT8
-
-
NX_UINT16
-
-
NX_UINT32
-
-
NX_UINT8
-
-
NX_UNLIMITED
- constant denoting an unlimited dimension.
-
NXACC_CREATE
-
-
NXACC_RDWR
-
-
NXACC_READ
- possible access codes,
-
NexusFile(String, int)
- constructs a new NexusFile Object.
-
attrdir()
- attrdir returns the attributes of the currently open dataset or
the file global attributes if no dataset is open.
-
close(int)
-
-
closedata()
- closedata closes an opened dataset.
-
closegroup()
- closegroup closes access to the current group and steps down one
step in group hierarchy.
-
compress(int)
- causes the currently open dataset to be compressed on file.
-
debugstop()
- debugstop is a debugging helper function which goes into an
endless loop in the dynamic link library.
-
finalize()
- removes all NeXus file data structures and closes the file.
-
flush()
- flushes all pending data to disk.
-
getattr(String, Object, int[])
- getattr retrieves the data associated with the attribute
name.
-
getdata(Object)
- getdata reads the data from an previously openend dataset into
array.
-
getdataID()
- getdataID gets the data necessary for linking the current dataset
somewhere else.
-
getgroupID()
- getgroupID gets the data necessary for linking the current vGroup
somewhere else.
-
getinfo(int[], int[])
- getinfo retrieves information about a previously opened dataset.
-
getslab(int[], int[], Object)
- getslab reads a subset of a large dataset into array.
-
groupdir()
- groupdir will retrieve the content of the currently open vGroup.
-
init(String, int)
-
-
makedata(String, int, int, int[])
- makedata creates a new dataset with the specified characteristics
in the current group.
-
makegroup(String, String)
-
makegroup creates a new group below the current group within
the NeXus file hierarchy.
-
makelink(NXlink)
- makelink links the object described by target into the current
vGroup.
-
nextattr(int, String[], int[])
-
-
nextentry(int, String[])
-
-
nxclosedata(int)
-
-
nxclosegroup(int)
-
-
nxcompress(int, int)
-
-
nxflush(int)
-
-
nxgetattr(int, String, byte[], int[])
-
-
nxgetdata(int, byte[])
-
-
nxgetdataid(int, NXlink)
-
-
nxgetgroupid(int, NXlink)
-
-
nxgetinfo(int, int[], int[])
-
-
nxgetslab(int, int[], int[], byte[])
-
-
nxmakedata(int, String, int, int, int[])
-
-
nxmakegroup(int, String, String)
-
-
nxmakelink(int, NXlink)
-
-
nxopendata(int, String)
-
-
nxopengroup(int, String, String)
-
-
nxputattr(int, String, byte[], int)
-
-
nxputdata(int, byte[])
-
-
nxputslab(int, byte[], int[], int[])
-
-
opendata(String)
- opendata opens an existing dataset for access.
-
opengroup(String, String)
- opengroup opens the group name with class nxclass.
-
putattr(String, Object, int)
- putattr adds a named attribute to a previously opened dataset or
a global attribute if no dataset is open.
-
putdata(Object)
- putdata writes the data from array into a previously opened
dataset.
-
putslab(Object, int[], int[])
- putslab writes a subset of a larger dataset to a previously opened
dataset.
NXACC_READ
public static final int NXACC_READ
- possible access codes, @see #NexusFile.
NXACC_RDWR
public static final int NXACC_RDWR
NXACC_CREATE
public static final int NXACC_CREATE
NX_UNLIMITED
public static final int NX_UNLIMITED
- constant denoting an unlimited dimension.
NX_FLOAT32
public static final int NX_FLOAT32
- constants for number types. @see #makedata, @see #putattr
and others.
NX_FLOAT64
public static final int NX_FLOAT64
NX_INT8
public static final int NX_INT8
NX_UINT8
public static final int NX_UINT8
NX_INT16
public static final int NX_INT16
NX_UINT16
public static final int NX_UINT16
NX_INT32
public static final int NX_INT32
NX_UINT32
public static final int NX_UINT32
NX_CHAR
public static final int NX_CHAR
NX_COMP_NONE
public static final int NX_COMP_NONE
- constants for compression schemes @see #compress
NX_COMP_LZW
public static final int NX_COMP_LZW
NX_COMP_RLE
public static final int NX_COMP_RLE
NX_COMP_HUF
public static final int NX_COMP_HUF
MAXNAMELEN
protected static final int MAXNAMELEN
- Maximum name length, must be VGNAMELENMAX in hlimits.h
handle
protected int handle
- This is the handle to the NeXus file handle.
NexusFile
public NexusFile(String filename,
int access) throws NexusException
- constructs a new NexusFile Object.
- Parameters:
- filename - The name of the NeXus file to access.
- access. - The access mode for the file. Can only be one
of the predefined NeXus access code NXACC.... These are:
- NXACC_CREATE
- or creating a new file.
- NXACC_RDWR
- For opening an existing file for modification or appending
data.
- NXACC_READ
- For opening a file for reading.
- Throws: NexusException
- when the file could not be found or
an HDF error occurred.
init
protected native int init(String filename,
int access)
close
protected native void close(int handle)
nxflush
protected native int nxflush(int handle)
flush
public void flush() throws NexusException
- flushes all pending data to disk. Closes any open SDS's.
finalize
public void finalize() throws Throwable
- removes all NeXus file data structures and closes the file. This
function should automatically be called by the Java garbage
collector whenever the NexusFile object falls into disuse. However
the time when this is done is left to the garbage collector. My
personal experience is that finalize might never be called. I
suggest, to call finalize yourself when you are done with the
NeXus file. finalize makes sure that multiple invocations will not
do any harm.
- Overrides:
- finalize in class Object
nxmakegroup
protected native void nxmakegroup(int handle,
String name,
String nxclass)
nxopengroup
protected native void nxopengroup(int handle,
String name,
String nxclass)
nxclosegroup
protected native void nxclosegroup(int handle)
makegroup
public void makegroup(String name,
String nxclass) throws NexusException
- makegroup creates a new group below the current group within
the NeXus file hierarchy.
- Parameters:
- name - The name of the group to create.
- nxclass - The classname of the group.
- Throws: NexusException
- if an error occurs during this operation.
opengroup
public void opengroup(String name,
String nxclass) throws NexusException
- opengroup opens the group name with class nxclass.
The group must exist, otherwise an exception is thrown. opengroup is
similar to a cd name in a filesystem.
- Parameters:
- name - the name of the group to open.
- nxclass - the classname of the group to open.
- Throws: NexusException
- when something goes wrong.
closegroup
public void closegroup() throws NexusException
- closegroup closes access to the current group and steps down one
step in group hierarchy.
- Throws: NexusException
- when an HDF error occurs during this
operation.
nxmakedata
protected native void nxmakedata(int handle,
String name,
int type,
int rank,
int dim[])
nxopendata
protected native void nxopendata(int handle,
String name)
nxclosedata
protected native void nxclosedata(int handle)
nxcompress
protected native void nxcompress(int handle,
int compression_type)
makedata
public void makedata(String name,
int type,
int rank,
int dim[]) throws NexusException
- makedata creates a new dataset with the specified characteristics
in the current group.
- Parameters:
- name - The name of the dataset.
- type - The number type of the dataset. Usually a constant from
a selection of values.
- rank - The rank or number of dimensions of the dataset.
- dim - An array containing the length of each dimension. dim must
have at least rank entries. The first dimension can be 0 which
means it is an unlimited dimension.
- Throws: NexusException
- when the dataset could not be created.
opendata
public void opendata(String name) throws NexusException
- opendata opens an existing dataset for access. For instance for
reading or writing.
- Parameters:
- name - The name of the dataset to open.
- Throws: NexusException
- when the dataset does not exist or
something else is wrong.
closedata
public void closedata() throws NexusException
- closedata closes an opened dataset. Then no further access is
possible without a call to opendata.
- Throws: NexusException
- when an HDF error occurrs.
compress
public void compress(int compression_type) throws NexusException
- causes the currently open dataset to be compressed on file.
This must be called after makedata and before writing to the
dataset.
- Parameters:
- compression_type - determines the type of compression
to use.
- Throws: NexusException
- when no dataset is open or an HDF error
occurs.
nxgetdata
protected native void nxgetdata(int handle,
byte bdata[])
nxgetslab
protected native void nxgetslab(int handle,
int Start[],
int size[],
byte bdata[])
nxgetattr
protected native void nxgetattr(int handle,
String name,
byte bdata[],
int args[])
getdata
public void getdata(Object array) throws NexusException
- getdata reads the data from an previously openend dataset into
array.
- Parameters:
- array - An n-dimensional array of the appropriate number
type for the dataset. Make sure to have the right type and size
here.
- Throws: NexusException
- when either an HDF error occurs or
no dataset is open or array is not of the right type to hold
the data.
getslab
public void getslab(int start[],
int size[],
Object array) throws NexusException
- getslab reads a subset of a large dataset into array.
- Parameters:
- start - An array of dimension rank which contains the start
position in the dataset from where to start reading.
- size - An array of dimension rank which contains the size
of the dataset subset in each dimension to read.
- array - An array for holding the returned data values.
- Throws: NexusException
- when either an HDF error occurs or
no dataset is open or array is not of the right type to hold
the data.
getattr
public void getattr(String name,
Object array,
int args[]) throws NexusException
- getattr retrieves the data associated with the attribute
name.
- Parameters:
- name - The name of the attribute.
- array - an array with sufficient space for holding the attribute
data.
- args - An integer array of dimension rank which holds the
length of the array as first value and the type as the last
value. Both values will be updated during reading.
- Throws: NexusException
- when either an HDF error occurs or
the attribute could not be found.
nxputdata
protected native void nxputdata(int handle,
byte array[])
nxputslab
protected native void nxputslab(int handle,
byte array[],
int start[],
int end[])
nxputattr
protected native void nxputattr(int handle,
String name,
byte array[],
int type)
putdata
public void putdata(Object array) throws NexusException
- putdata writes the data from array into a previously opened
dataset.
- Parameters:
- array - The data to write.
- Throws: NexusException
- when an HDF error occurs.
putslab
public void putslab(Object array,
int start[],
int end[]) throws NexusException
- putslab writes a subset of a larger dataset to a previously opened
dataset.
- Parameters:
- array - The data to write.
- start - An integer array of dimension rank which holds the
startcoordinates of the data subset in the larger dataset.
- end - An integer array of dimension rank which holds the
size in each dimension of the data subset to write.
- Throws: NexusException
- when an HDF error occurs.
putattr
public void putattr(String name,
Object array,
int iType) throws NexusException
- putattr adds a named attribute to a previously opened dataset or
a global attribute if no dataset is open.
- Parameters:
- name - The name of the attribute.
- array - The data of the attribute.
- iType - The number type of the attribute.
- Throws: NexusException
- if an HDF error occurs.
nxgetinfo
protected native void nxgetinfo(int handle,
int iDim[],
int args[])
nextentry
protected native int nextentry(int handle,
String names[])
nextattr
protected native int nextattr(int handle,
String names[],
int args[])
getinfo
public void getinfo(int iDim[],
int args[]) throws NexusException
- getinfo retrieves information about a previously opened dataset.
- Parameters:
- iDim - An array which will be filled with the size of
the dataset in each dimension.
- args - An integer array which will hold more information about
the dataset after return. The fields: args[0] is the rank, args[1] is
the number type.
- Throws: NexusException
- when an HDF error occurs.
groupdir
public Hashtable groupdir() throws NexusException
- groupdir will retrieve the content of the currently open vGroup.
groupdir is similar to an ls in unix.
- Returns:
- A Hashtable which will hold the names of the items in
the group as keys and the NeXus classname for vGroups or the
string 'SDS' for datasets as values.
- Throws: NexusException
- if an HDF error occurs
attrdir
public Hashtable attrdir() throws NexusException
- attrdir returns the attributes of the currently open dataset or
the file global attributes if no dataset is open.
- Returns:
- A Hashtable which will hold the names of the attributes
as keys. For each key there is an AttributeEntry class as value.
- Throws: NexusException
- when an HDF error occurs.
nxgetgroupid
protected native void nxgetgroupid(int handle,
NXlink link)
nxgetdataid
protected native void nxgetdataid(int handle,
NXlink link)
nxmakelink
protected native void nxmakelink(int handle,
NXlink target)
getgroupID
public NXlink getgroupID() throws NexusException
- getgroupID gets the data necessary for linking the current vGroup
somewhere else.
- Returns:
- A NXlink class holding the link data.
- Throws: NexusException
- if an HDF error occurs.
getdataID
public NXlink getdataID() throws NexusException
- getdataID gets the data necessary for linking the current dataset
somewhere else.
- Returns:
- A NXlink class holding the link data.
- Throws: NexusException
- if an HDF error occurs.
makelink
public void makelink(NXlink target) throws NexusException
- makelink links the object described by target into the current
vGroup.
- Parameters:
- target - The Object to link into the current group.
- Throws: NexusException
- if an error occurs.
debugstop
public native void debugstop()
- debugstop is a debugging helper function which goes into an
endless loop in the dynamic link library. Then a unix debugger
may attach to the running java process using the pid, interrupt,
set the loop variable to leave the loop, set a new breakpoint and
continue debugging. This works with ladebug on DU40D. This is an
developer support routine and should NEVER be called in normal
code.
All Packages Class Hierarchy This Package Previous Next Index