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

Variable Index

 o handle
This is the handle to the NeXus file handle.
 o MAXNAMELEN
Maximum name length, must be VGNAMELENMAX in hlimits.h
 o NX_CHAR
 o NX_COMP_HUF
 o NX_COMP_LZW
 o NX_COMP_NONE
constants for compression schemes
 o NX_COMP_RLE
 o NX_FLOAT32
constants for number types.
 o NX_FLOAT64
 o NX_INT16
 o NX_INT32
 o NX_INT8
 o NX_UINT16
 o NX_UINT32
 o NX_UINT8
 o NX_UNLIMITED
constant denoting an unlimited dimension.
 o NXACC_CREATE
 o NXACC_RDWR
 o NXACC_READ
possible access codes,

Constructor Index

 o NexusFile(String, int)
constructs a new NexusFile Object.

Method Index

 o attrdir()
attrdir returns the attributes of the currently open dataset or the file global attributes if no dataset is open.
 o close(int)
 o closedata()
closedata closes an opened dataset.
 o closegroup()
closegroup closes access to the current group and steps down one step in group hierarchy.
 o compress(int)
causes the currently open dataset to be compressed on file.
 o debugstop()
debugstop is a debugging helper function which goes into an endless loop in the dynamic link library.
 o finalize()
removes all NeXus file data structures and closes the file.
 o flush()
flushes all pending data to disk.
 o getattr(String, Object, int[])
getattr retrieves the data associated with the attribute name.
 o getdata(Object)
getdata reads the data from an previously openend dataset into array.
 o getdataID()
getdataID gets the data necessary for linking the current dataset somewhere else.
 o getgroupID()
getgroupID gets the data necessary for linking the current vGroup somewhere else.
 o getinfo(int[], int[])
getinfo retrieves information about a previously opened dataset.
 o getslab(int[], int[], Object)
getslab reads a subset of a large dataset into array.
 o groupdir()
groupdir will retrieve the content of the currently open vGroup.
 o init(String, int)
 o makedata(String, int, int, int[])
makedata creates a new dataset with the specified characteristics in the current group.
 o makegroup(String, String)
makegroup creates a new group below the current group within the NeXus file hierarchy.
 o makelink(NXlink)
makelink links the object described by target into the current vGroup.
 o nextattr(int, String[], int[])
 o nextentry(int, String[])
 o nxclosedata(int)
 o nxclosegroup(int)
 o nxcompress(int, int)
 o nxflush(int)
 o nxgetattr(int, String, byte[], int[])
 o nxgetdata(int, byte[])
 o nxgetdataid(int, NXlink)
 o nxgetgroupid(int, NXlink)
 o nxgetinfo(int, int[], int[])
 o nxgetslab(int, int[], int[], byte[])
 o nxmakedata(int, String, int, int, int[])
 o nxmakegroup(int, String, String)
 o nxmakelink(int, NXlink)
 o nxopendata(int, String)
 o nxopengroup(int, String, String)
 o nxputattr(int, String, byte[], int)
 o nxputdata(int, byte[])
 o nxputslab(int, byte[], int[], int[])
 o opendata(String)
opendata opens an existing dataset for access.
 o opengroup(String, String)
opengroup opens the group name with class nxclass.
 o putattr(String, Object, int)
putattr adds a named attribute to a previously opened dataset or a global attribute if no dataset is open.
 o putdata(Object)
putdata writes the data from array into a previously opened dataset.
 o putslab(Object, int[], int[])
putslab writes a subset of a larger dataset to a previously opened dataset.

Variables

 o NXACC_READ
 public static final int NXACC_READ
possible access codes, @see #NexusFile.

 o NXACC_RDWR
 public static final int NXACC_RDWR
 o NXACC_CREATE
 public static final int NXACC_CREATE
 o NX_UNLIMITED
 public static final int NX_UNLIMITED
constant denoting an unlimited dimension.

 o NX_FLOAT32
 public static final int NX_FLOAT32
constants for number types. @see #makedata, @see #putattr and others.

 o NX_FLOAT64
 public static final int NX_FLOAT64
 o NX_INT8
 public static final int NX_INT8
 o NX_UINT8
 public static final int NX_UINT8
 o NX_INT16
 public static final int NX_INT16
 o NX_UINT16
 public static final int NX_UINT16
 o NX_INT32
 public static final int NX_INT32
 o NX_UINT32
 public static final int NX_UINT32
 o NX_CHAR
 public static final int NX_CHAR
 o NX_COMP_NONE
 public static final int NX_COMP_NONE
constants for compression schemes @see #compress

 o NX_COMP_LZW
 public static final int NX_COMP_LZW
 o NX_COMP_RLE
 public static final int NX_COMP_RLE
 o NX_COMP_HUF
 public static final int NX_COMP_HUF
 o MAXNAMELEN
 protected static final int MAXNAMELEN
Maximum name length, must be VGNAMELENMAX in hlimits.h

 o handle
 protected int handle
This is the handle to the NeXus file handle.

Constructors

 o 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.

Methods

 o init
 protected native int init(String filename,
                           int access)
 o close
 protected native void close(int handle)
 o nxflush
 protected native int nxflush(int handle)
 o flush
 public void flush() throws NexusException
flushes all pending data to disk. Closes any open SDS's.

 o 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
 o nxmakegroup
 protected native void nxmakegroup(int handle,
                                   String name,
                                   String nxclass)
 o nxopengroup
 protected native void nxopengroup(int handle,
                                   String name,
                                   String nxclass)
 o nxclosegroup
 protected native void nxclosegroup(int handle)
 o 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.
 o 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.
 o 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.
 o nxmakedata
 protected native void nxmakedata(int handle,
                                  String name,
                                  int type,
                                  int rank,
                                  int dim[])
 o nxopendata
 protected native void nxopendata(int handle,
                                  String name)
 o nxclosedata
 protected native void nxclosedata(int handle)
 o nxcompress
 protected native void nxcompress(int handle,
                                  int compression_type)
 o 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.
 o 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.
 o 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.
 o 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.
 o nxgetdata
 protected native void nxgetdata(int handle,
                                 byte bdata[])
 o nxgetslab
 protected native void nxgetslab(int handle,
                                 int Start[],
                                 int size[],
                                 byte bdata[])
 o nxgetattr
 protected native void nxgetattr(int handle,
                                 String name,
                                 byte bdata[],
                                 int args[])
 o 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.
 o 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.
 o 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.
 o nxputdata
 protected native void nxputdata(int handle,
                                 byte array[])
 o nxputslab
 protected native void nxputslab(int handle,
                                 byte array[],
                                 int start[],
                                 int end[])
 o nxputattr
 protected native void nxputattr(int handle,
                                 String name,
                                 byte array[],
                                 int type)
 o 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.
 o 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.
 o 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.
 o nxgetinfo
 protected native void nxgetinfo(int handle,
                                 int iDim[],
                                 int args[])
 o nextentry
 protected native int nextentry(int handle,
                                String names[])
 o nextattr
 protected native int nextattr(int handle,
                               String names[],
                               int args[])
 o 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.
 o 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
 o 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.
 o nxgetgroupid
 protected native void nxgetgroupid(int handle,
                                    NXlink link)
 o nxgetdataid
 protected native void nxgetdataid(int handle,
                                   NXlink link)
 o nxmakelink
 protected native void nxmakelink(int handle,
                                  NXlink target)
 o 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.
 o 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.
 o 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.
 o 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