NeXusJavaBindings  1
 All Classes Namespaces Files Functions Variables Macros Pages
NexusFile.java
Go to the documentation of this file.
1 
16 package org.nexusformat;
17 
18 import java.util.Hashtable;
19 import java.io.File;
23 
24 public class NexusFile implements NeXusFileInterface {
25 
26  // constants
30  public final static int NXACC_READ = 1;
31  public final static int NXACC_RDWR = 2;
32  public final static int NXACC_CREATE = 3;
33  public final static int NXACC_CREATE4 = 4;
34  public final static int NXACC_CREATE5 = 5;
35  public final static int NXACC_CREATEXML = 6;
36  public final static int NXACC_NOSTRIP = 128;
37 
41  public final static int NX_UNLIMITED = -1;
42 
47  public final static int NX_FLOAT32 = 5;
48  public final static int NX_FLOAT64 = 6;
49  public final static int NX_INT8 = 20;
50  public final static int NX_BINARY = 20;
51  public final static int NX_UINT8 = 21;
52  public final static int NX_BOOLEAN = 21;
53  public final static int NX_INT16 = 22;
54  public final static int NX_UINT16 = 23;
55  public final static int NX_INT32 = 24;
56  public final static int NX_UINT32 = 25;
57  public final static int NX_INT64 = 26;
58  public final static int NX_UINT64 = 27;
59  public final static int NX_CHAR = 4;
60 
64  public final static int NX_COMP_NONE = 100;
65  public final static int NX_COMP_LZW = 200;
66  public final static int NX_COMP_RLE = 300;
67  public final static int NX_COMP_HUF = 400;
68 
72  protected final static int MAXNAMELEN = 64;
73 
74  /*
75  This code takes care of loading the static library required for
76  this class to work properly. The algorithm first looks for a
77  property org.nexusformat.JNEXUSLIB and loads that file if available,
78  else it tries to locate the library in the system shared library
79  path.
80  */
81  static
82  {
83  String filename = null;
84  filename = System.getProperty("org.nexusformat.JNEXUSLIB",null);
85  if ((filename != null) && (filename.length() > 0))
86  {
87  File hdfdll = new File(filename);
88  if (hdfdll.exists() && hdfdll.canRead() && hdfdll.isFile())
89  {
90  System.load(filename);
91  } else {
92  throw (new UnsatisfiedLinkError("Invalid JNEXUS library"));
93  }
94  }
95  else {
96  System.loadLibrary("jnexus");
97  }
98  }
99 
103  protected int handle;
104 
105  // Construction
106  // native methods for this section
107  protected native int init(String filename, int access);
108  protected native void close(int handle);
109  protected native int nxflush(int handle);
110 
130  public NexusFile(String filename, int access) throws NexusException {
131  checkForNull(filename);
132 
133  handle = init(filename,access);
134  if(handle < 0){
135  throw new NexusException("Failed to open " + filename);
136  }
137  }
138 
142  public void flush() throws NexusException {
143  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
144  handle = nxflush(handle);
145  }
146 
151  public void close() throws NexusException {
152  if(handle >= 0) {
153  close(handle);
154  handle = -1;
155  }
156  }
157 
168  public void finalize() throws Throwable {
169  close();
170  }
171 
172 
173  // group functions
174  //native methods for this section
175  protected native void nxmakegroup(int handle, String name, String nxclass);
176  protected native void nxopengroup(int handle, String name, String nxclass);
177  protected native void nxopenpath(int handle, String path);
178  protected native void nxopengrouppath(int handle, String path);
179  protected native void nxclosegroup(int handle);
180  protected native String nxgetpath(int handle);
181 
182  public void makegroup(String name, String nxclass) throws NexusException {
183  checkForNull(name, nxclass);
184  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
185  nxmakegroup(handle, name, nxclass);
186  }
187 
188  public void opengroup(String name, String nxclass) throws NexusException {
189  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
190  checkForNull(name, nxclass);
191  nxopengroup(handle, name, nxclass);
192  }
193 
194  public void openpath(String path) throws NexusException {
195  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
196  checkForNull(path);
197  nxopenpath(handle,path);
198  }
199 
200  public void opengrouppath(String path) throws NexusException {
201  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
202  checkForNull(path);
203  nxopengrouppath(handle,path);
204  }
205 
206  public String getpath() throws NexusException {
207  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
208  return nxgetpath(handle);
209  }
210 
211  public void closegroup() throws NexusException {
212  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
214  }
215 
216  // data set handling
217  // native methods for this section
218  protected native void nxmakedata(int handle, String name, int type, int rank, int dim[]);
219  protected native void nxmakedata64(int handle, String name, int type, int rank, long dim[]);
220  protected native void nxmakecompdata(int handle, String name, int type, int rank, int dim[], int iCompress, int iChunk[]);
221  protected native void nxmakecompdata64(int handle, String name, int type, int rank, long dim[], int iCompress, long iChunk[]);
222  protected native void nxopendata(int handle, String name);
223  protected native void nxclosedata(int handle);
224  protected native void nxcompress(int handle, int compression_type);
225 
226  public void compmakedata(String name, int type, int rank, int dim[],
227  int compression_type, int iChunk[]) throws NexusException {
228  if (handle < 0) throw new NexusException("NAPI-ERROR: File not open");
229  checkType(type);
230  checkForNull(name, rank, iChunk);
231  checkForNegInArray(true, dim, iChunk);
232  switch(compression_type) {
233  case NexusFile.NX_COMP_NONE:
234  case NexusFile.NX_COMP_LZW:
235  break;
236  default:
237  throw new NexusException("Invalid compression code requested");
238 
239  }
240  nxmakecompdata(handle, name, type, rank, dim, compression_type, iChunk);
241  }
242 
243  public void compmakedata(String name, int type, int rank, long dim[],
244  int compression_type, long iChunk[]) throws NexusException {
245  if (handle < 0) throw new NexusException("NAPI-ERROR: File not open");
246  checkType(type);
247  checkForNull(name, rank, iChunk);
248  checkForNegInArray(true, dim, iChunk);
249  switch(compression_type) {
250  case NexusFile.NX_COMP_NONE:
251  case NexusFile.NX_COMP_LZW:
252  break;
253  default:
254  throw new NexusException("Invalid compression code requested");
255 
256  }
257  nxmakecompdata64(handle, name, type, rank, dim, compression_type, iChunk);
258  }
259 
260  public void makedata(String name, int type, int rank, int dim[]) throws
262  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
263  checkType(type);
264  checkForNull(name, dim);
265  checkForNegInArray(true, dim);
266  nxmakedata(handle, name, type, rank, dim);
267  }
268 
269  public void makedata(String name, int type, int rank, long dim[]) throws
271  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
272  checkType(type);
273  checkForNull(name, dim);
274  checkForNegInArray(true, dim);
275  nxmakedata64(handle, name, type, rank, dim);
276  }
277 
278  public void opendata(String name) throws NexusException {
279  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
280  checkForNull(name);
281  nxopendata(handle,name);
282  }
283 
284  public void closedata() throws NexusException {
285  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
287  }
288 
289  public void compress(int compression_type) throws NexusException {
290  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
291  switch(compression_type) {
292  case NexusFile.NX_COMP_NONE:
293  case NexusFile.NX_COMP_LZW:
294  case NexusFile.NX_COMP_RLE:
295  case NexusFile.NX_COMP_HUF:
296  break;
297  default:
298  throw new NexusException("Invalid compression code requested");
299 
300  }
301  nxcompress(handle,compression_type);
302  }
303 
304  // data set reading
305  // native methods in this section
306  protected native void nxgetdata(int handle, byte bdata[]);
307  protected native void nxgetslab(int handle, int Start[], int size[], byte bdata[]);
308  protected native void nxgetslab64(int handle, long Start[], long size[], byte bdata[]);
309  protected native void nxgetattr(int handle, String name, byte bdata[], int args[]);
310 
311  public void getdata(Object array) throws NexusException {
312  byte bdata[];
313  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
314  checkForNull(array);
315  try{
316  HDFArray ha = new HDFArray(array);
317  bdata = ha.emptyBytes();
318  nxgetdata(handle,bdata);
319  array = ha.arrayify(bdata);
320  }catch(HDFException he) {
321  throw new NexusException(he.getMessage());
322  }
323  }
324 
325  public void getslab(int start[], int size[], Object array) throws NexusException {
326  byte bdata[];
327  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
328  checkForNull(start, size, array);
329  checkForNegInArray(false, start, size);
330  try{
331  HDFArray ha = new HDFArray(array);
332  bdata = ha.emptyBytes();
333  nxgetslab(handle,start,size,bdata);
334  array = ha.arrayify(bdata);
335  }catch(HDFException he) {
336  throw new NexusException(he.getMessage());
337  }
338  }
339 
340  public void getslab(long start[], long size[], Object array) throws NexusException {
341  byte bdata[];
342  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
343  checkForNull(start, size, array);
344  checkForNegInArray(false, start, size);
345  try{
346  HDFArray ha = new HDFArray(array);
347  bdata = ha.emptyBytes();
348  nxgetslab64(handle,start,size,bdata);
349  array = ha.arrayify(bdata);
350  }catch(HDFException he) {
351  throw new NexusException(he.getMessage());
352  }
353  }
354 
355  public void getattr(String name, Object array, int args[]) throws NexusException {
356  byte bdata[];
357  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
358  checkType(args[1]);
359  checkForNull(name, array);
360  try{
361  HDFArray ha = new HDFArray(array);
362  bdata = ha.emptyBytes();
363  nxgetattr(handle, name, bdata,args);
364  array = ha.arrayify(bdata);
365  }catch(HDFException he) {
366  throw new NexusException(he.getMessage());
367  }
368  }
369 
370  // data set writing
371  // native methods for this section
372  protected native void nxputdata(int handle, byte array[]);
373  protected native void nxputslab(int handle, byte array[], int start[], int size[]);
374  protected native void nxputslab64(int handle, byte array[], long start[], long size[]);
375  protected native void nxputattr(int handle, String name, byte array[], int type);
376 
377  public void putdata(Object array) throws NexusException {
378  byte data[];
379 
380  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
381  checkForNull(array);
382 
383  try {
384  HDFArray ha = new HDFArray(array);
385  data = ha.byteify();
386  ha = null;
387  } catch (HDFException he) {
388  throw new NexusException(he.getMessage());
389  }
390  nxputdata(handle,data);
391  data = null;
392  }
393 
394  public void putslab(Object array, int start[], int size[]) throws NexusException {
395  byte data[];
396 
397  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
398  checkForNull(array, start, size);
399  checkForNegInArray(false, start, size);
400  try {
401  HDFArray ha = new HDFArray(array);
402  data = ha.byteify();
403  ha = null;
404  } catch(HDFException he) {
405  throw new NexusException(he.getMessage());
406  }
407  nxputslab(handle,data,start,size);
408  data = null;
409  }
410 
411  public void putslab(Object array, long start[], long size[]) throws NexusException {
412  byte data[];
413 
414  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
415  checkForNull(array, start, size);
416  checkForNegInArray(false, start, size);
417  try {
418  HDFArray ha = new HDFArray(array);
419  data = ha.byteify();
420  ha = null;
421  } catch(HDFException he) {
422  throw new NexusException(he.getMessage());
423  }
424  nxputslab64(handle,data,start,size);
425  data = null;
426  }
427 
428  public void putattr(String name, Object array, int iType) throws NexusException {
429  byte data[];
430 
431  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
432  checkType(iType);
433  checkForNull(name, array);
434  try{
435  HDFArray ha = new HDFArray(array);
436  data = ha.byteify();
437  ha = null;
438  }catch(HDFException he) {
439  throw new NexusException(he.getMessage());
440  }
441  nxputattr(handle,name,data,iType);
442  data = null;
443  }
444 
445  // inquiry
446  //native methods for this section
447  protected native void nxgetinfo(int handle, int iDim[], int args[]);
448  protected native void nxgetinfo64(int handle, long iDim[], int args[]);
449  protected native void nxsetnumberformat(int handle, int type,
450  String format);
451  protected native int nextentry(int handle, String names[]);
452  protected native int nextattr(int handle, String names[], int args[]);
453  protected native void initattrdir(int handle);
454  protected native void initgroupdir(int handle);
455 
456  public void setnumberformat(int type, String format) throws NexusException {
457  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
458  checkType(type);
459  checkForNull(format);
460  nxsetnumberformat(handle,type,format);
461  }
462 
463  public void getinfo(int iDim[], int args[]) throws NexusException {
464  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
465  nxgetinfo(handle,iDim,args);
466  }
467 
468  public void getinfo(long iDim[], int args[]) throws NexusException {
469  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
470  nxgetinfo64(handle,iDim,args);
471  }
472 
473  public Hashtable groupdir() throws NexusException {
474  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
475  Hashtable h = new Hashtable();
476  String names[] = new String[2];
477 
479  while(nextentry(handle,names) != -1) {
480  h.put(names[0],names[1]);
481  }
482  return h;
483  }
484 
485  public Hashtable attrdir()throws NexusException {
486  int args[] = new int[2];
487  AttributeEntry at;
488  String names[] = new String[1];
489 
490  Hashtable h = new Hashtable();
491  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
493  while(nextattr(handle,names,args) != -1)
494  {
495  at = new AttributeEntry();
496  at.length = args[0];
497  at.type = args[1];
498  h.put(names[0], at);
499  }
500  return h;
501  }
502 
503  // linking
504  // native methods for this section
505  protected native void nxgetgroupid(int handle, NXlink link);
506  protected native void nxgetdataid(int handle, NXlink link);
507  protected native void nxmakelink(int handle, NXlink target);
508  protected native void nxmakenamedlink(int handle, String name, NXlink target);
509  protected native void nxopensourcepath(int handle);
510 
511  public NXlink getgroupID() throws NexusException {
512  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
513  NXlink l = new NXlink();
514  nxgetgroupid(handle,l);
515  return l;
516  }
517 
518  public NXlink getdataID()throws NexusException {
519  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
520  NXlink l = new NXlink();
521  nxgetdataid(handle,l);
522  return l;
523  }
524 
525  public void makelink(NXlink target) throws NexusException {
526  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
527  checkForNull(target);
528  nxmakelink(handle, target);
529  }
530 
531  public void makenamedlink(String name, NXlink target) throws NexusException {
532  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
533  checkForNull(name, target);
534  nxmakenamedlink(handle, name, target);
535  }
536 
537  public void opensourcepath() throws NexusException {
538  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
540  }
541 
546  private void checkForNull(Object... args) {
547  for (Object o : args)
548  if (o==null) throw new NullPointerException();
549  }
550 
555  private void checkForNegInArray(boolean allowUnlimited, int[]... args) {
556  for (int[] array : args)
557  for (int value: array) {
558  if (value<0)
559  if (value == this.NX_UNLIMITED && allowUnlimited) {
560  // all ok this time
561  } else
562  throw new IllegalArgumentException("negative dimension received");
563  }
564  }
565 
570  private void checkForNegInArray(boolean allowUnlimited, long[]... args) {
571  for (long[] array : args)
572  for (long value: array) {
573  if (value<0)
574  if (value == this.NX_UNLIMITED && allowUnlimited) {
575  // all ok this time
576  } else
577  throw new IllegalArgumentException("negative dimension received");
578  }
579  }
580 
587  private void checkType(int type) throws NexusException {
588  switch(type) {
589  case NexusFile.NX_FLOAT32:
590  case NexusFile.NX_FLOAT64:
591  case NexusFile.NX_INT8:
592  case NexusFile.NX_UINT8:
593  case NexusFile.NX_INT16:
594  case NexusFile.NX_UINT16:
595  case NexusFile.NX_INT32:
596  case NexusFile.NX_UINT32:
597  case NexusFile.NX_INT64:
598  case NexusFile.NX_UINT64:
599  case NexusFile.NX_CHAR:
600  break;
601  default:
602  throw new NexusException("Illegal number type requested");
603  }
604  }
605 
606  // external file interface
607  // native methods for this section
608  protected native void nxinquirefile(int handle, String names[]);
609  protected native void nxlinkexternal(int handle, String name, String nxclass, String nxurl);
610  protected native void nxlinkexternaldataset(int handle, String name, String nxurl);
611  protected native int nxisexternalgroup(int handle, String name, String nxclass, String nxurl[]);
612  protected native int nxisexternaldataset(int handle, String name, String nxurl[]);
613 
614  public String inquirefile() throws NexusException {
615  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
616  String names[] = new String[1];
617  nxinquirefile(handle,names);
618  return names[0];
619  }
620 
621  public void linkexternal(String name, String nxclass, String nxurl) throws NexusException {
622  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
623  checkForNull(name, nxclass, nxurl);
624  nxlinkexternal(handle,name,nxclass,nxurl);
625  }
626 
627  public void linkexternaldataset(String name, String nxurl) throws NexusException {
628  if(handle < 0) throw new NexusException("NAPI-ERROR: File not open");
629  checkForNull(name, nxurl);
630  nxlinkexternaldataset(handle,name,nxurl);
631  }
632 
633  public String isexternalgroup(String name, String nxclass) throws NexusException {
634  if (handle < 0) throw new NexusException("NAPI-ERROR: File not open");
635  checkForNull(name, nxclass);
636  String nxurl[] = new String[1];
637 
638  int status = nxisexternalgroup(handle,name,nxclass,nxurl);
639  if (status == 1) {
640  return nxurl[0];
641  } else {
642  return null;
643  }
644  }
645 
646  public String isexternaldataset(String name) throws NexusException {
647  if (handle < 0) throw new NexusException("NAPI-ERROR: File not open");
648  checkForNull(name);
649  String nxurl[] = new String[1];
650 
651  int status = nxisexternaldataset(handle,name,nxurl);
652  if (status == 1) {
653  return nxurl[0];
654  } else {
655  return null;
656  }
657  }
658 
668  public native void debugstop();
669 }
native void nxclosedata(int handle)
void putdata(Object array)
putdata writes the data from array into a previously opened dataset.
Definition: NexusFile.java:377
void getattr(String name, Object array, int args[])
getattr retrieves the data associated with the attribute name.
Definition: NexusFile.java:355
void putslab(Object array, int start[], int size[])
putslab writes a subset of a larger dataset to a previously opened dataset.
Definition: NexusFile.java:394
static final int NXACC_NOSTRIP
Definition: NexusFile.java:36
static final int MAXNAMELEN
Maximum name length, must be VGNAMELENMAX in hlimits.h.
Definition: NexusFile.java:72
void compmakedata(String name, int type, int rank, long dim[], int compression_type, long iChunk[])
compmakedata creates a new dataset with the specified characteristics in the current group...
Definition: NexusFile.java:243
void getinfo(long iDim[], int args[])
getinfo retrieves information about a previously opened dataset.
Definition: NexusFile.java:468
void compmakedata(String name, int type, int rank, int dim[], int compression_type, int iChunk[])
compmakedata creates a new dataset with the specified characteristics in the current group...
Definition: NexusFile.java:226
static final int NX_COMP_RLE
Definition: NexusFile.java:66
void openpath(String path)
openpath opens groups and datsets accroding to the path string given.
Definition: NexusFile.java:194
static final int NX_BINARY
Definition: NexusFile.java:50
native void nxmakedata64(int handle, String name, int type, int rank, long dim[])
static final int NX_INT32
Definition: NexusFile.java:55
static final int NXACC_RDWR
Definition: NexusFile.java:31
void opengroup(String name, String nxclass)
opengroup opens the group name with class nxclass.
Definition: NexusFile.java:188
void makelink(NXlink target)
makelink links the object described by target into the current vGroup.
Definition: NexusFile.java:525
static final int NX_INT64
Definition: NexusFile.java:57
native void nxopengroup(int handle, String name, String nxclass)
void flush()
flushes all pending data to disk.
Definition: NexusFile.java:142
native void initgroupdir(int handle)
static final int NX_UINT32
Definition: NexusFile.java:56
native int nxisexternalgroup(int handle, String name, String nxclass, String nxurl[])
static final int NXACC_CREATE5
Definition: NexusFile.java:34
static final int NXACC_READ
possible access codes,
Definition: NexusFile.java:30
void putslab(Object array, long start[], long size[])
putslab writes a subset of a larger dataset to a previously opened dataset.
Definition: NexusFile.java:411
String inquirefile()
inquirefile inquires which file we are currently in.
Definition: NexusFile.java:614
native int nextentry(int handle, String names[])
void closedata()
closedata closes an opened dataset.
Definition: NexusFile.java:284
static final int NX_UINT64
Definition: NexusFile.java:58
native void nxopendata(int handle, String name)
Hashtable groupdir()
groupdir will retrieve the content of the currently open vGroup.
Definition: NexusFile.java:473
static final int NXACC_CREATE4
Definition: NexusFile.java:33
static final int NX_COMP_NONE
constants for compression schemes
Definition: NexusFile.java:64
void makedata(String name, int type, int rank, long dim[])
makedata creates a new dataset with the specified characteristics in the current group.
Definition: NexusFile.java:269
String isexternaldataset(String name)
nxisexternaldataset if the named dataset is is linked externally
Definition: NexusFile.java:646
void makegroup(String name, String nxclass)
makegroup creates a new group below the current group within the NeXus file hierarchy.
Definition: NexusFile.java:182
native void nxputslab64(int handle, byte array[], long start[], long size[])
void close()
close the NeXus file.
Definition: NexusFile.java:151
native void nxputslab(int handle, byte array[], int start[], int size[])
void opengrouppath(String path)
opengrouppath opens groups and datsets accroding to the path string given.
Definition: NexusFile.java:200
void getdata(Object array)
getdata reads the data from an previously openend dataset into array.
Definition: NexusFile.java:311
native void nxopengrouppath(int handle, String path)
void getslab(long start[], long size[], Object array)
getslab reads a subset of a large dataset into array.
Definition: NexusFile.java:340
void makenamedlink(String name, NXlink target)
makenamedlink links the object described by target into the current vGroup.
Definition: NexusFile.java:531
int handle
This is the handle to the NeXus file handle.
Definition: NexusFile.java:103
native void debugstop()
debugstop is a debugging helper function which goes into an endless loop in the dynamic link library...
String getpath()
return the current path into the NeXus file in the form of a Unix path string.
Definition: NexusFile.java:206
void closegroup()
closegroup closes access to the current group and steps down one step in group hierarchy.
Definition: NexusFile.java:211
native void nxmakecompdata(int handle, String name, int type, int rank, int dim[], int iCompress, int iChunk[])
native void nxlinkexternal(int handle, String name, String nxclass, String nxurl)
native void nxclosegroup(int handle)
native void nxlinkexternaldataset(int handle, String name, String nxurl)
native void nxmakelink(int handle, NXlink target)
static final int NX_FLOAT32
constants for number types.
Definition: NexusFile.java:47
static final int NX_UNLIMITED
constant denoting an unlimited dimension.
Definition: NexusFile.java:41
void finalize()
removes all NeXus file data structures and closes the file.
Definition: NexusFile.java:168
native void nxputdata(int handle, byte array[])
void makedata(String name, int type, int rank, int dim[])
makedata creates a new dataset with the specified characteristics in the current group.
Definition: NexusFile.java:260
native void nxgetdata(int handle, byte bdata[])
static final int NXACC_CREATE
Definition: NexusFile.java:32
native void nxopenpath(int handle, String path)
static final int NX_UINT8
Definition: NexusFile.java:51
native void nxgetinfo(int handle, int iDim[], int args[])
void setnumberformat(int type, String format)
setnumberformat sets the number format for printing number when using the XML-NeXus format...
Definition: NexusFile.java:456
native void nxmakedata(int handle, String name, int type, int rank, int dim[])
This is a class for handling multidimensional arrays for HDF.
Definition: HDFArray.java:29
void getinfo(int iDim[], int args[])
getinfo retrieves information about a previously opened dataset.
Definition: NexusFile.java:463
native int nxflush(int handle)
native int init(String filename, int access)
static final int NX_COMP_HUF
Definition: NexusFile.java:67
static final int NX_BOOLEAN
Definition: NexusFile.java:52
NXlink getdataID()
getdataID gets the data necessary for linking the current dataset somewhere else. ...
Definition: NexusFile.java:518
static final int NX_INT16
Definition: NexusFile.java:53
native void nxputattr(int handle, String name, byte array[], int type)
native void nxmakenamedlink(int handle, String name, NXlink target)
native void nxgetattr(int handle, String name, byte bdata[], int args[])
NXlink getgroupID()
getgroupID gets the data necessary for linking the current vGroup somewhere else. ...
Definition: NexusFile.java:511
native void nxgetslab64(int handle, long Start[], long size[], byte bdata[])
void compress(int compression_type)
causes the currently open dataset to be compressed on file.
Definition: NexusFile.java:289
native void nxmakecompdata64(int handle, String name, int type, int rank, long dim[], int iCompress, long iChunk[])
void opensourcepath()
opensourcepath opens the group from which the current item was linked Returns an error if the current...
Definition: NexusFile.java:537
native void nxgetinfo64(int handle, long iDim[], int args[])
void opendata(String name)
opendata opens an existing dataset for access.
Definition: NexusFile.java:278
String isexternalgroup(String name, String nxclass)
nxisexternalgroup test the group name, nxclass if it is linked externally
Definition: NexusFile.java:633
native void nxcompress(int handle, int compression_type)
void linkexternaldataset(String name, String nxurl)
linkexternaldataset links dataset name to the URL nxurl
Definition: NexusFile.java:627
static final int NX_UINT16
Definition: NexusFile.java:54
static final int NX_COMP_LZW
Definition: NexusFile.java:65
void linkexternal(String name, String nxclass, String nxurl)
linkexternal links group name, nxclass to the URL nxurl
Definition: NexusFile.java:621
NexusFile(String filename, int access)
constructs a new NexusFile Object.
Definition: NexusFile.java:130
native void nxmakegroup(int handle, String name, String nxclass)
native void nxinquirefile(int handle, String names[])
native void nxgetslab(int handle, int Start[], int size[], byte bdata[])
static final int NX_FLOAT64
Definition: NexusFile.java:48
static final int NX_INT8
Definition: NexusFile.java:49
native void nxopensourcepath(int handle)
native String nxgetpath(int handle)
void putattr(String name, Object array, int iType)
putattr adds a named attribute to a previously opened dataset or a global attribute if no dataset is ...
Definition: NexusFile.java:428
native int nextattr(int handle, String names[], int args[])
native void nxsetnumberformat(int handle, int type, String format)
static final int NXACC_CREATEXML
Definition: NexusFile.java:35
void getslab(int start[], int size[], Object array)
getslab reads a subset of a large dataset into array.
Definition: NexusFile.java:325
native int nxisexternaldataset(int handle, String name, String nxurl[])
native void nxgetgroupid(int handle, NXlink link)
Hashtable attrdir()
attrdir returns the attributes of the currently open dataset or the file global attributes if no data...
Definition: NexusFile.java:485
native void initattrdir(int handle)
native void nxgetdataid(int handle, NXlink link)
static final int NX_CHAR
Definition: NexusFile.java:59