mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
HDFFV-10663 add new function H5Fis_accessible
This commit is contained in:
@@ -3077,9 +3077,28 @@ public class H5 implements java.io.Serializable {
|
||||
* - Error from the HDF-5 Library.
|
||||
* @exception NullPointerException
|
||||
* - name is null.
|
||||
*
|
||||
* @deprecated As of HDF5 1.10.5 in favor of H5Fis_accessible.
|
||||
**/
|
||||
public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
/**
|
||||
* H5Fis_accessible determines if the file can be opened with the given fapl.
|
||||
*
|
||||
* @param name
|
||||
* IN: File name to check.
|
||||
* @param file_id
|
||||
* IN: File identifier for a currently-open HDF5 file
|
||||
*
|
||||
* @return true if file is accessible, false if not.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
* @exception NullPointerException
|
||||
* - name is null.
|
||||
**/
|
||||
public synchronized static native boolean H5Fis_accessible(String name, long file_id) throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
/**
|
||||
* H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount
|
||||
* properties plist_id.
|
||||
|
||||
+28
-1
@@ -166,6 +166,33 @@ Java_hdf_hdf5lib_H5_H5Fis_1hdf5
|
||||
return (jboolean)bval;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Fis_accessible
|
||||
* Signature: (Ljava/lang/String;J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Fis_1accessible
|
||||
(JNIEnv *env, jclass clss, jstring name, jlong file_id)
|
||||
{
|
||||
htri_t bval = JNI_FALSE;
|
||||
const char *fileName;
|
||||
|
||||
PIN_JAVA_STRING(name, fileName);
|
||||
if (fileName != NULL) {
|
||||
bval = H5Fis_accessible(fileName, (hid_t)file_id);
|
||||
|
||||
UNPIN_JAVA_STRING(name, fileName);
|
||||
|
||||
if (bval > 0)
|
||||
bval = JNI_TRUE;
|
||||
else if (bval < 0)
|
||||
h5libraryError(env);
|
||||
}
|
||||
|
||||
return (jboolean)bval;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Fis_1accessible */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Fget_create_plist
|
||||
@@ -177,7 +204,7 @@ Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
|
||||
{
|
||||
hid_t retVal = -1;
|
||||
|
||||
retVal = H5Fget_create_plist((hid_t)file_id );
|
||||
retVal = H5Fget_create_plist((hid_t)file_id);
|
||||
if (retVal < 0)
|
||||
h5libraryError(env);
|
||||
|
||||
|
||||
@@ -66,6 +66,15 @@ JNIEXPORT jboolean JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
|
||||
(JNIEnv*, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Fis_accessible
|
||||
* Signature: (Ljava/lang/String;J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Fis_1ccessible
|
||||
(JNIEnv*, jclass, jstring, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Fget_create_plist
|
||||
|
||||
@@ -81,6 +81,19 @@ public class TestH5Fbasic {
|
||||
assertTrue(isH5 == true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Fis_accessible() {
|
||||
boolean isH5 = false;
|
||||
|
||||
try {
|
||||
isH5 = H5.H5Fis_accessible(H5_FILE, HDF5Constants.H5P_DEFAULT);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
fail("H5.H5Fis_accessible failed on " + H5_FILE + ": " + err);
|
||||
}
|
||||
assertTrue(isH5 == true);
|
||||
}
|
||||
|
||||
@Test(expected = HDF5LibraryException.class)
|
||||
public void testH5Fcreate_EXCL() throws Throwable {
|
||||
H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL,
|
||||
|
||||
@@ -59,6 +59,11 @@ public class TestH5Fparams {
|
||||
H5.H5Fis_hdf5(null);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Fis_accessible_null() throws Throwable {
|
||||
H5.H5Fis_accessible(null, -1);
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Fmount_null() throws Throwable {
|
||||
H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT);
|
||||
|
||||
@@ -9,6 +9,7 @@ JUnit version 4.11
|
||||
.testH5Freopen_closed
|
||||
.testH5Freset_mdc_hit_rate_stats
|
||||
.testH5Fget_name
|
||||
.testH5Fis_accessible
|
||||
.testH5Fcreate
|
||||
.testH5Fclear_elink_file_cache
|
||||
.testH5Fclose_twice
|
||||
@@ -17,5 +18,5 @@ JUnit version 4.11
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (15 tests)
|
||||
OK (16 tests)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
JUnit version 4.11
|
||||
.testH5Fis_accessible_null
|
||||
.testH5Fcreate_null
|
||||
.testH5Fflush_local
|
||||
.testH5Fget_info
|
||||
@@ -13,5 +14,5 @@ JUnit version 4.11
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (11 tests)
|
||||
OK (12 tests)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user