diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2018-06-27 22:53:30 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2018-06-27 22:53:47 (GMT) |
commit | 792771d52a710d45a2c788a13300067734962adf (patch) | |
tree | ac03f03b5725ff66b87e8649f93564d429ef61cc /java/src/hdf | |
parent | 4095b9260d5c24f65b1e57a1617f561415e8f05f (diff) | |
download | hdf5-792771d52a710d45a2c788a13300067734962adf.zip hdf5-792771d52a710d45a2c788a13300067734962adf.tar.gz hdf5-792771d52a710d45a2c788a13300067734962adf.tar.bz2 |
Update Java util lib, Refactor H5D write VL to match read
Diffstat (limited to 'java/src/hdf')
-rw-r--r-- | java/src/hdf/hdf5lib/H5.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index f826fbc..4060ca9 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -1752,14 +1752,8 @@ public class H5 implements java.io.Serializable { (String[]) obj); } else if (is1D && (dataClass.getComponentType() == String.class)) { - log.trace("H5Dread_string type"); - if (H5.H5Tis_variable_str(mem_type_id)) { - status = H5Dread_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); - } - else { - status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (String[]) obj); - } + log.trace("H5DreadVL type"); + status = H5DreadVL(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); } else { // Create a data buffer to hold the data into a Java Array @@ -1979,7 +1973,7 @@ public class H5 implements java.io.Serializable { Class dataClass = obj.getClass(); if (!dataClass.isArray()) { - throw (new HDF5JavaException("H5Dread: data is not an array")); + throw (new HDF5JavaException("H5Dwrite: data is not an array")); } String cname = dataClass.getName(); @@ -2011,14 +2005,8 @@ public class H5 implements java.io.Serializable { (double[]) obj, isCriticalPinning); } else if (is1D && (dataClass.getComponentType() == String.class)) { - log.trace("H5Dwrite_string type"); - if (H5.H5Tis_variable_str(mem_type_id)) { - status = H5Dwrite_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); - } - else { - status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (String[]) obj); - } + log.trace("H5DwriteVL type"); + status = H5DwriteVL(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); } else { HDFArray theArray = new HDFArray(obj); @@ -2084,6 +2072,9 @@ public class H5 implements java.io.Serializable { public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5DwriteVL(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + /** * H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from * the application memory buffer buf into the file. |