storing a string dataset in HDF5 using Java

(writing both to the forum & helpdesk, since the mailing list seems to
be down or in flux)

I have a set of C++ classes that creates an HDF5 file, and I am trying
to replace them (for maintainability & other reasons) with Java. I can't
figure out the right way in Java to read a file and store the results in
the HDF5 file as a compressed string, though. Here's what "h5ls -v -r"
shows for this dataset that I have created in C++:

/foo/bar/baz/ESPDF Dataset {1/1}
    Location: 1:10744
    Links: 1
    Chunks: {1} 2656 bytes
    Storage: 2656 logical bytes, 626 allocated bytes, 424.28%
    Filter-0: deflate-1 OPT {9}
    Type: 2656-byte null-terminated ASCII string

and here's my attempt at doing something like this in Java:

    Group g;
    FileChannel fileChannel;
    ByteBuffer bbuf;
    int x;

    /* ... successfully-running (but not-very-relevant) code
            which sets up g, fileChannel and bbuf,
    and counts the size of the input file with the result in
    The value of "x" could be large so I want to be able to
write the HDF5
    dataset in smaller pieces rather than one big monolithic
chunk. */

    long dims[] = {x};
    long maxdims[] = dims;
    long chunks[] = {1};
    int gzip = 9;

    // these following two lines are essentially verbatim
    int tid = H5.H5Tcopy( HDF5Constants.H5T_C_S1);
    H5.H5Tset_size(tid, x);
    Datatype dtype = new H5Datatype(tid);
    FileFormat ff = g.getFileFormat();
    ncsa.hdf.object.Dataset ds = ff.createScalarDS(
        "ESPDF", g, dtype, dims, maxdims,
chunks, gzip, null);
    while ( >= 0)

      /* do something here to write the dataset to the
HDF5 file.
                     What? ds.write seems to expect
             an array of Java strings, which makes no
sense. */




from my C++ program


This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.

Hdf-forum is for HDF software users discussion.