On 28 Mar, 2011, at 19:11 , Peter Cao wrote:

> Try this:
> 
> ===============
>        // open the file and the dataset with refs
>        file.open();
>        ds = (H5ScalarDS)file.get(dname);
>         long[] refs = (long[])ds.getData();
> 
>         // use low level API function, H5.H5Rget_name
>           String[] name = {""};;
>         for (int i=0; i<refs.length; i++) {
>             H5.H5Rget_name(file.getFID(), HDF5Constants.H5R_OBJECT, 
> HDFNativeData.longToByte(refs[i]), name, 32);
>            System.out.println(name[0]);
>        }
> 
>         // if file.open() was called, search objects in memory by high level 
> function, findObject()
>        long[] oid = new long[1];
>        for (int i=0; i<refs.length; i++) {
>            oid[0] = refs[i];
>             HObject obj = FileFormat.findObject(file, oid);
>            System.out.println(obj.getFullName());
>        }
> ==============

I am now at the point where I would like to write reference attributes as well. 
But what do I supply as the attribute value? I first tried to provide the 
objects themselves, but that results in invalid references. A look at the 
source code (H5File.java) shows that there is a special case for a single 
reference which can be supplied as a string (path to the object). So I tried an 
array of strings, but that also leads to invalid references. Do I have to use 
the low-level routines again for some conversion?

Konrad.
--
---------------------------------------------------------------------
Konrad Hinsen
Centre de Biophysique Moléculaire, CNRS Orléans
Synchrotron Soleil - Division Expériences
Saint Aubin - BP 48
91192 Gif sur Yvette Cedex, France
Tel. +33-1 69 35 97 15
E-Mail: research AT khinsen DOT fastmail DOT net
---------------------------------------------------------------------




_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org

Reply via email to