You should be able to find C examples at
http://www.hdfgroup.org/ftp/HDF5/examples/examples-by-api/
Thanks
--pc
Stamminger, Johannes wrote:
Hi there,
I try to get up and running with the hdf and especially I plan to write
large amount of varying length data to hdf5 files from a java
application. I want to make use of the H5PT api and unfortunately
noticed that this currently seems not to be exposed in the hdf-java
2.6.1.
So to avoid the mess with JNI I try to access the H5PT using jna
(https://jna.dev.java.net/) - and in principe this seems to work. At
least I got a very simple example to work:
public void testHdfJna() throws Exception {
final int h5fileId = Hdf5Hl.H5Fcreate(
new File(getCurrentTestDir(), "hdf.h5").toString(),
HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
final int strTypeId = Hdf5Hl.H5Tcopy (HDF5Constants.H5T_C_S1);
Hdf5Hl.H5Tset_size (strTypeId, HDF5Constants.H5T_VARIABLE);
final int vlTableId = Hdf5Hl.H5PTcreate_fl(
h5fileId, "Test VL Dataset", strTypeId, 10L, -1);
final String p1 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
final String p2 = "bbbbbbbbbbbbbbbbbbbbbbbbb";
// hdf5Hl.H5PTappend(vlTableId, 2, ???);
Hdf5Hl.H5PTclose(vlTableId);
Hdf5Hl.H5Fclose(h5fileId);
}
The resulting hdf file looks as expected - at least to me:
hdf.h5" {
GROUP "/" {
DATASET "Test VL Dataset" {
DATATYPE H5T_STRING {
STRSIZE H5T_VARIABLE;
STRPAD H5T_STR_NULLTERM;
CSET H5T_CSET_ASCII;
CTYPE H5T_C_S1;
}
DATASPACE SIMPLE { ( 0 ) / ( H5S_UNLIMITED ) }
DATA {
}
}
}
}
I'm now stuck with writing the concrete varying length strings, p1 and
p2 in the example code. Does anyone can provide me the lines of code as
one would write them in plain C to achieve this? I do not find a
suitable example ...
Best regards,
Johannes Stamminger
------------------------------------------------------------------------
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://mail.hdfgroup.org/mailman/listinfo/hdf-forum_hdfgroup.org