Hello HDF developer, Sorry, but I am not coding in Java – merely I am doing it in C. But for HDF5 strings are variable length / derived data types.
See here: http://www.hdfgroup.org/HDF5/Tutor/crtdat.html#datatypes And here: http://www.hdfgroup.org/HDF5/doc/RM/RM_H5T.html#CreateVLString Someone might have had strings in mind as an Java API level extension – maybe it is not yet realized. There might be an option going for fixed length strings – but indeed that might waste your storage. On the other hand fixed length strings might be faster than variable lengths ones – but that is only a wild guess from me. Regards, Alex. Von: Hdf-forum [mailto:[email protected]] Im Auftrag von Hdfdev Hdfdev Gesendet: Sonntag, 19. Oktober 2014 23:32 An: HDF Users Discussion List Betreff: [Hdf-forum] How to Write String Object to HDF5? Hello. I am new to HDF5 and I would really appreciate if somebody can help me finding correct approach for the following. How to write String Object to HDF5 file using native HDF5 java library? What I am trying? According to Javadoc java.lang.String is mapped to H5T_C_S1 constant and I am using it in the following form: <see screen shot> private int createDataspace() throws HDF5LibraryException, HDF5Exception { return H5.H5Screate_simple(3, new long[]{3, 3, 1}, null); } private int createDataset(int fileId, String datasetName) throws HDF5LibraryException, HDF5Exception { return H5.H5Dcreate(datasetName, HDF5Constants.H5T_C_S1, createDataspace(), HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } private int writeDataset(String fileName, String datasetName, String[][] table) throws HDF5LibraryException, HDF5Exception { int datasetId = -1; int returnCode = H5.H5Dwrite(datasetId = createDataset(fileId , datasetName), HDF5Constants.H5T_C_S1, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, table); H5.H5Dclose(datasetId); H5.H5Fclose(fileId); return returnCode; } And it throws following exception: Exception in thread "main" ncsa.hdf.hdf5lib.exceptions.HDF5JavaException: ArrayDesciptor: Error: String array not supported yet at ncsa.hdf.hdf5lib.ArrayDescriptor.<init>(HDFArray.java:1030) at ncsa.hdf.hdf5lib.HDFArray.<init>(HDFArray.java:68) at ncsa.hdf.hdf5lib.H5.H5Dwrite(H5.java:1971) at ncsa.hdf.hdf5lib.H5.H5Dwrite(H5.java:1883) Thank you.
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://mail.lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
