mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-17 16:10:24 +08:00
Added java wrappers and tests
This commit is contained in:
parent
95e96246a6
commit
690cb84f10
@ -4451,7 +4451,7 @@ public class H5 implements java.io.Serializable {
|
||||
// //
|
||||
// ////////////////////////////////////////////////////////////
|
||||
|
||||
// Generic property list routines
|
||||
// /////// Generic property list routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_class_name retrieves the name of a generic property list class
|
||||
@ -4767,7 +4767,7 @@ public class H5 implements java.io.Serializable {
|
||||
|
||||
public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException;
|
||||
|
||||
// Object creation property list (OCPL) routines
|
||||
// /////// Object creation property list (OCPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_attr_phase_change retrieves attribute storage phase change thresholds.
|
||||
@ -5071,7 +5071,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException,
|
||||
NullPointerException;
|
||||
|
||||
// File creation property list (FCPL) routines
|
||||
// /////// File creation property list (FCPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_userblock retrieves the size of a user block in a file creation property list.
|
||||
@ -5480,7 +5480,7 @@ public class H5 implements java.io.Serializable {
|
||||
throws HDF5LibraryException, IllegalArgumentException;
|
||||
|
||||
|
||||
// File access property list (FAPL) routines
|
||||
// /////// File access property list (FAPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_alignment retrieves the current settings for alignment properties from a file access property list.
|
||||
@ -5860,6 +5860,37 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object
|
||||
* will be evicted from the library's metadata cache when it is closed.
|
||||
*
|
||||
* @param fapl_id
|
||||
* IN: File access property list identifier
|
||||
*
|
||||
* @return indication if the object will be evicted on close.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native boolean H5Pget_evict_on_close(long fapl_id)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object.
|
||||
*
|
||||
* @param fapl_id
|
||||
* IN: File access property list identifier
|
||||
* @param evict_on_close
|
||||
* IN: Whether the HDF5 object should be evicted on close.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
// Dataset creation property list (DCPL) routines //
|
||||
|
||||
/**
|
||||
@ -6066,6 +6097,35 @@ public class H5 implements java.io.Serializable {
|
||||
**/
|
||||
public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache.
|
||||
*
|
||||
* @param fapl_id
|
||||
* IN: File access property list identifier
|
||||
*
|
||||
* @return VDS link open file cache size in number of files.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache.
|
||||
*
|
||||
* @param fapl_id
|
||||
* IN: File access property list identifier
|
||||
* @param efc_size
|
||||
* IN: VDS link open file cache size in number of files.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pget_external returns information about an external file.
|
||||
*
|
||||
@ -6285,7 +6345,37 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException,
|
||||
NullPointerException;
|
||||
|
||||
// Dataset access property list (DAPL) routines //
|
||||
// /////// Dataset creation property list (DCPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list.
|
||||
*
|
||||
* @param dcpl_id
|
||||
* IN: Dataset creation property list identifier
|
||||
* @param opts
|
||||
* IN: Edge chunk option flag. Valid values are:
|
||||
* H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS - filters are not applied to partial edge chunks.
|
||||
* 0 - Disables option; partial edge chunks will be compressed.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library
|
||||
**/
|
||||
public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list .
|
||||
*
|
||||
* @param dcpl_id
|
||||
* IN: Dataset creation property list
|
||||
|
||||
* @return The edge chunk option setting.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library
|
||||
**/
|
||||
public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException;
|
||||
|
||||
// /////// Dataset access property list (DAPL) routines ///////
|
||||
|
||||
/**
|
||||
* Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes
|
||||
@ -6388,12 +6478,76 @@ public class H5 implements java.io.Serializable {
|
||||
**/
|
||||
public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths.
|
||||
*
|
||||
* @param dapl_id
|
||||
* IN: Link access property list identifier
|
||||
*
|
||||
* @return the prefix to be applied to virtual file paths.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native String H5Pget_virtual_prefix(long dapl_id)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths.
|
||||
*
|
||||
* @param dapl_id
|
||||
* IN: Dataset access property list identifier
|
||||
* @param prefix
|
||||
* IN: Prefix to be applied to virtual file paths
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
* @exception NullPointerException
|
||||
* - prefix is null.
|
||||
*
|
||||
**/
|
||||
public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix)
|
||||
throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
/**
|
||||
* H5Pget_efile_prefix Retrieves prefix applied to external file paths.
|
||||
*
|
||||
* @param dapl_id
|
||||
* IN: Link access property list identifier
|
||||
*
|
||||
* @return the prefix to be applied to external file paths.
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
*
|
||||
**/
|
||||
public synchronized static native String H5Pget_efile_prefix(long dapl_id)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
/**
|
||||
* H5Pset_efile_prefix Sets prefix to be applied to external file paths.
|
||||
*
|
||||
* @param dapl_id
|
||||
* IN: Dataset access property list identifier
|
||||
* @param prefix
|
||||
* IN: Prefix to be applied to external file paths
|
||||
*
|
||||
* @exception HDF5LibraryException
|
||||
* - Error from the HDF-5 Library.
|
||||
* @exception NullPointerException
|
||||
* - prefix is null.
|
||||
*
|
||||
**/
|
||||
public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix)
|
||||
throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
// public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException;
|
||||
|
||||
// public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException;
|
||||
|
||||
|
||||
// Dataset xfer property list (DXPL) routines //
|
||||
// /////// Dataset xfer property list (DXPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property
|
||||
@ -6544,7 +6698,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size)
|
||||
throws HDF5LibraryException, NullPointerException;
|
||||
|
||||
// Link creation property list (LCPL) routines //
|
||||
// /////// Link creation property list (LCPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate
|
||||
@ -6579,7 +6733,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
// Group creation property list (GCPL) routines //
|
||||
// /////// Group creation property list (GCPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups.
|
||||
@ -6736,14 +6890,14 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
// String creation property list (STRCPL) routines //
|
||||
// /////// String creation property list (STRCPL) routines ///////
|
||||
|
||||
public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException;
|
||||
|
||||
public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
// Link access property list (LAPL) routines //
|
||||
// /////// Link access property list (LAPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the
|
||||
@ -6896,7 +7050,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException,
|
||||
IllegalArgumentException;
|
||||
|
||||
// Object copy property list (OCPYPL) routines //
|
||||
// /////// Object copy property list (OCPYPL) routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_copy_object retrieves the properties to be used when an object is copied.
|
||||
@ -6927,7 +7081,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options)
|
||||
throws HDF5LibraryException;
|
||||
|
||||
// Other/Older property list routines //
|
||||
// /////// Other/Older property list routines ///////
|
||||
|
||||
/**
|
||||
* H5Pget_version retrieves the version information of various objects for a file creation property list.
|
||||
@ -6955,7 +7109,7 @@ public class H5 implements java.io.Serializable {
|
||||
public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException,
|
||||
NullPointerException, IllegalArgumentException;
|
||||
|
||||
// file drivers property list routines //
|
||||
// /////// file drivers property list routines ///////
|
||||
|
||||
public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store)
|
||||
throws HDF5LibraryException, NullPointerException;
|
||||
@ -7102,20 +7256,28 @@ public class H5 implements java.io.Serializable {
|
||||
// File creation property list (FCPL) routines //
|
||||
|
||||
// File access property list (FAPL) routines //
|
||||
// herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info )
|
||||
// const void *H5Pget_driver_info( hid_t plist_id )
|
||||
// herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type )
|
||||
// herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type )
|
||||
// herr_t H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info)
|
||||
// const void *H5Pget_driver_info(hid_t plist_id)
|
||||
// herr_t H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type)
|
||||
// herr_t H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type)
|
||||
// herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr);
|
||||
// herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len);
|
||||
// herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
|
||||
// herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr);
|
||||
// herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size);
|
||||
// herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
|
||||
// herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective);
|
||||
// herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective);
|
||||
// herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective);
|
||||
// herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc);
|
||||
// herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data);
|
||||
// herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data);
|
||||
|
||||
// Dataset creation property list (DCPL) routines //
|
||||
|
||||
// Dataset access property list (DAPL) routines //
|
||||
// herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data);
|
||||
// herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data)
|
||||
|
||||
// Dataset xfer property list (DXPL) routines //
|
||||
// herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg);
|
||||
|
@ -88,6 +88,7 @@ public class HDF5Constants {
|
||||
public static final int H5D_VDS_ERROR = H5D_VDS_ERROR();
|
||||
public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING();
|
||||
public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE();
|
||||
public static final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS = H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS();
|
||||
|
||||
public static final int H5E_MAJOR = H5E_MAJOR();
|
||||
public static final int H5E_MINOR = H5E_MINOR();
|
||||
@ -768,6 +769,8 @@ public class HDF5Constants {
|
||||
|
||||
private static native final int H5D_VDS_LAST_AVAILABLE();
|
||||
|
||||
private static native final int H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS();
|
||||
|
||||
private static native final long H5E_ALIGNMENT();
|
||||
|
||||
private static native final long H5E_ALREADYEXISTS();
|
||||
|
@ -47,20 +47,20 @@ which has a method:
|
||||
The native method is implemented in C using the
|
||||
<a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/index.html">Java
|
||||
Native Method Interface </a>(JNI). This is written something like the following:
|
||||
<pre><b>JNIEXPORT jint
|
||||
<pre><b>JNIEXPORT jlong
|
||||
JNICALL Java_hdf_hdf5lib_H5_H5Fopen
|
||||
(
|
||||
JNIEnv *env,
|
||||
jclass class,
|
||||
jstring hdfFile,
|
||||
jint flags,
|
||||
jint access)
|
||||
jlong access)
|
||||
{
|
||||
|
||||
/* ...convert Java String to (char *) */
|
||||
|
||||
/* call the HDF library */
|
||||
retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
|
||||
retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access);
|
||||
|
||||
/* ... */
|
||||
}</b></pre>
|
||||
|
@ -140,6 +140,8 @@ JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; }
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; }
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1DONT_1FILTER_1PARTIAL_1CHUNKS(JNIEnv *env, jclass cls) { return H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; }
|
||||
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; }
|
||||
|
@ -5733,6 +5733,252 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
|
||||
} /* end else */
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_vds_file_cache_size
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size
|
||||
(JNIEnv *env, jclass clss, jlong plist, jint size)
|
||||
{
|
||||
unsigned sz = (unsigned)size;
|
||||
|
||||
if (H5Pset_vds_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
|
||||
h5libraryError(env);
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_vds_file_cache_size
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size
|
||||
(JNIEnv *env, jclass clss, jlong plist)
|
||||
{
|
||||
unsigned s;
|
||||
|
||||
if (H5Pget_vds_file_cache_size((hid_t)plist, &s) < 0)
|
||||
h5libraryError(env);
|
||||
|
||||
return (jint)s;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_virtual_prefix
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
|
||||
(JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
|
||||
{
|
||||
herr_t retVal = -1;
|
||||
const char *aName;
|
||||
|
||||
PIN_JAVA_STRING(prefix, aName);
|
||||
if (aName != NULL) {
|
||||
retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName);
|
||||
|
||||
UNPIN_JAVA_STRING(prefix, aName);
|
||||
|
||||
if(retVal < 0)
|
||||
h5libraryError(env);
|
||||
}
|
||||
|
||||
return (jint)retVal;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_virtual_prefix
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
|
||||
(JNIEnv *env, jclass clss, jlong dapl_id)
|
||||
{
|
||||
size_t size = 0;
|
||||
char *pre;
|
||||
jlong prefix_size = -1;
|
||||
jstring str = NULL;
|
||||
|
||||
prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size);
|
||||
if(prefix_size < 0) {
|
||||
h5libraryError(env);
|
||||
} /* end if */
|
||||
else {
|
||||
size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
|
||||
pre = (char*)HDmalloc(sizeof(char)*size);
|
||||
if (pre == NULL) {
|
||||
h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed ");
|
||||
} /* end if */
|
||||
else {
|
||||
prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size);
|
||||
|
||||
if (prefix_size >= 0) {
|
||||
str = ENVPTR->NewStringUTF(ENVPAR pre);
|
||||
HDfree(pre);
|
||||
if (str == NULL)
|
||||
h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated");
|
||||
} /* end if */
|
||||
else {
|
||||
HDfree(pre);
|
||||
h5libraryError(env);
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
|
||||
return (jstring)str;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_efile_prefix
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
|
||||
(JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
|
||||
{
|
||||
herr_t retVal = -1;
|
||||
const char *aName;
|
||||
|
||||
PIN_JAVA_STRING(prefix, aName);
|
||||
if (aName != NULL) {
|
||||
retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName);
|
||||
|
||||
UNPIN_JAVA_STRING(prefix, aName);
|
||||
|
||||
if(retVal < 0)
|
||||
h5libraryError(env);
|
||||
}
|
||||
|
||||
return (jint)retVal;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_efile_prefix
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
|
||||
(JNIEnv *env, jclass clss, jlong dapl_id)
|
||||
{
|
||||
size_t size = 0;
|
||||
char *pre;
|
||||
jlong prefix_size = -1;
|
||||
jstring str = NULL;
|
||||
|
||||
prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)NULL, size);
|
||||
if(prefix_size < 0) {
|
||||
h5libraryError(env);
|
||||
} /* end if */
|
||||
else {
|
||||
size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
|
||||
pre = (char*)HDmalloc(sizeof(char)*size);
|
||||
if (pre == NULL) {
|
||||
h5outOfMemory(env, "H5Pget_efile_prefix: malloc failed ");
|
||||
} /* end if */
|
||||
else {
|
||||
prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)pre, size);
|
||||
|
||||
if (prefix_size >= 0) {
|
||||
str = ENVPTR->NewStringUTF(ENVPAR pre);
|
||||
HDfree(pre);
|
||||
if (str == NULL)
|
||||
h5JNIFatalError( env, "H5Pget_efile_prefix: return string not allocated");
|
||||
} /* end if */
|
||||
else {
|
||||
HDfree(pre);
|
||||
h5libraryError(env);
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
} /* end else */
|
||||
|
||||
return (jstring)str;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_evict_on_close
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
|
||||
(JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
|
||||
{
|
||||
herr_t retVal = -1;
|
||||
hbool_t evict_on_close_val;
|
||||
|
||||
if (evict_on_close == JNI_TRUE)
|
||||
evict_on_close_val = TRUE;
|
||||
else
|
||||
evict_on_close_val = FALSE;
|
||||
|
||||
retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val);
|
||||
if (retVal < 0)
|
||||
h5libraryError(env);
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_evict_on_close
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
|
||||
(JNIEnv *env, jclass clss, jlong fapl_id)
|
||||
{
|
||||
hbool_t evict_on_close_val = FALSE;
|
||||
jboolean bval = JNI_FALSE;
|
||||
|
||||
if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) {
|
||||
h5libraryError(env);
|
||||
} /* end if */
|
||||
else {
|
||||
if (evict_on_close_val == TRUE)
|
||||
bval = JNI_TRUE;
|
||||
} /* end else */
|
||||
|
||||
return bval;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_chunk_opts
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
|
||||
(JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
|
||||
{
|
||||
herr_t retVal = -1;
|
||||
|
||||
retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts);
|
||||
if (retVal < 0)
|
||||
h5libraryError(env);
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_chunk_opts
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
|
||||
(JNIEnv *env, jclass clss, jlong dcpl_id)
|
||||
{
|
||||
unsigned opts = 0;
|
||||
|
||||
if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0)
|
||||
h5libraryError(env);
|
||||
|
||||
return (jint)opts;
|
||||
} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
@ -1533,7 +1533,6 @@ JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_metadata_read_attempts
|
||||
@ -1543,6 +1542,96 @@ JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
|
||||
(JNIEnv *, jclass, jlong, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_vds_file_cache_size
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1vds_1file_1cache_1size
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_vds_file_cache_size
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1vds_1file_1cache_1size
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_virtual_prefix
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
|
||||
(JNIEnv *, jclass, jlong, jstring);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_virtual_prefix
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_efile_prefix
|
||||
* Signature: (JLjava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
|
||||
(JNIEnv *, jclass, jlong, jstring);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_efile_prefix
|
||||
* Signature: (J)Ljava/lang/String;
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_evict_on_close
|
||||
* Signature: (JZ)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
|
||||
(JNIEnv *, jclass, jlong, jboolean);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_evict_on_close
|
||||
* Signature: (J)Z
|
||||
*/
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pset_chunk_opts
|
||||
* Signature: (JI)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
|
||||
(JNIEnv *, jclass, jlong, jint);
|
||||
|
||||
/*
|
||||
* Class: hdf_hdf5lib_H5
|
||||
* Method: H5Pget_chunk_opts
|
||||
* Signature: (J)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
|
@ -415,6 +415,7 @@ JUnit version 4.11
|
||||
.testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue
|
||||
.testH5P_layout
|
||||
.testH5Pget_link_creation_order
|
||||
.testH5Pget_efile_prefix
|
||||
.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes
|
||||
.testH5P_file_space_page_size
|
||||
.testH5Pget_shared_mesg_index_Invalid_indexnum
|
||||
@ -444,6 +445,7 @@ JUnit version 4.11
|
||||
.testH5Pset_est_link_info_InvalidValues
|
||||
.testH5Pset_local_heap_size_hint
|
||||
.testH5Pget_est_link_info
|
||||
.testH5Pset_efile_prefix_null
|
||||
.testH5Pset_scaleoffset
|
||||
.testH5Pset_create_intermediate_group_invalidobject
|
||||
.testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue
|
||||
@ -466,6 +468,7 @@ JUnit version 4.11
|
||||
.testH5Pget_sym_k_null
|
||||
.testH5Pset_nlinks
|
||||
.testH5P_obj_track_times
|
||||
.testH5Pset_efile_prefix
|
||||
.testH5P_userblock
|
||||
.testH5Pget_local_heap_size_hint
|
||||
.testH5Pset_shared_mesg_index_Invalid_indexnum
|
||||
@ -502,8 +505,10 @@ JUnit version 4.11
|
||||
.testH5Fmdc_logging
|
||||
.testH5Pget_elink_fapl
|
||||
.testH5Pset_mdc_config
|
||||
.testH5P_vds_file_cache_size
|
||||
.testH5P_small_data_block_size
|
||||
.testH5Pset_fapl_log
|
||||
.testH5P_evict_on_close
|
||||
.testH5Pset_libver_bounds
|
||||
.testH5P_sieve_buf_size
|
||||
.testH5P_elink_file_cache_size
|
||||
@ -530,11 +535,14 @@ JUnit version 4.11
|
||||
.testH5Pget_source_datasetname
|
||||
.testH5Pvirtual_storage
|
||||
.testH5Pget_selection_source_dataset
|
||||
.testH5Pget_virtual_prefix
|
||||
.testH5Pget_source_filename
|
||||
.testH5Pset_get_virtual_printf_gap
|
||||
.testH5Pget_virtual_count
|
||||
.testH5Pset_virtual_prefix
|
||||
.testH5Pset_get_virtual_view
|
||||
.testH5Pget_mapping_parameters
|
||||
.testH5Pset_virtual_prefix_null
|
||||
.testH5P_genprop_basic_class
|
||||
.testH5P_genprop_class_iter
|
||||
.testH5P_genprop_basic_class_prop
|
||||
@ -640,7 +648,7 @@ JUnit version 4.11
|
||||
|
||||
Time: XXXX
|
||||
|
||||
OK (638 tests)
|
||||
OK (646 tests)
|
||||
|
||||
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
|
||||
#000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists
|
||||
|
@ -28,6 +28,7 @@ import hdf.hdf5lib.exceptions.HDF5LibraryException;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TestName;
|
||||
@ -852,7 +853,7 @@ public class TestH5P {
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pset_est_link_info: " + err);
|
||||
fail("H5Pset_elink_prefix: " + err);
|
||||
}
|
||||
assertTrue("H5Pset_elink_prefix", ret_val >= 0);
|
||||
}
|
||||
@ -1232,4 +1233,54 @@ public class TestH5P {
|
||||
fail("testH5P_file_space_page_size: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Pset_efile_prefix() {
|
||||
String prefix = "tmp";
|
||||
try {
|
||||
H5.H5Pset_efile_prefix(lapl_id, prefix);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pset_efile_prefix: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Pset_efile_prefix_null() throws Throwable{
|
||||
H5.H5Pset_efile_prefix(lapl_id, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Pget_efile_prefix() {
|
||||
String prefix = "tmp";
|
||||
String pre = "";
|
||||
|
||||
try {
|
||||
H5.H5Pset_efile_prefix(lapl_id, prefix);
|
||||
pre = H5.H5Pget_efile_prefix(lapl_id);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pget_efile_prefix: " + err);
|
||||
}
|
||||
assertTrue("The prefix: ", prefix.equals(pre));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testH5P_chunk_opts() {
|
||||
int chunk_opts = -1;
|
||||
|
||||
try {
|
||||
chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
|
||||
assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0);
|
||||
H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
|
||||
chunk_opts = H5.H5Pget_chunk_opts(ocpl_id);
|
||||
assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pget_lchunk_opts: " + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1376,4 +1376,45 @@ public class TestH5Pfapl {
|
||||
deleteH5file();
|
||||
_deleteLogFile();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5P_evict_on_close() {
|
||||
boolean ret_val_id = false;
|
||||
try {
|
||||
H5.H5Pset_evict_on_close(fapl_id, true);
|
||||
ret_val_id = H5.H5Pget_evict_on_close(fapl_id);
|
||||
assertTrue("H5P_evict_on_close", ret_val_id);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_evict_on_close: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5P_vds_file_cache_size() {
|
||||
int vds_size = 0;
|
||||
try {
|
||||
try {
|
||||
vds_size = H5.H5Pget_vds_file_cache_size(fapl_id);
|
||||
assertTrue("H5P_vds_file_cache_size default", vds_size == 0);
|
||||
}
|
||||
catch (UnsupportedOperationException err) {
|
||||
System.out.println(err.getMessage());
|
||||
}
|
||||
try {
|
||||
vds_size = 8;
|
||||
H5.H5Pset_vds_file_cache_size(fapl_id, vds_size);
|
||||
vds_size = H5.H5Pget_vds_file_cache_size(fapl_id);
|
||||
assertTrue("H5P_vds_file_cache_size 8", vds_size == 8);
|
||||
}
|
||||
catch (UnsupportedOperationException err) {
|
||||
System.out.println(err.getMessage());
|
||||
}
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5P_vds_file_cache_size: " + err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -429,4 +429,37 @@ public class TestH5Pvirtual {
|
||||
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Pset_virtual_prefix() {
|
||||
String prefix = "tmp";
|
||||
try {
|
||||
H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pset_virtual_prefix: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testH5Pset_virtual_prefix_null() throws Throwable{
|
||||
H5.H5Pset_virtual_prefix(H5dapl_id, null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testH5Pget_virtual_prefix() {
|
||||
String prefix = "tmp";
|
||||
String pre = "";
|
||||
|
||||
try {
|
||||
H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
|
||||
pre = H5.H5Pget_virtual_prefix(H5dapl_id);
|
||||
}
|
||||
catch (Throwable err) {
|
||||
err.printStackTrace();
|
||||
fail("H5Pget_virtual_prefix: " + err);
|
||||
}
|
||||
assertTrue("The prefix: ", prefix.equals(pre));
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,23 @@ New Features
|
||||
|
||||
Library:
|
||||
--------
|
||||
-
|
||||
- Add prefix option to VDS files.
|
||||
|
||||
Currently, VDS source files must be in the active directory to be
|
||||
found by the virtual file. Adding the option of a prefix to be set
|
||||
on the virtual file, using a data access property list (DAPL),
|
||||
allows the source files to located at an absolute or relative path
|
||||
to the virtual file.
|
||||
|
||||
New public APIs:
|
||||
herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char* prefix);
|
||||
ssize_t H5Pget_virtual_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size);
|
||||
herr_t H5Pset_vds_file_cache_size(hid_t plist_id, unsigned vds_size);
|
||||
herr_t H5Pget_vds_file_cache_size(hid_t plist_id, unsigned *vds_size);
|
||||
The prefix can also be set with an environment variable, HDF5_VDS_PREFIX.
|
||||
|
||||
(ADB - 2017/12/12, HDFFV-9724)
|
||||
|
||||
|
||||
Parallel Library:
|
||||
-----------------
|
||||
@ -119,6 +135,20 @@ New Features
|
||||
------------
|
||||
-
|
||||
|
||||
Java Library:
|
||||
----------------
|
||||
- Wrappers added for the following APIs:
|
||||
H5Pset_evict_on_close
|
||||
H5Pget_evict_on_close
|
||||
H5Pset_chunk_opts
|
||||
H5Pget_chunk_opts
|
||||
H5Pset_efile_prefix
|
||||
H5Pget_efile_prefix
|
||||
H5Pset_virtual_prefix
|
||||
H5Pget_virtual_prefix
|
||||
H5Pset_vds_file_cache_size
|
||||
H5Pget_vds_file_cache_size
|
||||
|
||||
Tools:
|
||||
------
|
||||
- h5diff
|
||||
|
952
src/H5Pfapl.c
952
src/H5Pfapl.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user