summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2019-01-04 18:52:25 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2019-01-04 18:52:37 (GMT)
commit28d5d987b5f7531f5709e65fa731b3972413ddb8 (patch)
treee49cf44830dab5d8fd4c691d1bc06e4b764425b2 /java
parent46bf1647d40bfab34f4d7726cbd8ae9668d1759f (diff)
downloadhdf5-28d5d987b5f7531f5709e65fa731b3972413ddb8.zip
hdf5-28d5d987b5f7531f5709e65fa731b3972413ddb8.tar.gz
hdf5-28d5d987b5f7531f5709e65fa731b3972413ddb8.tar.bz2
HDFFV-10664 add missing function and check for restriction
Diffstat (limited to 'java')
-rw-r--r--java/src/hdf/hdf5lib/H5.java19
-rw-r--r--java/src/jni/h5fImp.c21
-rw-r--r--java/src/jni/h5fImp.h9
-rw-r--r--java/test/TestH5Fparams.java40
4 files changed, 85 insertions, 4 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index deeda49..51b0d38 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -3247,7 +3247,6 @@ public class H5 implements java.io.Serializable {
*
* @param file_id
* IN: Identifier of the target file.
- *
* @param minimize
* the minimize hint setting
*
@@ -3257,13 +3256,29 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize)
throws HDF5LibraryException;
+
+ /**
+ * H5Fset_libver_bounds sets a different low and high bounds while a file is open.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ * @param low
+ * IN: The earliest version of the library that will be used for writing objects
+ * @param high
+ * IN: The latest version of the library that will be used for writing objects.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high)
+ throws HDF5LibraryException;
+
// /////// unimplemented ////////
// herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
// herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
// ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/);
- // herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
// herr_t H5Fformat_convert(hid_t fid);
// herr_t H5Freset_page_buffering_stats(hid_t file_id);
// herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 7f10ca5..80adffb 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -149,6 +149,9 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
htri_t bval = JNI_FALSE;
+#ifdef H5_NO_DEPRECATED_SYMBOLS
+ h5unimplemented(env, "H5Fis_hdf5: not implemented");
+#else
const char *fileName;
PIN_JAVA_STRING(name, fileName);
@@ -162,7 +165,7 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
else if (bval < 0)
h5libraryError(env);
}
-
+#endif
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@@ -681,6 +684,22 @@ Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
return bval;
}
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
+{
+ herr_t retVal = -1;
+
+ retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high);
+ if(retVal < 0)
+ h5libraryError(env);
+} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
+
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index f1b4f04..fe253f9 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -273,6 +273,15 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
(JNIEnv *, jclass, jlong);
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+(JNIEnv *, jclass, jlong, jint, jint);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index 3d64aa9..8a60f30 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -195,7 +195,7 @@ public class TestH5Fparams {
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- fail("H5.H5Fopen: " + err);
+ fail("H5.H5Fcreate: " + err);
}
try {
@@ -215,4 +215,42 @@ public class TestH5Fparams {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
+
+ @Test(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
}