summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-11-07 15:48:56 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-11-07 15:49:11 (GMT)
commit6b927a773c83bedc111dcd2ad38805f974660b15 (patch)
tree5f836ff5409d5265161b058e75f4d806c8afff1d /java
parent2dd5bbfe167e3e9b6b6ee657a882e24072de4aeb (diff)
downloadhdf5-6b927a773c83bedc111dcd2ad38805f974660b15.zip
hdf5-6b927a773c83bedc111dcd2ad38805f974660b15.tar.gz
hdf5-6b927a773c83bedc111dcd2ad38805f974660b15.tar.bz2
HDFFV-10876 Update h5dump and h5ls for new ref api.
Diffstat (limited to 'java')
-rw-r--r--java/src/hdf/hdf5lib/H5.java331
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java22
-rw-r--r--java/src/jni/h5Constants.c14
-rw-r--r--java/src/jni/h5pFAPLImp.c10
-rw-r--r--java/src/jni/h5rImp.c593
-rw-r--r--java/src/jni/h5rImp.h130
-rw-r--r--java/src/jni/h5sImp.c6
-rw-r--r--java/src/jni/h5sImp.h6
-rw-r--r--java/src/jni/h5tImp.c6
-rw-r--r--java/src/jni/h5tImp.h4
-rw-r--r--java/src/jni/h5util.c281
-rw-r--r--java/src/jni/h5util.h1
-rw-r--r--java/test/TestH5.java143
-rw-r--r--java/test/TestH5Edefault.java2
-rw-r--r--java/test/TestH5R.java371
-rw-r--r--java/test/testfiles/JUnit-TestH5R.txt24
16 files changed, 1800 insertions, 144 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 09fb223..01c18dc 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -1107,7 +1107,9 @@ public class H5 implements java.io.Serializable {
log.trace("H5Aread_dname_D");
status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
}
- else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
+ else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) &&
+ (is1D && (dataClass.getComponentType() == String.class))) ||
+ H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
log.trace("H5Aread_reg_ref");
status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj);
}
@@ -2005,7 +2007,9 @@ public class H5 implements java.io.Serializable {
status = H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(double[]) obj, isCriticalPinning);
}
- else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
+ else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) &&
+ (is1D && (dataClass.getComponentType() == String.class))) ||
+ H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
log.trace("H5Dread_reg_ref");
status = H5Dread_reg_ref(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id,
(String[]) obj);
@@ -8095,6 +8099,325 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
+ // H5R: HDF5 1.12 Reference API Functions //
+ // //
+ // ////////////////////////////////////////////////////////////
+
+ // Constructors //
+
+ /**
+ * H5Rcreate_object creates a reference pointing to the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_object(long loc_id, String name)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcreate_region creates the reference, pointing to the region represented by
+ * space id within the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ * @param space_id
+ * IN: Identifies the dataset region that a dataset region reference points to.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_region(long loc_id, String name, long space_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcreate_attr creates the reference, pointing to the attribute named attr name
+ * and attached to the object named name located at loc id.
+ *
+ * @param loc_id
+ * IN: Location identifier used to locate the object being pointed to.
+ * @param name
+ * IN: Name of object at location loc_id.
+ * @param attr_name
+ * IN: Name of the attribute within the object.
+ *
+ * @return the reference (byte[]) if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcreate_attr(long loc_id, String name, String attr_name)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rdestroy destroys a reference and releases resources.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native void H5Rdestroy(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Info //
+
+ /**
+ * H5Rget_type retrieves the type of a reference.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return a valid reference type if successful; otherwise returns H5R UNKNOWN.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native int H5Rget_type(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Requal determines whether two references point to the same object, region or attribute.
+ *
+ * @param ref1_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param ref2_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return true if equal, else false
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native boolean H5Requal(byte[] ref1_ptr, byte[] ref2_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rcopy creates a copy of an existing reference.
+ *
+ * @param src_ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return a valid copy of the reference (byte[]) if successful.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native byte[] H5Rcopy(byte[] src_ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Dereference //
+
+ /**
+ * H5Ropen_object opens that object and returns an identifier.
+ * The object opened with this function should be closed when it is no longer needed
+ * so that resource leaks will not develop. Use the appropriate close function such
+ * as H5Oclose or H5Dclose for datasets.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param oapl_id
+ * IN: An object access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Ropen region creates a copy of the dataspace of the dataset pointed to by a region reference,
+ * ref ptr, and defines a selection matching the selection pointed to by ref ptr within the dataspace copy.
+ * Use H5Sclose to release the dataspace identifier returned by this function when the identifier is no longer needed.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param oapl_id
+ * IN: An object access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid dataspace identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Ropen_attr opens the attribute attached to the object and returns an identifier.
+ * The attribute opened with this function should be closed with H5Aclose when it is no longer needed
+ * so that resource leaks will not develop.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ * @param aapl_id
+ * IN: An attribute access property list identifier for the reference. The access property
+ * property list must be of the same type as the object being referenced,
+ * that is a group or dataset property list.
+ *
+ * @return a valid attribute identifier if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - an input array is null.
+ * @exception IllegalArgumentException
+ * - an input array is invalid.
+ **/
+ public synchronized static native long H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Get type //
+
+ /**
+ * H5Rget obj type3 retrieves the type of the referenced object pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ *
+ * @return Returns the object type
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native int H5Rget_obj_type3(byte[] ref_ptr, long rapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // Get name //
+
+ /**
+ * H5Rget_file_name retrieves the file name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return Returns the file name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_file_name(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rget_obj_name retrieves the object name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ * @param rapl_id
+ * IN: A reference access property list identifier for the reference. The access property
+ * list can be used to access external files that the reference points
+ * to (through a file access property list).
+ *
+ * @return Returns the object name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_obj_name(byte[] ref_ptr, long rapl_id)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ /**
+ * H5Rget_attr_name retrieves the attribute name for the object, region or attribute reference pointed to.
+ *
+ * @param ref_ptr
+ * IN: Reference to an object, region or attribute attached to an object.
+ *
+ * @return Returns the attribute name of the reference
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - array is null.
+ * @exception IllegalArgumentException
+ * - array is invalid.
+ **/
+ public synchronized static native String H5Rget_attr_name(byte[] ref_ptr)
+ throws HDF5LibraryException, NullPointerException, IllegalArgumentException;
+
+ // ////////////////////////////////////////////////////////////
+ // //
// H5R: HDF5 1.8 Reference API Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -10328,14 +10651,12 @@ public class H5 implements java.io.Serializable {
* @param buf
* Buffer with data to be reclaimed.
*
- * @return a non-negative value if successful
- *
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - buf is null.
**/
- public synchronized static native int H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
+ public synchronized static native void H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf)
throws HDF5LibraryException, NullPointerException;
/**
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index f5be38d..4aeeb98 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -407,11 +407,18 @@ public class HDF5Constants {
public static final int H5PL_VOL_PLUGIN = H5PL_VOL_PLUGIN();
public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN();
+ public static final int H5R_ATTR = H5R_ATTR();
public static final int H5R_BADTYPE = H5R_BADTYPE();
public static final int H5R_DATASET_REGION = H5R_DATASET_REGION();
+ public static final int H5R_DATASET_REGION1 = H5R_DATASET_REGION1();
+ public static final int H5R_DATASET_REGION2 = H5R_DATASET_REGION2();
public static final int H5R_MAXTYPE = H5R_MAXTYPE();
+ public static final int H5R_REF_BUF_SIZE = H5R_REF_BUF_SIZE();
public static final int H5R_OBJ_REF_BUF_SIZE = H5R_OBJ_REF_BUF_SIZE();
public static final int H5R_OBJECT = H5R_OBJECT();
+ public static final int H5R_OBJECT1 = H5R_OBJECT1();
+ public static final int H5R_OBJECT2 = H5R_OBJECT2();
+
public static final int H5S_ALL = H5S_ALL();
public static final int H5S_MAX_RANK = H5S_MAX_RANK();
public static final int H5S_NO_CLASS = H5S_NO_CLASS();
@@ -606,6 +613,7 @@ public class HDF5Constants {
public static final long H5T_STD_I8LE = H5T_STD_I8LE();
public static final long H5T_STD_REF_DSETREG = H5T_STD_REF_DSETREG();
public static final long H5T_STD_REF_OBJ = H5T_STD_REF_OBJ();
+ public static final long H5T_STD_REF = H5T_STD_REF();
public static final long H5T_STD_U16BE = H5T_STD_U16BE();
public static final long H5T_STD_U16LE = H5T_STD_U16LE();
public static final long H5T_STD_U32BE = H5T_STD_U32BE();
@@ -1420,16 +1428,28 @@ public class HDF5Constants {
private static native final int H5PL_VOL_PLUGIN();
+ private static native final int H5R_ATTR();
+
private static native final int H5R_BADTYPE();
private static native final int H5R_DATASET_REGION();
+ private static native final int H5R_DATASET_REGION1();
+
+ private static native final int H5R_DATASET_REGION2();
+
private static native final int H5R_MAXTYPE();
+ private static native final int H5R_REF_BUF_SIZE();
+
private static native final int H5R_OBJ_REF_BUF_SIZE();
private static native final int H5R_OBJECT();
+ private static native final int H5R_OBJECT1();
+
+ private static native final int H5R_OBJECT2();
+
private static native final int H5S_ALL();
private static native final int H5S_MAX_RANK();
@@ -1818,6 +1838,8 @@ public class HDF5Constants {
private static native final long H5T_STD_REF_OBJ();
+ private static native final long H5T_STD_REF();
+
private static native final long H5T_STD_U16BE();
private static native final long H5T_STD_U16LE();
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index 69adebd..05dc2ea 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -813,13 +813,25 @@ Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_REF_BUF_SIZE; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1ATTR(JNIEnv *env, jclass cls) { return H5R_ATTR; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; }
JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT1(JNIEnv *env, jclass cls) { return H5R_OBJECT1; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT2(JNIEnv *env, jclass cls) { return H5R_OBJECT2; }
+JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION1(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION1; }
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION2(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION2; }
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; }
@@ -1211,6 +1223,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) {
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; }
JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF(JNIEnv *env, jclass cls) { return H5T_STD_REF; }
+JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; }
JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; }
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
index 006707a..a627e65 100644
--- a/java/src/jni/h5pFAPLImp.c
+++ b/java/src/jni/h5pFAPLImp.c
@@ -425,6 +425,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1hdfs
CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_hdfs_fapl_t", "(Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;I)V", args, ret_obj);
#else
+ UNUSED(fapl_id);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_hdfs: not implemented");
#endif /* H5_HAVE_LIBHDFS */
@@ -532,6 +534,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1hdfs
if (H5Pset_fapl_hdfs((hid_t)fapl_id, &instance) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#else
+ UNUSED(fapl_id);
+ UNUSED(fapl_config);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_hdfs: not implemented");
#endif /* H5_HAVE_LIBHDFS */
@@ -841,6 +846,8 @@ Java_hdf_hdf5lib_H5_H5Pget_1fapl_1ros3
CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5FD_ros3_fapl_t", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V", args, ret_obj);
#else
+ UNUSED(fapl_id);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pget_fapl_ros3: not implemented");
#endif /* H5_HAVE_ROS3_VFD */
@@ -939,6 +946,9 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1ros3
if (H5Pset_fapl_ros3((hid_t)fapl_id, &instance) < 0)
H5_LIBRARY_ERROR(ENVONLY);
#else
+ UNUSED(fapl_id);
+ UNUSED(fapl_config);
+
H5_UNIMPLEMENTED(ENVONLY, "H5Pset_fapl_ros3: not implemented");
#endif /* H5_HAVE_ROS3_VFD */
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index 1a77fd3..f7dcb30 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -26,10 +26,599 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
+
+/* H5R: HDF5 1.12 Reference API Functions */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_object
+ * Signature: (JLjava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1object
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name)
+{
+ const char *refName = NULL;
+ jboolean isCopy;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_object: name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_object: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_object: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_object((hid_t)loc_id, refName, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1object */
+
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_region
+ * Signature: (JLjava/lang/String;J)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1region
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong space_id)
+{
+ const char *refName = NULL;
+ jboolean isCopy;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_region: name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_region: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_region: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_region((hid_t)loc_id, refName, space_id, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1region */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_attr
+ * Signature: (JLjava/lang/String;Ljava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1attr
+ (JNIEnv *env, jclass clss, jlong loc_id, jstring name, jstring attr_name)
+{
+ const char *refName = NULL;
+ const char *attrName = NULL;
+ jboolean isCopy;
+ jbyteArray ref = NULL;
+ jbyte *refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate_attr: attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Rcreate_attr: attribute name not pinned");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate_attr: reference name not pinned");
+
+ if (NULL == (refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate reference buffer");
+
+ if ((status = H5Rcreate_attr((hid_t)loc_id, refName, attrName, (const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+ if (refBuf)
+ HDfree(refBuf);
+
+ return ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcreate_1attr */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rdestroy
+ * Signature: ([B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Rdestroy
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdestroy: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rdestroy: reference buffer not pinned");
+
+ if ((status = H5Rdestroy((const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Rdestroy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_type
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1type
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ H5R_type_t ref_type;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_type: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_type: reference buffer not pinned");
+
+ if ((ref_type = H5Rget_type((const H5R_ref_t *)refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (ref_type < 0) ? JNI_ABORT : 0);
+
+ return (jint)ref_type;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1type */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Requal
+ * Signature: ([B[B)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Requal
+ (JNIEnv *env, jclass clss, jbyteArray ref1, jbyteArray ref2)
+{
+ jboolean isCopy;
+ jbyte *refBuf1 = NULL;
+ jbyte *refBuf2 = NULL;
+ jsize refBufLen;
+ htri_t bval = JNI_FALSE;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref1)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 is NULL");
+
+ if (NULL == ref2)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref1)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference1 array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, &isCopy, "H5Requal: reference1 buffer not pinned");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref2)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Requal: reference2 array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, &isCopy, "H5Requal: reference2 buffer not pinned");
+
+ if ((bval = H5Requal((const H5R_ref_t *)refBuf1, (const H5R_ref_t *)refBuf2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ status = bval;
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (refBuf2)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref2, refBuf2, (status < 0) ? JNI_ABORT : 0);
+ if (refBuf1)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref1, refBuf1, (status < 0) ? JNI_ABORT : 0);
+
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Requal */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcopy
+ * Signature: ([B)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcopy
+ (JNIEnv *env, jclass clss, jbyteArray src_ref)
+{
+ jboolean isCopy;
+ jbyte *src_refBuf = NULL;
+ jsize refBufLen;
+ jbyteArray dst_ref = NULL;
+ jbyte *dst_refBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == src_ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, src_ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcopy: src reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, &isCopy, "H5Rcopy: src reference buffer not pinned");
+
+ if (NULL == (dst_refBuf = (unsigned char *) HDcalloc((size_t) 1, H5R_REF_BUF_SIZE)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rcreate_attr: failed to allocate dst reference buffer");
+
+ if ((status = H5Rcopy((const H5R_ref_t *)src_refBuf, (const H5R_ref_t *)dst_refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (dst_ref = ENVPTR->NewByteArray(ENVONLY, (jsize)H5R_REF_BUF_SIZE)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, dst_ref, 0, (jsize)H5R_REF_BUF_SIZE, (jbyte *)dst_refBuf);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (src_refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, src_ref, src_refBuf, (status < 0) ? JNI_ABORT : 0);
+ if (dst_refBuf)
+ HDfree(dst_refBuf);
+
+ return dst_ref;
+} /* end Java_hdf_hdf5lib_H5_H5Rcopy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_object
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1object
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_object: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_object: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_object((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1object */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_region
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1region
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong oapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_region: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_region: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_region((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)oapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1region */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_attr
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1attr
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id, jlong aapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ropen_attr: reference array length < 0");
+ }
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Ropen_attr: reference buffer not pinned");
+
+ if ((retVal = H5Ropen_attr((const H5R_ref_t *)refBuf, (hid_t)rapl_id, (hid_t)aapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Ropen_1attr */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_type3
+ * Signature: ([BJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+{
+ H5O_type_t object_info;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type3: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type3: reference buffer not pinned");
+
+ if ((retVal = H5Rget_obj_type3((const H5R_ref_t *)refBuf, (hid_t)rapl_id, &object_info)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (retVal >= 0)
+ retVal = object_info;
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3 */
+
/*
- * Pointer to the JNI's Virtual Machine; used for callback functions.
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_file_name
+ * Signature: ([B)Ljava/lang/String;
*/
-/* extern JavaVM *jvm; */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1file_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_file_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_file_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_file_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_file_name: malloc failed");
+
+ if ((check_size = H5Rget_file_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1file_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_name
+ * Signature: ([BJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref, jlong rapl_id)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_obj_name: malloc failed");
+
+ if ((check_size = H5Rget_obj_name((const H5R_ref_t *)refBuf, (hid_t)rapl_id, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1name */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_attr_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
+ (JNIEnv *env, jclass clss, jbyteArray ref)
+{
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t check_size;
+ char *namePtr = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_attr_name: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_attr_name: reference buffer not pinned");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_attr_name: malloc failed");
+
+ if ((check_size = H5Rget_attr_name((const H5R_ref_t *)refBuf, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (check_size < 0) ? JNI_ABORT : 0);
+
+ return str;
+} /* end Java_hdf_hdf5lib_H5_H5Rget_1attr_1name */
+
+/* H5R: HDF5 1.8 Reference API Functions */
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h
index e28329b..7749f91 100644
--- a/java/src/jni/h5rImp.h
+++ b/java/src/jni/h5rImp.h
@@ -21,6 +21,136 @@
extern "C" {
#endif /* __cplusplus */
+/* H5R: HDF5 1.12 Reference API Functions */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_object
+ * Signature: (JLjava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1object
+ (JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_region
+ * Signature: (JLjava/lang/String;J)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1region
+ (JNIEnv *, jclass, jlong, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcreate_attr
+ * Signature: (JLjava/lang/String;Ljava/lang/String;)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcreate_1attr
+ (JNIEnv *, jclass, jlong, jstring, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rdestroy
+ * Signature: ([B)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Rdestroy
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_type
+ * Signature: ([B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1type
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Requal
+ * Signature: ([B[B)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Requal
+ (JNIEnv *, jclass, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rcopy
+ * Signature: ([B)[B
+ */
+JNIEXPORT jbyteArray JNICALL
+Java_hdf_hdf5lib_H5_H5Rcopy
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_object
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1object
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_region
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1region
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Ropen_attr
+ * Signature: ([BJJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Ropen_1attr
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_type3
+ * Signature: ([BJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1type3
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_file_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1file_1name
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_obj_name
+ * Signature: ([BJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1obj_1name
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Rget_attr_name
+ * Signature: ([B)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Rget_1attr_1name
+ (JNIEnv *, jclass, jbyteArray);
+
+/* H5R: HDF5 1.8 Reference API Functions */
+
/*
* Class: hdf_hdf5lib_H5
* Method: H5Rcreate
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index eedd42e..c703e90 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -162,9 +162,9 @@ done:
} /* end Java_hdf_hdf5lib_H5__1H5Scopy */
#ifdef notdef
-// 10/28/99 -- added code to copy the array -- this is not used,
-// but serves as a reminder in case we try to implement this in
-// the future....
+/* 10/28/99 -- added code to copy the array -- this is not used,
+ * but serves as a reminder in case we try to implement this in
+ */ the future....
/*
* Note: the argument coord is actually long coord[][], which has been
* flattened by the caller.
diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h
index 141e504..87661e3 100644
--- a/java/src/jni/h5sImp.h
+++ b/java/src/jni/h5sImp.h
@@ -49,9 +49,9 @@ Java_hdf_hdf5lib_H5__1H5Scopy
(JNIEnv *, jclass, jlong);
#ifdef notdef
-// 10/28/99 -- added code to copy the array -- this is not used,
-// but serves as a reminder in case we try to implement this in
-// the future....
+/* 10/28/99 -- added code to copy the array -- this is not used,
+ * but serves as a reminder in case we try to implement this in
+ */ the future....
/*
* Note: the argument coord is actually long coord[][], which has been
* flattened by the caller.
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 3302b7d..1adff3c 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -981,9 +981,9 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: H5Treclaim
- * Signature: (JJJ[B)I
+ * Signature: (JJJ[B)V
*/
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Treclaim
(JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
jlong xfer_plist_id, jbyteArray buf)
@@ -1005,8 +1005,6 @@ Java_hdf_hdf5lib_H5_H5Treclaim
done:
if (pinBuf)
UNPIN_BYTE_ARRAY(ENVONLY, buf, pinBuf, (status < 0) ? JNI_ABORT : 0);
-
- return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Treclaim */
/*
diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h
index a63969b..78e4561 100644
--- a/java/src/jni/h5tImp.h
+++ b/java/src/jni/h5tImp.h
@@ -402,9 +402,9 @@ Java_hdf_hdf5lib_H5_H5Tpack
/*
* Class: hdf_hdf5lib_H5
* Method: H5Treclaim
- * Signature: (JJJ[B)I
+ * Signature: (JJJ[B)V
*/
-JNIEXPORT jint JNICALL
+JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Treclaim
(JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray);
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index 700f75f..cd54f8b 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -71,6 +71,12 @@ static int render_bin_output_region_data_points(FILE *stream, hid_t region_s
static int render_bin_output_region_points(FILE *stream, hid_t region_space,
hid_t region_id, hid_t container);
+/* Strings for output */
+#define H5_TOOLS_GROUP "GROUP"
+#define H5_TOOLS_DATASET "DATASET"
+#define H5_TOOLS_DATATYPE "DATATYPE"
+#define H5_TOOLS_ATTRIBUTE "ATTRIBUTE"
+
/** frees memory held by array of strings */
void
h5str_array_free
@@ -625,6 +631,64 @@ done:
return retVal;
} /* end h5str_convert */
+/*-------------------------------------------------------------------------
+ * Function: h5str_sprint_reference
+ *
+ * Purpose: Object reference -- show the name of the referenced object.
+ *
+ * Return: Nothing
+ *-------------------------------------------------------------------------
+ */
+void
+h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p)
+{
+ ssize_t buf_size, status;
+ char *ref_name = NULL;
+ const H5R_ref_t *ref_vp = (H5R_ref_t *)ref_p;
+
+ UNUSED(container);
+
+ if (!h5str_append(out_str, " "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ buf_size = H5Rget_file_name(ref_vp, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ status = H5Rget_file_name(ref_vp, ref_name, buf_size + 1);
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+
+ buf_size = H5Rget_obj_name(ref_vp, H5P_DEFAULT, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ status = H5Rget_obj_name(ref_vp, H5P_DEFAULT, ref_name, buf_size + 1);
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+
+ if (H5Rget_type(ref_vp) == H5R_ATTR) {
+ buf_size = H5Rget_attr_name(ref_vp, NULL, 0);
+ if (buf_size) {
+ ref_name = (char *)HDmalloc(sizeof(char) * (size_t)buf_size + 1);
+ status = H5Rget_attr_name(ref_vp, ref_name, buf_size + 1);
+ ref_name[buf_size] = '\0';
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ HDfree(ref_name);
+ ref_name = NULL;
+ }
+ }
+done:
+ if (ref_name)
+ HDfree(ref_name);
+}
+
/*
* Prints the value of a data point into a string.
*
@@ -984,96 +1048,89 @@ h5str_sprintf
break;
}
- if (H5R_DSET_REG_REF_BUF_SIZE == typeSize) {
- H5S_sel_type region_type = H5S_SEL_ERROR;
- hid_t region_obj = H5I_INVALID_HID;
- hid_t region = H5I_INVALID_HID;
- char ref_name[1024];
-
- /*
- * Dataset region reference --
- * show the type and the referenced object
- */
-
- /* Get name of the dataset the region reference points to using H5Rget_name */
- if ((region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, cptr)) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if ((region = H5Rget_region(container, H5R_DATASET_REGION, cptr)) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (expand_data) {
- if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region)))
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (H5S_SEL_POINTS == region_type) {
- if (h5str_dump_region_points_data(ENVONLY, out_str, region, region_obj) < 0)
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- }
- else {
- if (h5str_dump_region_blocks_data(ENVONLY, out_str, region, region_obj) < 0)
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- }
- }
- else {
- if (H5Rget_name(region_obj, H5R_DATASET_REGION, cptr, (char *)ref_name, 1024) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (!h5str_append(out_str, ref_name))
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
-
- if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region)))
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (H5S_SEL_POINTS == region_type) {
- if (!h5str_append(out_str, " REGION_TYPE POINT"))
- CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
-
- if (h5str_dump_region_points(ENVONLY, out_str, region, region_obj) < 0)
+ if (H5Tequal(tid, H5T_STD_REF)) {
+ H5O_type_t obj_type; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
+ const H5R_ref_t *ref_vp = (H5R_ref_t *)cptr;
+
+ ref_type = H5Rget_type(ref_vp);
+ H5Rget_obj_type3(ref_vp, H5P_DEFAULT, &obj_type);
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ if (!h5str_append(out_str, H5_TOOLS_GROUP))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_DATASET:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if (!h5str_append(out_str, H5_TOOLS_DATATYPE))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ break;
+ case H5R_DATASET_REGION1:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- }
- else {
- if (!h5str_append(out_str, " REGION_TYPE BLOCK"))
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_OBJECT2:
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ if (!h5str_append(out_str, H5_TOOLS_GROUP))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_DATASET:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if (!h5str_append(out_str, H5_TOOLS_DATATYPE))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_DATASET_REGION2:
+ if (!h5str_append(out_str, H5_TOOLS_DATASET))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
-
- if (h5str_dump_region_blocks(ENVONLY, out_str, region, region_obj) < 0)
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ case H5R_ATTR:
+ if (!h5str_append(out_str, H5_TOOLS_ATTRIBUTE))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- }
- }
-
- if (H5Sclose(region) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
- region = H5I_INVALID_HID;
-
- if (H5Dclose(region_obj) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
- region_obj = H5I_INVALID_HID;
+ h5str_sprint_reference(ENVONLY, out_str, container, (void*)cptr);
+ break;
+ default:
+ break;
+ } /* end switch */
}
- else if (H5R_OBJ_REF_BUF_SIZE == typeSize) {
- H5O_info_t oi;
- hid_t obj = H5I_INVALID_HID;
-
- /*
- * Object references -- show the type and OID of the referenced
- * object.
- */
-
- if (NULL == (this_str = (char *) HDmalloc(64)))
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
-
- if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (H5Oget_info2(obj, &oi, H5O_INFO_ALL) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- /* Print object data and close object */
- if (HDsprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr) < 0)
- H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
-
- if (H5Oclose(obj) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
- obj = H5I_INVALID_HID;
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ /* (H5R_DSET_REG_REF_BUF_SIZE == typeSize) */
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ /* (H5R_OBJ_REF_BUF_SIZE == typeSize) */
+ H5_LIBRARY_ERROR(ENVONLY);
}
break;
@@ -2204,20 +2261,28 @@ h5str_render_bin_output
case H5T_REFERENCE:
{
- if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ if (H5Tequal(tid, H5T_STD_REF)) {
+ hid_t region_id = H5I_INVALID_HID;
+ hid_t region_space = H5I_INVALID_HID;
H5S_sel_type region_type;
- hid_t region_id, region_space;
/* Region data */
for (block_index = 0; block_index < block_nelmts; block_index++) {
mem = ((unsigned char*)_mem) + block_index * size;
-
- if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0)
+ if((region_id = H5Ropen_object((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) < 0)
continue;
-
- if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) < 0) {
+ else {
+ if((region_space = H5Ropen_region((const H5R_ref_t *)mem, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (!h5str_is_zero(mem, H5Tget_size(H5T_STD_REF))) {
+ region_type = H5Sget_select_type(region_space);
+ if (region_type == H5S_SEL_POINTS)
+ ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
+ else
+ ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
+ }
+ H5Sclose(region_space);
+ } /* end if (region_space >= 0) */
H5Dclose(region_id);
- continue;
}
if ((region_type = H5Sget_select_type(region_space)) < 0) {
@@ -2225,19 +2290,13 @@ h5str_render_bin_output
H5Dclose(region_id);
continue;
}
-
- if (region_type == H5S_SEL_POINTS)
- ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
- else
- ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
-
- H5Sclose(region_space);
- H5Dclose(region_id);
-
if (ret_value < 0)
break;
}
}
+ else if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ ;
+ }
else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
;
}
@@ -3091,15 +3150,15 @@ done:
} /* end Java_hdf_hdf5lib_H5_H5Dcopy */
/*
-/////////////////////////////////////////////////////////////////////////////////
-//
-//
-// Add these methods so that we don't need to call H5Gget_objtype_by_idx
-// in a loop to get information for all the objects in a group, which takes
-// a lot of time to finish if the number of objects is more than 10,000
-//
-/////////////////////////////////////////////////////////////////////////////////
-*/
+ * /////////////////////////////////////////////////////////////////////////////////
+ * //
+ * //
+ * // Add these methods so that we don't need to call H5Gget_objtype_by_idx
+ * // in a loop to get information for all the objects in a group, which takes
+ * // a lot of time to finish if the number of objects is more than 10,000
+ * //
+ * /////////////////////////////////////////////////////////////////////////////////
+ */
#ifdef __cplusplus
herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data);
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index e5f0d0b..c26cd5d 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -40,6 +40,7 @@ extern void h5str_free(h5str_t *str);
extern void h5str_resize(h5str_t *str, size_t new_len);
extern char* h5str_append(h5str_t *str, const char* cstr);
extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset);
+extern void h5str_sprint_reference(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_p);
extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data);
extern void h5str_array_free(char **strs, size_t len);
extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 2bee075..6a860f3 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -22,12 +22,17 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
+import java.io.Reader;
+import java.io.StreamTokenizer;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
import org.junit.Before;
@@ -50,6 +55,81 @@ public class TestH5 {
public void nextTestName() {
System.out.println();
}
+ private static final String H5_FILE = "testData.h5";
+ private static final String EXPORT_FILE = "testExport.txt";
+ private static final int DIM_X = 4;
+ private static final int DIM_Y = 6;
+ private static final int RANK = 2;
+ long H5fid = -1;
+ long H5dsid = -1;
+ long H5did = -1;
+ long[] H5dims = { DIM_X, DIM_Y };
+
+ private final void _deleteFile(String filename) {
+ File file = null;
+ try {
+ file = new File(filename);
+ }
+ catch (Throwable err) {}
+
+ if (file.exists()) {
+ try {file.delete();} catch (SecurityException e) {}
+ }
+ }
+
+ private final long _createDataset(long fid, long dsid, String name, long dapl) {
+ long did = -1;
+ try {
+ did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5.H5Dcreate: " + err);
+ }
+ assertTrue("TestH5._createDataset: ", did > 0);
+
+ return did;
+ }
+
+ private final void _createH5File() {
+ try {
+ H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ H5dsid = H5.H5Screate_simple(2, H5dims, null);
+ H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5Pfapl.createH5file: " + err);
+ }
+ assertTrue("TestH5.createH5file: H5.H5Fcreate: ", H5fid > 0);
+ assertTrue("TestH5.createH5file: H5.H5Screate_simple: ", H5dsid > 0);
+ assertTrue("TestH5.createH5file: _createDataset: ", H5did > 0);
+
+ try {
+ H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ }
+ }
+
+ public final void _closeH5File() throws HDF5LibraryException {
+ if (H5did >= 0)
+ try {H5.H5Dclose(H5did);} catch (Exception ex) {}
+ if (H5dsid > 0)
+ try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
+ if (H5fid > 0)
+ try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
+ H5fid = -1;
+ H5dsid = -1;
+ H5did = -1;
+ }
+
+ public final void _deleteH5file() {
+ _deleteFile(H5_FILE);
+ }
/**
* Test method for {@link hdf.hdf5lib.H5#J2C(int)}.
@@ -268,4 +348,67 @@ public class TestH5 {
fail("Exception thrown during test: " + ex.toString());
}
}
+
+ @Test
+ public void testH5export_dataset() {
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int[][] dset_indata = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
+
+ _createH5File();
+
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = FILLVAL;
+
+ try {
+ if (H5did >= 0)
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ _closeH5File();
+
+ try {
+ H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_dataset failed: " + err);
+ }
+
+ File file = new File(EXPORT_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ int jndx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx][jndx] = (int)streamTokenizer.nval;
+ jndx++;
+ if (jndx >= DIM_Y) {
+ jndx = 0;
+ indx++;
+ }
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ for(int col = 0; col < DIM_Y; col++) {
+ assertTrue("H5export_dataset: <"+row+","+col+">"+dset_indata[row][col]+"=99", dset_indata[row][col]==99);
+ }
+// _deleteH5file();
+ }
}
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index ee2850b..6f968b1 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -366,7 +366,7 @@ public class TestH5Edefault {
}
assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, num_msg == saved_num_msg);
- // Se the current stack to be the default and try that again
+ // Set the current stack to be the default and try that again
try {
H5.H5Eset_current_stack(stack_id);
num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT);
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java
index 5349855..0c307d1 100644
--- a/java/test/TestH5R.java
+++ b/java/test/TestH5R.java
@@ -24,6 +24,7 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import org.junit.After;
import org.junit.Before;
@@ -42,6 +43,8 @@ public class TestH5R {
long H5gid = -1;
long H5did2 = -1;
long[] H5dims = { DIM_X, DIM_Y };
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
private final void _deleteFile(String filename) {
File file = null;
@@ -66,7 +69,7 @@ public class TestH5R {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5R._createDataset: ",did > 0);
+ assertTrue("TestH5R._createDataset: ", did > 0);
return did;
}
@@ -100,6 +103,21 @@ public class TestH5R {
H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT);
H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = FILLVAL;
+
+ try {
+ if (H5did >= 0)
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
}
catch (Throwable err) {
err.printStackTrace();
@@ -129,13 +147,15 @@ public class TestH5R {
System.out.println();
}
+ // Test v1.8 APIs params
+
@Test
public void testH5Rget_name() {
- long loc_id=H5fid;
- int ref_type=HDF5Constants.H5R_OBJECT;
- long ret_val=-1;
- byte[] ref=null;
- String[] name= {""};
+ long loc_id = H5fid;
+ int ref_type = HDF5Constants.H5R_OBJECT;
+ long ret_val = -1;
+ byte[] ref = null;
+ String[] name = {""};
String objName = "/dset";
try {
@@ -164,7 +184,7 @@ public class TestH5R {
byte[] ref=null;
String objName = "/dset";
- int obj_type = -1;;
+ int obj_type = -1;
try {
ref = H5.H5Rcreate(H5fid, objName, ref_type, -1);
@@ -226,8 +246,8 @@ public class TestH5R {
group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
assertNotNull(ref1);
assertNotNull(ref2);
- assertTrue(dataset_id>=0);
- assertTrue(group_id>=0);
+ assertTrue(dataset_id >= 0);
+ assertTrue(group_id >= 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -247,7 +267,7 @@ public class TestH5R {
ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid);
dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
assertNotNull(ref);
- assertTrue(dsid>=0);
+ assertTrue(dsid >= 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -261,7 +281,7 @@ public class TestH5R {
@Test(expected = IllegalArgumentException.class)
public void testH5Rget_name_Invalidreftype() throws Throwable {
byte[] ref = null;
- String[] name= {""};
+ String[] name = {""};
ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1);
H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16);
}
@@ -269,7 +289,7 @@ public class TestH5R {
@Test(expected = NullPointerException.class)
public void testH5Rget_name_NULLreference() throws Throwable {
byte[] ref = null;
- String[] name= {""};
+ String[] name = {""};
H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16);
}
@@ -330,4 +350,331 @@ public class TestH5R {
H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1);
}
+ // Test v1.12 APIs params
+
+ @Test
+ public void testH5Rget_object() {
+ int ref_type = HDF5Constants.H5R_OBJECT2;
+ long ret_val = -1;
+ byte[] ref = null;
+ String name = "";
+ String objName = "/dset";
+
+ try {
+ ref = H5.H5Rcreate_object(H5fid, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rcreate_object " + err);
+ }
+
+ try {
+ ret_val = H5.H5Rget_type(ref);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rget_type: " + err);
+ }
+ assertTrue("testH5Rget_object: H5Rget_type", ret_val == ref_type);
+
+ try {
+ name = H5.H5Rget_file_name(ref);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rget_file_name: " + err);
+ }
+ assertTrue("testH5Rget_object: H5Rget_file_name", H5_FILE.equals(name));
+
+ try {
+ name = H5.H5Rget_obj_name(ref, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rget_obj_name: " + err);
+ }
+ assertTrue("The name of the object: ", objName.equals(name));
+ }
+
+ @Test
+ public void testH5Rget_obj_type3() {
+ int obj_type = -1;
+ byte[] ref = null;
+ String objName = "/dset";
+
+ try {
+ ref = H5.H5Rcreate_object(H5fid, objName);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5Rcreate_object " + err);
+ }
+
+ try {
+ obj_type = H5.H5Rget_obj_type3(ref, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_obj_type3: H5.H5Rget_obj_type3: " + err);
+ }
+ assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET);
+ }
+
+ @Test
+ public void testH5Rcreate_regionref_object() {
+ byte[] ref = null;
+ String objName = "/dset";
+ long start[] = {2,2}; // Starting location of hyperslab
+ long stride[] = {1,1}; // Stride of hyperslab
+ long count[] = {1,1}; // Element count of hyperslab
+ long block[] = {3,3}; // Block size of hyperslab
+
+ // Select 3x3 hyperslab for reference
+ try {
+ H5.H5Sselect_hyperslab(H5dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Sselect_hyperslab " + err);
+ }
+ try {
+ ref = H5.H5Rcreate_region(H5fid, objName, H5dsid);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("testH5Rget_object: H5Rcreate_region " + err);
+ }
+ assertNotNull(ref);
+ }
+
+// @Test//
+// public void testH5Rget_group() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1);
+//
+// //Create reference on group
+// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1);
+// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
+// assertNotNull(ref1);
+// assertNotNull(ref2);
+// assertTrue(dataset_id >= 0);
+// assertTrue(group_id >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rdereference " + err);
+// }
+// finally {
+// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {}
+// try {H5.H5Gclose(group_id);} catch (Exception ex) {}
+// }
+// }
+
+// @Test//
+// public void testH5Rget_region_dataset() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+// assertNotNull(ref);
+// assertTrue(dsid >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rget_region: " + err);
+// }
+// finally {
+// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+// }
+// }
+
+// @Test//
+// public void testH5Rget_attr() {
+// long loc_id = H5fid;
+// int ref_type = HDF5Constants.H5R_OBJECT2;
+// long ret_val = -1;
+// byte[] ref = null;
+// String name = "";
+// String objName = "/dset";
+//
+// try {
+// ref = H5.H5Rcreate_object(H5fid, objName);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("testH5Rget_object: H5Rcreate_object " + err);
+// }
+// try {
+// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref);
+// assertNotNull(ref);
+// assertTrue(dsid >= 0);
+// }
+// catch (Throwable err) {
+// err.printStackTrace();
+// fail("TestH5Rget_region: " + err);
+// }
+// finally {
+// try {H5.H5Sclose(dsid);} catch (Exception ex) {}
+// }
+// }
+
+ // Test parameters to H5Rcreate_object
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_object_Nullname() throws Throwable {
+ String name = null;
+ H5.H5Rcreate_object(H5fid, name);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rget_name_Invalidloc() throws Throwable {
+ String name= "";
+ H5.H5Rcreate_object(-1, name);
+ }
+
+ // Test parameters to H5Rcreate_region
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_region_Nullname() throws Throwable {
+ String name = null;
+ H5.H5Rcreate_region(H5fid, name, -1);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rcreate_region_Invalidloc() throws Throwable {
+ String name= "";
+ H5.H5Rcreate_region(-1, name, -1);
+ }
+
+ // Test parameters to H5Rcreate_attr
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_attr_Nullname() throws Throwable {
+ String name = null;
+ String attrname = "";
+ H5.H5Rcreate_attr(H5fid, name, attrname);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcreate_attr_Nullattrname() throws Throwable {
+ String name = "";
+ String attrname = null;
+ H5.H5Rcreate_attr(H5fid, name, attrname);
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Rcreate_attr_Invalidloc() throws Throwable {
+ String name= "";
+ String attrname= "";
+ H5.H5Rcreate_attr(-1, name, attrname);
+ }
+
+ // Test parameters to H5Rdestroy
+ @Test(expected = NullPointerException.class)
+ public void testH5Rdestroy_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rdestroy(ref);
+ }
+
+ // Test parameters to H5Rget_type
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_type_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_type(ref);
+ }
+
+ // Test parameters to H5Requal
+ @Test(expected = NullPointerException.class)
+ public void testH5Requal_Nullref1() throws Throwable {
+ byte[] ref1 = null;
+ byte[] ref2 = {0,0,0,0};
+ H5.H5Requal(ref1, ref2);
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Requal_Nullref2() throws Throwable {
+ byte[] ref1 = {0,0,0,0};
+ byte[] ref2 = null;
+ H5.H5Requal(ref1, ref2);
+ }
+
+ // Test parameters to H5Rcopy
+ @Test(expected = NullPointerException.class)
+ public void testH5Rcopy_Nullref1() throws Throwable {
+ byte[] ref1 = null;
+ byte[] ref2 = H5.H5Rcopy(ref1);
+ }
+
+ // Test parameters to H5Ropen_object
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_object_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Ropen_object(ref, -1, -1);
+ }
+
+ // Test parameters to H5Ropen_region
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_region_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Ropen_region(ref, -1, -1);
+ }
+
+ // Test parameters to H5Ropen_attr
+ @Test(expected = NullPointerException.class)
+ public void testH5Ropen_attr_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Ropen_attr(ref, -1, -1);
+ }
+
+ // Test parameters to H5Rget_obj_type3
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_obj_type3_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_obj_type3(ref, -1);
+ }
+
+ // Test parameters to H5Rget_file_name
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_file_name_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_file_name(ref);
+ }
+
+ // Test parameters to H5Rget_obj_name
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_obj_name_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_obj_name(ref, -1);
+ }
+
+ // Test parameters to H5Rget_attr_name
+ @Test(expected = NullPointerException.class)
+ public void testH5Rget_attr_name_Nullref() throws Throwable {
+ byte[] ref = null;
+ H5.H5Rget_attr_name(ref);
+ }
+
}
diff --git a/java/test/testfiles/JUnit-TestH5R.txt b/java/test/testfiles/JUnit-TestH5R.txt
index 150df54..daa81c5 100644
--- a/java/test/testfiles/JUnit-TestH5R.txt
+++ b/java/test/testfiles/JUnit-TestH5R.txt
@@ -1,8 +1,14 @@
JUnit version 4.11
+.testH5Ropen_attr_Nullref
.testH5Rgetregion_Nullreference
.testH5Rget_obj_type2_Invalidreftype
.testH5Rdereference
+.testH5Rget_attr_name_Nullref
+.testH5Ropen_region_Nullref
+.testH5Requal_Nullref1
+.testH5Requal_Nullref2
.testH5Rget_name
+.testH5Rget_object
.testH5Rcreate_Invalidreftype
.testH5Rget_name_NULLreference
.testH5Rget_region
@@ -11,13 +17,29 @@ JUnit version 4.11
.testH5Rcreate_Invalidspace_id
.testH5Rdereference_Invalidreference
.testH5Rgetregion_Badreferencetype
+.testH5Rget_obj_type3_Nullref
.testH5Rcreate_regionrefobj
+.testH5Ropen_object_Nullref
+.testH5Rdestroy_Nullref
.testH5Rget_name_Invalidreftype
.testH5Rgetregion_Invalidreftype
+.testH5Rcreate_object_Nullname
.testH5Rget_obj_type2
+.testH5Rget_obj_type3
+.testH5Rget_name_Invalidloc
+.testH5Rcopy_Nullref1
+.testH5Rcreate_attr_Invalidloc
.testH5Rcreate_InvalidObjectName
+.testH5Rget_file_name_Nullref
+.testH5Rget_obj_name_Nullref
+.testH5Rcreate_region_Nullname
+.testH5Rcreate_regionref_object
+.testH5Rcreate_attr_Nullattrname
+.testH5Rcreate_region_Invalidloc
+.testH5Rget_type_Nullref
+.testH5Rcreate_attr_Nullname
Time: XXXX
-OK (17 tests)
+OK (39 tests)