From 63249be0e10a8726acb5a7cf64491319eaa46227 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 28 Feb 2016 21:43:00 -0500 Subject: [PATCH] [svn-r29226] HDFFV-9552: merge in java code. --- CMakeLists.txt | 165 +- MANIFEST | 320 +- Makefile.am | 9 +- c++/src/CMakeLists.txt | 2 +- config/cmake/CMakeFindJavaCommon.cmake | 41 + config/cmake/FindHDFJAVA.cmake.in | 68 + config/cmake/FindJNI.cmake | 342 + config/cmake/README.txt.cmake.in | 1 + config/cmake/UseJava.cmake | 1290 +++ config/cmake/UseJavaClassFilelist.cmake | 58 + config/cmake/UseJavaSymlinks.cmake | 38 + config/cmake/hdf5-config.cmake.in | 14 + config/cmake/jrunTest.cmake | 212 + config/cmake/libhdf5.settings.cmake.in | 56 +- config/commence.am | 1 + configure.ac | 106 +- fortran/src/CMakeLists.txt | 4 +- fortran/test/CMakeLists.txt | 4 +- hl/c++/src/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 +- hl/src/CMakeLists.txt | 2 +- java/CMakeLists.txt | 77 + java/COPYING | 16 + java/Makefile.am | 38 + java/examples/CMakeLists.txt | 7 + java/examples/Makefile.am | 31 + java/examples/datasets/CMakeLists.txt | 121 + java/examples/datasets/H5Ex_D_Alloc.java | 301 + java/examples/datasets/H5Ex_D_Checksum.java | 347 + java/examples/datasets/H5Ex_D_Chunk.java | 366 + java/examples/datasets/H5Ex_D_Compact.java | 289 + java/examples/datasets/H5Ex_D_External.java | 238 + java/examples/datasets/H5Ex_D_FillValue.java | 246 + java/examples/datasets/H5Ex_D_Gzip.java | 336 + java/examples/datasets/H5Ex_D_Hyperslab.java | 269 + java/examples/datasets/H5Ex_D_Nbit.java | 305 + java/examples/datasets/H5Ex_D_ReadWrite.java | 179 + java/examples/datasets/H5Ex_D_Shuffle.java | 373 + java/examples/datasets/H5Ex_D_Sofloat.java | 356 + java/examples/datasets/H5Ex_D_Soint.java | 335 + java/examples/datasets/H5Ex_D_Szip.java | 337 + java/examples/datasets/H5Ex_D_Transform.java | 250 + .../datasets/H5Ex_D_UnlimitedAdd.java | 393 + .../datasets/H5Ex_D_UnlimitedGzip.java | 504 + .../datasets/H5Ex_D_UnlimitedMod.java | 379 + java/examples/datasets/Makefile.am | 78 + java/examples/datasets/runExample.sh.in | 413 + java/examples/datatypes/CMakeLists.txt | 109 + java/examples/datatypes/H5Ex_T_Array.java | 282 + .../datatypes/H5Ex_T_ArrayAttribute.java | 322 + java/examples/datatypes/H5Ex_T_Bit.java | 227 + .../datatypes/H5Ex_T_BitAttribute.java | 267 + java/examples/datatypes/H5Ex_T_Commit.java | 265 + java/examples/datatypes/H5Ex_T_Compound.java | 443 + .../datatypes/H5Ex_T_CompoundAttribute.java | 486 + java/examples/datatypes/H5Ex_T_Float.java | 227 + .../datatypes/H5Ex_T_FloatAttribute.java | 263 + java/examples/datatypes/H5Ex_T_Integer.java | 226 + .../datatypes/H5Ex_T_IntegerAttribute.java | 263 + .../datatypes/H5Ex_T_ObjectReference.java | 347 + .../H5Ex_T_ObjectReferenceAttribute.java | 389 + java/examples/datatypes/H5Ex_T_Opaque.java | 270 + .../datatypes/H5Ex_T_OpaqueAttribute.java | 307 + java/examples/datatypes/H5Ex_T_String.java | 311 + .../datatypes/H5Ex_T_StringAttribute.java | 351 + java/examples/datatypes/H5Ex_T_VLString.java | 138 + java/examples/datatypes/Makefile.am | 78 + java/examples/datatypes/runExample.sh.in | 408 + java/examples/groups/CMakeLists.txt | 138 + java/examples/groups/H5Ex_G_Compact.java | 266 + java/examples/groups/H5Ex_G_Corder.java | 121 + java/examples/groups/H5Ex_G_Create.java | 94 + java/examples/groups/H5Ex_G_Intermediate.java | 125 + java/examples/groups/H5Ex_G_Iterate.java | 119 + java/examples/groups/H5Ex_G_Phase.java | 241 + java/examples/groups/H5Ex_G_Traverse.java | 167 + java/examples/groups/H5Ex_G_Visit.java | 152 + java/examples/groups/Makefile.am | 68 + java/examples/groups/h5ex_g_iterate.h5 | Bin 0 -> 2928 bytes java/examples/groups/h5ex_g_visit.h5 | Bin 0 -> 6312 bytes java/examples/groups/runExample.sh.in | 349 + java/examples/intro/CMakeLists.txt | 112 + java/examples/intro/H5_CreateAttribute.java | 145 + java/examples/intro/H5_CreateDataset.java | 97 + java/examples/intro/H5_CreateFile.java | 55 + java/examples/intro/H5_CreateGroup.java | 76 + .../intro/H5_CreateGroupAbsoluteRelative.java | 118 + .../examples/intro/H5_CreateGroupDataset.java | 207 + java/examples/intro/H5_ReadWrite.java | 112 + java/examples/intro/Makefile.am | 67 + java/examples/intro/runExample.sh.in | 298 + .../examples.datasets.H5Ex_D_Alloc.txt | 16 + .../examples.datasets.H5Ex_D_Checksum.txt | 3 + .../examples.datasets.H5Ex_D_Chunk.txt | 26 + .../examples.datasets.H5Ex_D_Compact.txt | 8 + .../examples.datasets.H5Ex_D_External.txt | 7 + .../examples.datasets.H5Ex_D_FillValue.txt | 20 + .../examples.datasets.H5Ex_D_Gzip.txt | 3 + .../examples.datasets.H5Ex_D_Hyperslab.txt | 24 + .../examples.datasets.H5Ex_D_Nbit.txt | 3 + .../examples.datasets.H5Ex_D_ReadWrite.txt | 6 + .../examples.datasets.H5Ex_D_Shuffle.txt | 5 + .../examples.datasets.H5Ex_D_Sofloat.txt | 6 + .../examples.datasets.H5Ex_D_Soint.txt | 3 + .../examples.datasets.H5Ex_D_Szip.txt | 3 + .../examples.datasets.H5Ex_D_Transform.txt | 15 + .../examples.datasets.H5Ex_D_UnlimitedAdd.txt | 14 + ...examples.datasets.H5Ex_D_UnlimitedGzip.txt | 16 + .../examples.datasets.H5Ex_D_UnlimitedMod.txt | 14 + .../examples.datatypes.H5Ex_T_Array.txt | 21 + ...amples.datatypes.H5Ex_T_ArrayAttribute.txt | 21 + .../examples.datatypes.H5Ex_T_Bit.txt | 6 + ...examples.datatypes.H5Ex_T_BitAttribute.txt | 6 + .../examples.datatypes.H5Ex_T_Commit.txt | 6 + .../examples.datatypes.H5Ex_T_Compound.txt | 25 + ...les.datatypes.H5Ex_T_CompoundAttribute.txt | 25 + .../examples.datatypes.H5Ex_T_Float.txt | 6 + ...amples.datatypes.H5Ex_T_FloatAttribute.txt | 6 + .../examples.datatypes.H5Ex_T_Integer.txt | 6 + ...ples.datatypes.H5Ex_T_IntegerAttribute.txt | 6 + ...mples.datatypes.H5Ex_T_ObjectReference.txt | 4 + ...atypes.H5Ex_T_ObjectReferenceAttribute.txt | 4 + .../examples.datatypes.H5Ex_T_Opaque.txt | 6 + ...mples.datatypes.H5Ex_T_OpaqueAttribute.txt | 6 + .../examples.datatypes.H5Ex_T_String.txt | 5 + ...mples.datatypes.H5Ex_T_StringAttribute.txt | 5 + .../examples.datatypes.H5Ex_T_VLString.txt | 4 + .../examples.groups.H5Ex_G_Compact.txt | 5 + .../examples.groups.H5Ex_G_Corder.txt | 10 + .../examples.groups.H5Ex_G_Create.txt | 0 .../examples.groups.H5Ex_G_Intermediate.txt | 5 + .../examples.groups.H5Ex_G_Iterate.txt | 5 + .../examples.groups.H5Ex_G_Phase.txt | 15 + .../examples.groups.H5Ex_G_Visit.txt | 19 + .../examples.intro.H5_CreateAttribute.txt | 0 .../examples.intro.H5_CreateDataset.txt | 0 .../examples.intro.H5_CreateFile.txt | 0 .../examples.intro.H5_CreateGroup.txt | 0 ...s.intro.H5_CreateGroupAbsoluteRelative.txt | 0 .../examples.intro.H5_CreateGroupDataset.txt | 0 .../testfiles/examples.intro.H5_ReadWrite.txt | 0 java/lib/ext/slf4j-nop-1.7.5.jar | Bin 0 -> 4091 bytes java/lib/ext/slf4j-simple-1.7.5.jar | Bin 0 -> 10680 bytes java/lib/hamcrest-core.jar | Bin 0 -> 45024 bytes java/lib/junit.jar | Bin 0 -> 245039 bytes java/lib/simplelogger.properties | 36 + java/lib/slf4j-api-1.7.5.jar | Bin 0 -> 26084 bytes java/src/CMakeLists.txt | 8 + java/src/Makefile.am | 137 + java/src/hdf/CMakeLists.txt | 4 + java/src/hdf/hdf5lib/CMakeLists.txt | 124 + java/src/hdf/hdf5lib/H5.java | 9185 +++++++++++++++++ java/src/hdf/hdf5lib/HDF5Constants.java | 1877 ++++ java/src/hdf/hdf5lib/HDF5GroupInfo.java | 171 + java/src/hdf/hdf5lib/HDFArray.java | 1096 ++ java/src/hdf/hdf5lib/HDFNativeData.java | 481 + java/src/hdf/hdf5lib/callbacks/Callbacks.java | 33 + .../hdf/hdf5lib/callbacks/H5D_iterate_cb.java | 21 + .../hdf/hdf5lib/callbacks/H5D_iterate_t.java | 22 + .../hdf/hdf5lib/callbacks/H5L_iterate_cb.java | 23 + .../hdf/hdf5lib/callbacks/H5L_iterate_t.java | 22 + .../hdf/hdf5lib/callbacks/H5O_iterate_cb.java | 23 + .../hdf/hdf5lib/callbacks/H5O_iterate_t.java | 22 + .../hdf5lib/exceptions/HDF5AtomException.java | 44 + .../exceptions/HDF5AttributeException.java | 42 + .../exceptions/HDF5BtreeException.java | 42 + .../exceptions/HDF5DataFiltersException.java | 42 + .../exceptions/HDF5DataStorageException.java | 43 + .../HDF5DatasetInterfaceException.java | 42 + .../HDF5DataspaceInterfaceException.java | 43 + .../HDF5DatatypeInterfaceException.java | 43 + .../hdf/hdf5lib/exceptions/HDF5Exception.java | 68 + .../HDF5ExternalFileListException.java | 43 + .../HDF5FileInterfaceException.java | 43 + .../HDF5FunctionArgumentException.java | 43 + .../HDF5FunctionEntryExitException.java | 43 + .../hdf5lib/exceptions/HDF5HeapException.java | 43 + .../HDF5InternalErrorException.java | 43 + .../hdf5lib/exceptions/HDF5JavaException.java | 45 + .../exceptions/HDF5LibraryException.java | 383 + .../exceptions/HDF5LowLevelIOException.java | 43 + .../HDF5MetaDataCacheException.java | 43 + .../exceptions/HDF5ObjectHeaderException.java | 43 + .../HDF5PropertyListInterfaceException.java | 43 + .../exceptions/HDF5ReferenceException.java | 37 + .../HDF5ResourceUnavailableException.java | 43 + .../exceptions/HDF5SymbolTableException.java | 43 + .../hdf5lib/structs/H5AC_cache_config_t.java | 99 + java/src/hdf/hdf5lib/structs/H5A_info_t.java | 34 + java/src/hdf/hdf5lib/structs/H5G_info_t.java | 27 + java/src/hdf/hdf5lib/structs/H5L_info_t.java | 38 + .../hdf/hdf5lib/structs/H5O_hdr_info_t.java | 49 + java/src/hdf/hdf5lib/structs/H5O_info_t.java | 54 + .../src/hdf/hdf5lib/structs/H5_ih_info_t.java | 31 + java/src/jni/CMakeLists.txt | 84 + java/src/jni/Makefile.am | 44 + java/src/jni/exceptionImp.c | 414 + java/src/jni/exceptionImp.h | 67 + java/src/jni/h5Constants.c | 692 ++ java/src/jni/h5Imp.c | 181 + java/src/jni/h5Imp.h | 95 + java/src/jni/h5aImp.c | 879 ++ java/src/jni/h5aImp.h | 273 + java/src/jni/h5dImp.c | 1758 ++++ java/src/jni/h5dImp.h | 319 + java/src/jni/h5eImp.c | 524 + java/src/jni/h5eImp.h | 167 + java/src/jni/h5fImp.c | 516 + java/src/jni/h5fImp.h | 198 + java/src/jni/h5gImp.c | 257 + java/src/jni/h5gImp.h | 96 + java/src/jni/h5iImp.c | 289 + java/src/jni/h5iImp.h | 143 + java/src/jni/h5jni.h | 249 + java/src/jni/h5lImp.c | 736 ++ java/src/jni/h5lImp.h | 183 + java/src/jni/h5oImp.c | 766 ++ java/src/jni/h5oImp.h | 175 + java/src/jni/h5pImp.c | 5344 ++++++++++ java/src/jni/h5pImp.h | 1313 +++ java/src/jni/h5rImp.c | 324 + java/src/jni/h5rImp.h | 78 + java/src/jni/h5sImp.c | 1408 +++ java/src/jni/h5sImp.h | 288 + java/src/jni/h5tImp.c | 1588 +++ java/src/jni/h5tImp.h | 550 + java/src/jni/h5util.c | 2592 +++++ java/src/jni/h5util.h | 108 + java/src/jni/h5zImp.c | 84 + java/src/jni/h5zImp.h | 55 + java/src/jni/nativeData.c | 1195 +++ java/src/jni/nativeData.h | 115 + java/test/CMakeLists.txt | 114 + java/test/JUnit-interface.txt | 652 ++ java/test/Makefile.am | 103 + java/test/TestAll.java | 40 + java/test/TestH5.java | 257 + java/test/TestH5A.java | 1119 ++ java/test/TestH5D.java | 892 ++ java/test/TestH5Dparams.java | 134 + java/test/TestH5Dplist.java | 216 + java/test/TestH5E.java | 553 + java/test/TestH5Edefault.java | 564 + java/test/TestH5Eregister.java | 78 + java/test/TestH5F.java | 332 + java/test/TestH5Fbasic.java | 320 + java/test/TestH5Fparams.java | 215 + java/test/TestH5G.java | 505 + java/test/TestH5Gbasic.java | 371 + java/test/TestH5Giterate.java | 136 + java/test/TestH5Lbasic.java | 371 + java/test/TestH5Lcreate.java | 819 ++ java/test/TestH5Lparams.java | 231 + java/test/TestH5Obasic.java | 488 + java/test/TestH5Ocopy.java | 365 + java/test/TestH5Ocreate.java | 562 + java/test/TestH5Oparams.java | 154 + java/test/TestH5P.java | 1221 +++ java/test/TestH5PData.java | 170 + java/test/TestH5Pfapl.java | 1325 +++ java/test/TestH5R.java | 335 + java/test/TestH5S.java | 590 ++ java/test/TestH5Sbasic.java | 247 + java/test/TestH5T.java | 459 + java/test/TestH5Tbasic.java | 161 + java/test/TestH5Tparams.java | 389 + java/test/TestH5Z.java | 100 + java/test/h5ex_g_iterate.hdf | Bin 0 -> 2928 bytes java/test/junit.sh.in | 234 + m4/ax_check_class.m4 | 144 + m4/ax_check_classpath.m4 | 60 + m4/ax_check_java_home.m4 | 80 + m4/ax_check_junit.m4 | 70 + m4/ax_check_rqrd_class.m4 | 62 + m4/ax_java_check_class.m4 | 85 + m4/ax_java_options.m4 | 48 + m4/ax_jni_include_dir.m4 | 132 + m4/ax_prog_jar.m4 | 49 + m4/ax_prog_java.m4 | 115 + m4/ax_prog_java_cc.m4 | 104 + m4/ax_prog_java_works.m4 | 134 + m4/ax_prog_javac.m4 | 79 + m4/ax_prog_javac_works.m4 | 72 + m4/ax_prog_javadoc.m4 | 50 + m4/ax_prog_javah.m4 | 64 + m4/ax_try_compile_java.m4 | 55 + m4/ax_try_run_java.m4 | 56 + src/CMakeLists.txt | 2 +- src/libhdf5.settings.in | 3 + test/CMakeLists.txt | 6 +- 290 files changed, 74248 insertions(+), 46 deletions(-) create mode 100644 config/cmake/CMakeFindJavaCommon.cmake create mode 100644 config/cmake/FindHDFJAVA.cmake.in create mode 100644 config/cmake/FindJNI.cmake create mode 100644 config/cmake/UseJava.cmake create mode 100644 config/cmake/UseJavaClassFilelist.cmake create mode 100644 config/cmake/UseJavaSymlinks.cmake create mode 100644 config/cmake/jrunTest.cmake create mode 100644 java/CMakeLists.txt create mode 100644 java/COPYING create mode 100644 java/Makefile.am create mode 100644 java/examples/CMakeLists.txt create mode 100644 java/examples/Makefile.am create mode 100644 java/examples/datasets/CMakeLists.txt create mode 100644 java/examples/datasets/H5Ex_D_Alloc.java create mode 100644 java/examples/datasets/H5Ex_D_Checksum.java create mode 100644 java/examples/datasets/H5Ex_D_Chunk.java create mode 100644 java/examples/datasets/H5Ex_D_Compact.java create mode 100644 java/examples/datasets/H5Ex_D_External.java create mode 100644 java/examples/datasets/H5Ex_D_FillValue.java create mode 100644 java/examples/datasets/H5Ex_D_Gzip.java create mode 100644 java/examples/datasets/H5Ex_D_Hyperslab.java create mode 100644 java/examples/datasets/H5Ex_D_Nbit.java create mode 100644 java/examples/datasets/H5Ex_D_ReadWrite.java create mode 100644 java/examples/datasets/H5Ex_D_Shuffle.java create mode 100644 java/examples/datasets/H5Ex_D_Sofloat.java create mode 100644 java/examples/datasets/H5Ex_D_Soint.java create mode 100644 java/examples/datasets/H5Ex_D_Szip.java create mode 100644 java/examples/datasets/H5Ex_D_Transform.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedAdd.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedGzip.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedMod.java create mode 100644 java/examples/datasets/Makefile.am create mode 100644 java/examples/datasets/runExample.sh.in create mode 100644 java/examples/datatypes/CMakeLists.txt create mode 100644 java/examples/datatypes/H5Ex_T_Array.java create mode 100644 java/examples/datatypes/H5Ex_T_ArrayAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Bit.java create mode 100644 java/examples/datatypes/H5Ex_T_BitAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Commit.java create mode 100644 java/examples/datatypes/H5Ex_T_Compound.java create mode 100644 java/examples/datatypes/H5Ex_T_CompoundAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Float.java create mode 100644 java/examples/datatypes/H5Ex_T_FloatAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Integer.java create mode 100644 java/examples/datatypes/H5Ex_T_IntegerAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_ObjectReference.java create mode 100644 java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Opaque.java create mode 100644 java/examples/datatypes/H5Ex_T_OpaqueAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_String.java create mode 100644 java/examples/datatypes/H5Ex_T_StringAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_VLString.java create mode 100644 java/examples/datatypes/Makefile.am create mode 100644 java/examples/datatypes/runExample.sh.in create mode 100644 java/examples/groups/CMakeLists.txt create mode 100644 java/examples/groups/H5Ex_G_Compact.java create mode 100644 java/examples/groups/H5Ex_G_Corder.java create mode 100644 java/examples/groups/H5Ex_G_Create.java create mode 100644 java/examples/groups/H5Ex_G_Intermediate.java create mode 100644 java/examples/groups/H5Ex_G_Iterate.java create mode 100644 java/examples/groups/H5Ex_G_Phase.java create mode 100644 java/examples/groups/H5Ex_G_Traverse.java create mode 100644 java/examples/groups/H5Ex_G_Visit.java create mode 100644 java/examples/groups/Makefile.am create mode 100644 java/examples/groups/h5ex_g_iterate.h5 create mode 100644 java/examples/groups/h5ex_g_visit.h5 create mode 100644 java/examples/groups/runExample.sh.in create mode 100644 java/examples/intro/CMakeLists.txt create mode 100644 java/examples/intro/H5_CreateAttribute.java create mode 100644 java/examples/intro/H5_CreateDataset.java create mode 100644 java/examples/intro/H5_CreateFile.java create mode 100644 java/examples/intro/H5_CreateGroup.java create mode 100644 java/examples/intro/H5_CreateGroupAbsoluteRelative.java create mode 100644 java/examples/intro/H5_CreateGroupDataset.java create mode 100644 java/examples/intro/H5_ReadWrite.java create mode 100644 java/examples/intro/Makefile.am create mode 100644 java/examples/intro/runExample.sh.in create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_External.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Create.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateAttribute.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateDataset.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateFile.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroup.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt create mode 100644 java/examples/testfiles/examples.intro.H5_ReadWrite.txt create mode 100644 java/lib/ext/slf4j-nop-1.7.5.jar create mode 100644 java/lib/ext/slf4j-simple-1.7.5.jar create mode 100644 java/lib/hamcrest-core.jar create mode 100644 java/lib/junit.jar create mode 100644 java/lib/simplelogger.properties create mode 100644 java/lib/slf4j-api-1.7.5.jar create mode 100644 java/src/CMakeLists.txt create mode 100644 java/src/Makefile.am create mode 100644 java/src/hdf/CMakeLists.txt create mode 100644 java/src/hdf/hdf5lib/CMakeLists.txt create mode 100644 java/src/hdf/hdf5lib/H5.java create mode 100644 java/src/hdf/hdf5lib/HDF5Constants.java create mode 100644 java/src/hdf/hdf5lib/HDF5GroupInfo.java create mode 100644 java/src/hdf/hdf5lib/HDFArray.java create mode 100644 java/src/hdf/hdf5lib/HDFNativeData.java create mode 100644 java/src/hdf/hdf5lib/callbacks/Callbacks.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5Exception.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java create mode 100644 java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5A_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5G_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5L_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5O_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5_ih_info_t.java create mode 100644 java/src/jni/CMakeLists.txt create mode 100644 java/src/jni/Makefile.am create mode 100644 java/src/jni/exceptionImp.c create mode 100644 java/src/jni/exceptionImp.h create mode 100644 java/src/jni/h5Constants.c create mode 100644 java/src/jni/h5Imp.c create mode 100644 java/src/jni/h5Imp.h create mode 100644 java/src/jni/h5aImp.c create mode 100644 java/src/jni/h5aImp.h create mode 100644 java/src/jni/h5dImp.c create mode 100644 java/src/jni/h5dImp.h create mode 100644 java/src/jni/h5eImp.c create mode 100644 java/src/jni/h5eImp.h create mode 100644 java/src/jni/h5fImp.c create mode 100644 java/src/jni/h5fImp.h create mode 100644 java/src/jni/h5gImp.c create mode 100644 java/src/jni/h5gImp.h create mode 100644 java/src/jni/h5iImp.c create mode 100644 java/src/jni/h5iImp.h create mode 100644 java/src/jni/h5jni.h create mode 100644 java/src/jni/h5lImp.c create mode 100644 java/src/jni/h5lImp.h create mode 100644 java/src/jni/h5oImp.c create mode 100644 java/src/jni/h5oImp.h create mode 100644 java/src/jni/h5pImp.c create mode 100644 java/src/jni/h5pImp.h create mode 100644 java/src/jni/h5rImp.c create mode 100644 java/src/jni/h5rImp.h create mode 100644 java/src/jni/h5sImp.c create mode 100644 java/src/jni/h5sImp.h create mode 100644 java/src/jni/h5tImp.c create mode 100644 java/src/jni/h5tImp.h create mode 100644 java/src/jni/h5util.c create mode 100644 java/src/jni/h5util.h create mode 100644 java/src/jni/h5zImp.c create mode 100644 java/src/jni/h5zImp.h create mode 100644 java/src/jni/nativeData.c create mode 100644 java/src/jni/nativeData.h create mode 100644 java/test/CMakeLists.txt create mode 100644 java/test/JUnit-interface.txt create mode 100644 java/test/Makefile.am create mode 100644 java/test/TestAll.java create mode 100644 java/test/TestH5.java create mode 100644 java/test/TestH5A.java create mode 100644 java/test/TestH5D.java create mode 100644 java/test/TestH5Dparams.java create mode 100644 java/test/TestH5Dplist.java create mode 100644 java/test/TestH5E.java create mode 100644 java/test/TestH5Edefault.java create mode 100644 java/test/TestH5Eregister.java create mode 100644 java/test/TestH5F.java create mode 100644 java/test/TestH5Fbasic.java create mode 100644 java/test/TestH5Fparams.java create mode 100644 java/test/TestH5G.java create mode 100644 java/test/TestH5Gbasic.java create mode 100644 java/test/TestH5Giterate.java create mode 100644 java/test/TestH5Lbasic.java create mode 100644 java/test/TestH5Lcreate.java create mode 100644 java/test/TestH5Lparams.java create mode 100644 java/test/TestH5Obasic.java create mode 100644 java/test/TestH5Ocopy.java create mode 100644 java/test/TestH5Ocreate.java create mode 100644 java/test/TestH5Oparams.java create mode 100644 java/test/TestH5P.java create mode 100644 java/test/TestH5PData.java create mode 100644 java/test/TestH5Pfapl.java create mode 100644 java/test/TestH5R.java create mode 100644 java/test/TestH5S.java create mode 100644 java/test/TestH5Sbasic.java create mode 100644 java/test/TestH5T.java create mode 100644 java/test/TestH5Tbasic.java create mode 100644 java/test/TestH5Tparams.java create mode 100644 java/test/TestH5Z.java create mode 100644 java/test/h5ex_g_iterate.hdf create mode 100644 java/test/junit.sh.in create mode 100644 m4/ax_check_class.m4 create mode 100644 m4/ax_check_classpath.m4 create mode 100644 m4/ax_check_java_home.m4 create mode 100644 m4/ax_check_junit.m4 create mode 100644 m4/ax_check_rqrd_class.m4 create mode 100644 m4/ax_java_check_class.m4 create mode 100644 m4/ax_java_options.m4 create mode 100644 m4/ax_jni_include_dir.m4 create mode 100644 m4/ax_prog_jar.m4 create mode 100644 m4/ax_prog_java.m4 create mode 100644 m4/ax_prog_java_cc.m4 create mode 100644 m4/ax_prog_java_works.m4 create mode 100644 m4/ax_prog_javac.m4 create mode 100644 m4/ax_prog_javac_works.m4 create mode 100644 m4/ax_prog_javadoc.m4 create mode 100644 m4/ax_prog_javah.m4 create mode 100644 m4/ax_try_compile_java.m4 create mode 100644 m4/ax_try_run_java.m4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b55c6edee..4fb9262a350 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,9 @@ set (HDF5_F90_TEST_LIB_CORENAME "hdf5_test_fortran") set (HDF5_F90_C_TEST_LIB_CORENAME "hdf5_test_f90cstub") set (HDF5_HL_F90_LIB_CORENAME "hdf5_hl_fortran") set (HDF5_HL_F90_C_LIB_CORENAME "hdf5_hl_f90cstub") +set (HDF5_JAVA_JNI_LIB_CORENAME "hdf5_java") +set (HDF5_JAVA_HDF5_LIB_CORENAME "jarhdf5") +set (HDF5_JAVA_TEST_LIB_CORENAME "jartest5") #----------------------------------------------------------------------------- # Set the true names of all the libraries if customized by external project @@ -137,6 +140,9 @@ set (HDF5_F90_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_TEST_LIB_ set (HDF5_F90_C_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_TEST_LIB_CORENAME}") set (HDF5_HL_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_LIB_CORENAME}") set (HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_CORENAME}") +set (HDF5_JAVA_JNI_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_JNI_LIB_CORENAME}") +set (HDF5_JAVA_HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_HDF5_LIB_CORENAME}") +set (HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB_CORENAME}") #----------------------------------------------------------------------------- # Set the target names of all the libraries @@ -153,6 +159,9 @@ set (HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-static") set (HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-static") set (HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-static") set (HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-static") +set (HDF5_JAVA_JNI_LIB_TARGET "${HDF5_JAVA_JNI_LIB_CORENAME}") +set (HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}") +set (HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}") set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared") set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared") set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared") @@ -180,20 +189,37 @@ set (HDF5_HL_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/hl/c++) set (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools) set (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/tools/perform) set (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran) +set (HDF5_JAVA_JNI_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/jni) +set (HDF5_JAVA_HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/hdf) +set (HDF5_JAVA_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/java/test) +set (HDF5_JAVA_LIB_DIR ${HDF5_SOURCE_DIR}/java/lib) +set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.jar) +set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar) +set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar) + +if (APPLE) + option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) +endif (APPLE) if (NOT HDF5_INSTALL_BIN_DIR) set (HDF5_INSTALL_BIN_DIR bin) endif (NOT HDF5_INSTALL_BIN_DIR) if (NOT HDF5_INSTALL_LIB_DIR) if (APPLE) + if (HDF5_BUILD_FRAMEWORKS) + set (HDF5_INSTALL_JAR_DIR ../Java) + else (HDF5_BUILD_FRAMEWORKS) + set (HDF5_INSTALL_JAR_DIR lib) + endif (HDF5_BUILD_FRAMEWORKS) set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + else (APPLE) + set (HDF5_INSTALL_JAR_DIR lib) endif (APPLE) set (HDF5_INSTALL_LIB_DIR lib) endif (NOT HDF5_INSTALL_LIB_DIR) if (NOT HDF5_INSTALL_INCLUDE_DIR) set (HDF5_INSTALL_INCLUDE_DIR include) endif (NOT HDF5_INSTALL_INCLUDE_DIR) -option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) if (NOT HDF5_INSTALL_DATA_DIR) if (NOT WIN32) if (APPLE) @@ -242,6 +268,83 @@ string (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents}) MATH (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) message (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +string (REGEX MATCH ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_TOOLS_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_TOOLS_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_TOOLS_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_TOOLS_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) + message (STATUS "SOVERSION_TOOLS: ${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_CXX_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) + message (STATUS "SOVERSION_CXX: ${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_F_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_F_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) + message (STATUS "SOVERSION_F: ${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL: ${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_CXX_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL_CXX: ${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_F_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_F_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL_F: ${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_JAVA_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_JAVA_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_JAVA_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_JAVA_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_JAVA_SOVERS_MAJOR ${H5_JAVA_SOVERS_INTERFACE}-${H5_JAVA_SOVERS_RELEASE}) + message (STATUS "SOVERSION_JAVA: ${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") +endif() #----------------------------------------------------------------------------- # Basic HDF5 stuff here @@ -257,6 +360,41 @@ else (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") endif (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") set (HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +if(H5_TOOLS_SOVERS_EXISTS) + set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") +else() + set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_CXX_SOVERS_EXISTS) + set (HDF5_CXX_PACKAGE_SOVERSION "${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") +else() + set (HDF5_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_F_SOVERS_EXISTS) + set (HDF5_F_PACKAGE_SOVERSION "${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") +else() + set (HDF5_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_SOVERS_EXISTS) + set (HDF5_HL_PACKAGE_SOVERSION "${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") +else() + set (HDF5_HL_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_F_SOVERS_EXISTS) + set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") +else() + set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_F_SOVERS_EXISTS) + set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") +else() + set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_JAVA_SOVERS_EXISTS) + set (HDF5_PACKAGE_SOVERSION "${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") +else() + set (HDF5_JAVA_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() set (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") set (HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}") set (HDF5_PACKAGE_URL "http://www.hdfgroup.org") @@ -285,6 +423,11 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) set (CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) + if (WIN32) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + else (WIN32) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif (WIN32) else (NOT HDF5_EXTERNALLY_CONFIGURED) # if we are externally configured, but the project uses old cmake scripts # this may not be set and utilities like H5detect will fail @@ -773,11 +916,21 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" # Check if Fortran's default real is double precision. If it is and HL is # being built then configure should fail due to bug HDFFV-889. #----------------------------------------------------------------------------- - if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) - if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) - message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") - endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) - endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) +if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) + if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) + message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") + endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) +endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) + +#----------------------------------------------------------------------------- +# Option to build HDF5 Java Library +#----------------------------------------------------------------------------- +if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") + option (HDF5_BUILD_JAVA "Build Java HDF5 Library" ON) + if (HDF5_BUILD_JAVA) + add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java) + endif (HDF5_BUILD_JAVA) +endif (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation diff --git a/MANIFEST b/MANIFEST index 004cfb5880b..27be844bf0f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -27,14 +27,33 @@ ./MANIFEST ./Makefile.dist ./Makefile.am -./m4/aclocal_fc.m4 -./m4/aclocal_cxx.m4 ./README.txt ./BRANCH.txt ./acsite.m4 ./autogen.sh ./configure.ac +./m4/aclocal_cxx.m4 +./m4/aclocal_fc.m4 +./m4/ax_check_class.m4 +./m4/ax_check_classpath.m4 +./m4/ax_check_java_home.m4 +./m4/ax_check_junit.m4 +./m4/ax_check_rqrd_class.m4 +./m4/ax_java_check_class.m4 +./m4/ax_java_options.m4 +./m4/ax_jni_include_dir.m4 +./m4/ax_prog_jar.m4 +./m4/ax_prog_java_cc.m4 +./m4/ax_prog_java_works.m4 +./m4/ax_prog_java.m4 +./m4/ax_prog_javac_works.m4 +./m4/ax_prog_javac.m4 +./m4/ax_prog_javadoc.m4 +./m4/ax_prog_javah.m4 +./m4/ax_try_compile_java.m4 +./m4/ax_try_run_java.m4 + ./bin/COPYING ./bin/bbrelease _DO_NOT_DISTRIBUTE_ ./bin/buildhdf5 @@ -2416,13 +2435,306 @@ ./hl/c++/test/ptableTest.cpp ./hl/c++/test/Makefile.am +# java +./java/COPYING +./java/Makefile.am +./java/CMakeLists.txt + +./java/src/Makefile.am +./java/src/CMakeLists.txt +./java/src/jni/Makefile.am +./java/src/jni/CMakeLists.txt +./java/src/jni/exceptionImp.c +./java/src/jni/exceptionImp.h +./java/src/jni/h5Constants.c +./java/src/jni/nativeData.c +./java/src/jni/nativeData.h +./java/src/jni/h5jni.h +./java/src/jni/h5util.c +./java/src/jni/h5util.h +./java/src/jni/h5Imp.c +./java/src/jni/h5Imp.h +./java/src/jni/h5aImp.c +./java/src/jni/h5aImp.h +./java/src/jni/h5dImp.c +./java/src/jni/h5dImp.h +./java/src/jni/h5eImp.c +./java/src/jni/h5eImp.h +./java/src/jni/h5fImp.c +./java/src/jni/h5fImp.h +./java/src/jni/h5gImp.c +./java/src/jni/h5gImp.h +./java/src/jni/h5iImp.c +./java/src/jni/h5iImp.h +./java/src/jni/h5lImp.c +./java/src/jni/h5lImp.h +./java/src/jni/h5oImp.c +./java/src/jni/h5oImp.h +./java/src/jni/h5pImp.c +./java/src/jni/h5pImp.h +./java/src/jni/h5plImp.c +./java/src/jni/h5plImp.h +./java/src/jni/h5rImp.c +./java/src/jni/h5rImp.h +./java/src/jni/h5sImp.c +./java/src/jni/h5sImp.h +./java/src/jni/h5tImp.c +./java/src/jni/h5tImp.h +./java/src/jni/h5zImp.c +./java/src/jni/h5zImp.h + +./java/src/hdf/CMakeLists.txt +./java/src/hdf/hdf5lib/CMakeLists.txt + +./java/src/hdf/hdf5lib/callbacks/Callbacks.java +./java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java +./java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java +./java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java + +./java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java +./java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java +./java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5Exception.java +./java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java +./java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java +./java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java +./java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java +./java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +./java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java +./java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java +./java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java +./java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java + +./java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +./java/src/hdf/hdf5lib/structs/H5A_info_t.java +./java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java +./java/src/hdf/hdf5lib/structs/H5E_error2_t.java +./java/src/hdf/hdf5lib/structs/H5F_info2_t.java +./java/src/hdf/hdf5lib/structs/H5G_info_t.java +./java/src/hdf/hdf5lib/structs/H5L_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_info_t.java + +./java/src/hdf/hdf5lib/H5.java +./java/src/hdf/hdf5lib/HDF5Constants.java +./java/src/hdf/hdf5lib/HDF5GroupInfo.java +./java/src/hdf/hdf5lib/HDFArray.java +./java/src/hdf/hdf5lib/HDFNativeData.java + +./java/examples/Makefile.am +./java/examples/CMakeLists.txt + +./java/examples/intro/Makefile.am +./java/examples/intro/CMakeLists.txt +./java/examples/intro/runExample.sh.in +./java/examples/intro/H5_CreateAttribute.java +./java/examples/intro/H5_CreateDataset.java +./java/examples/intro/H5_CreateFile.java +./java/examples/intro/H5_CreateGroup.java +./java/examples/intro/H5_CreateGroupAbsoluteRelative.java +./java/examples/intro/H5_CreateGroupDataset.java +./java/examples/intro/H5_ReadWrite.java + +./java/examples/groups/Makefile.am +./java/examples/groups/CMakeLists.txt +./java/examples/groups/runExample.sh.in +./java/examples/groups/H5Ex_G_Create.java +./java/examples/groups/H5Ex_G_Iterate.java +./java/examples/groups/H5Ex_G_Compact.java +./java/examples/groups/H5Ex_G_Corder.java +./java/examples/groups/H5Ex_G_Intermediate.java +./java/examples/groups/H5Ex_G_Phase.java +./java/examples/groups/H5Ex_G_Traverse.java +./java/examples/groups/H5Ex_G_Visit.java +./java/examples/groups/h5ex_g_iterate.h5 +./java/examples/groups/h5ex_g_visit.h5 + +./java/examples/datasets/Makefile.am +./java/examples/datasets/CMakeLists.txt +./java/examples/datasets/runExample.sh.in +./java/examples/datasets/H5Ex_D_Alloc.java +./java/examples/datasets/H5Ex_D_Checksum.java +./java/examples/datasets/H5Ex_D_Chunk.java +./java/examples/datasets/H5Ex_D_Compact.java +./java/examples/datasets/H5Ex_D_External.java +./java/examples/datasets/H5Ex_D_FillValue.java +./java/examples/datasets/H5Ex_D_Gzip.java +./java/examples/datasets/H5Ex_D_Hyperslab.java +./java/examples/datasets/H5Ex_D_ReadWrite.java +./java/examples/datasets/H5Ex_D_Shuffle.java +./java/examples/datasets/H5Ex_D_Szip.java +./java/examples/datasets/H5Ex_D_UnlimitedAdd.java +./java/examples/datasets/H5Ex_D_UnlimitedGzip.java +./java/examples/datasets/H5Ex_D_UnlimitedMod.java +./java/examples/datasets/H5Ex_D_Nbit.java +./java/examples/datasets/H5Ex_D_Transform.java +./java/examples/datasets/H5Ex_D_Sofloat.java +./java/examples/datasets/H5Ex_D_Soint.java + +./java/examples/datatypes/Makefile.am +./java/examples/datatypes/CMakeLists.txt +./java/examples/datatypes/runExample.sh.in +./java/examples/datatypes/H5Ex_T_Array.java +./java/examples/datatypes/H5Ex_T_ArrayAttribute.java +./java/examples/datatypes/H5Ex_T_Bit.java +./java/examples/datatypes/H5Ex_T_BitAttribute.java +./java/examples/datatypes/H5Ex_T_Commit.java +./java/examples/datatypes/H5Ex_T_Compound.java +./java/examples/datatypes/H5Ex_T_CompoundAttribute.java +./java/examples/datatypes/H5Ex_T_Float.java +./java/examples/datatypes/H5Ex_T_FloatAttribute.java +./java/examples/datatypes/H5Ex_T_Integer.java +./java/examples/datatypes/H5Ex_T_IntegerAttribute.java +./java/examples/datatypes/H5Ex_T_ObjectReference.java +./java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java +./java/examples/datatypes/H5Ex_T_Opaque.java +./java/examples/datatypes/H5Ex_T_OpaqueAttribute.java +./java/examples/datatypes/H5Ex_T_String.java +./java/examples/datatypes/H5Ex_T_StringAttribute.java +./java/examples/datatypes/H5Ex_T_VLString.java + +./java/examples/testfiles/examples.intro.H5_CreateAttribute.txt +./java/examples/testfiles/examples.intro.H5_CreateDataset.txt +./java/examples/testfiles/examples.intro.H5_CreateFile.txt +./java/examples/testfiles/examples.intro.H5_CreateGroup.txt +./java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt +./java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt +./java/examples/testfiles/examples.intro.H5_ReadWrite.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Create.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_External.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt + +./java/test/Makefile.am +./java/test/CMakeLists.txt +./java/test/junit.sh.in +./java/test/JUnit-interface.txt +./java/test/h5ex_g_iterate.hdf +./java/test/TestH5.java +./java/test/TestH5A.java +./java/test/TestH5Dparams.java +./java/test/TestH5D.java +./java/test/TestH5Dplist.java +./java/test/TestH5E.java +./java/test/TestH5Edefault.java +./java/test/TestH5Eregister.java +./java/test/TestH5Fparams.java +./java/test/TestH5Fbasic.java +./java/test/TestH5F.java +./java/test/TestH5Gbasic.java +./java/test/TestH5G.java +./java/test/TestH5Giterate.java +./java/test/TestH5Lparams.java +./java/test/TestH5Lbasic.java +./java/test/TestH5Lcreate.java +./java/test/TestH5Oparams.java +./java/test/TestH5Obasic.java +./java/test/TestH5Ocreate.java +./java/test/TestH5Ocopy.java +./java/test/TestH5P.java +./java/test/TestH5PData.java +./java/test/TestH5Pfapl.java +./java/test/TestH5Plist.java +./java/test/TestH5Pvirtual.java +./java/test/TestH5PL.java +./java/test/TestH5R.java +./java/test/TestH5Sbasic.java +./java/test/TestH5S.java +./java/test/TestH5Tparams.java +./java/test/TestH5Tbasic.java +./java/test/TestH5T.java +./java/test/TestH5Z.java +./java/test/TestAll.java + +./java/lib/hamcrest-core.jar +./java/lib/junit.jar +./java/lib/simplelogger.properties +./java/lib/slf4j-api-1.7.5.jar +./java/lib/ext/slf4j-nop-1.7.5.jar +./java/lib/ext/slf4j-simple-1.7.5.jar + # CMake-specific Files ./config/cmake/cacheinit.cmake +./config/cmake/CMakeFindJavaCommon.cmake ./config/cmake/ConversionTests.c ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake ./config/cmake/FindHDF5.cmake.in +./config/cmake/FindHDFJAVA.cmake.in +./config/cmake/FindJNI.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in @@ -2431,11 +2743,15 @@ ./config/cmake/HDF5_Process_Flex_Files.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5UseFortran.cmake +./config/cmake/jrunTest.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/mccacheinit.cmake ./config/cmake/patch.xml ./config/cmake/PkgInfo.in ./config/cmake/README.txt.cmake.in +./config/cmake/UseJava.cmake +./config/cmake/UseJavaClassFilelist.cmake +./config/cmake/UseJavaSymlinks.cmake ./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake diff --git a/Makefile.am b/Makefile.am index c34f2cd0e24..bbab3460f06 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,6 +66,11 @@ if BUILD_FORTRAN_CONDITIONAL else FORTRAN_DIR= endif +if BUILD_JAVA_CONDITIONAL + JAVA_DIR=java +else + JAVA_DIR= +endif if BUILD_HDF5_HL_CONDITIONAL HDF5_HL_DIR =hl else @@ -73,8 +78,8 @@ else endif SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \ - $(HDF5_HL_DIR) -DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples + $(JAVA_DIR) $(HDF5_HL_DIR) +DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples java # Some files generated during configure that should be cleaned DISTCLEANFILES=config/stamp1 config/stamp2 diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 473605a310d..1a182e34fc8 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -94,7 +94,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED ${HDF5_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/config/cmake/CMakeFindJavaCommon.cmake b/config/cmake/CMakeFindJavaCommon.cmake new file mode 100644 index 00000000000..fcf038970b6 --- /dev/null +++ b/config/cmake/CMakeFindJavaCommon.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2013-2014 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Do not include this module directly from code outside CMake! +set(_JAVA_HOME "") +if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}") + set(_JAVA_HOME "${JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 1) +else() + set(_ENV_JAVA_HOME "") + if(DEFINED ENV{JAVA_HOME}) + file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME) + endif() + if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}") + set(_JAVA_HOME "${_ENV_JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 1) + else() + set(_CMD_JAVA_HOME "") + if(APPLE AND EXISTS /usr/libexec/java_home) + execute_process(COMMAND /usr/libexec/java_home + OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(_CMD_JAVA_HOME AND IS_DIRECTORY "${_CMD_JAVA_HOME}") + set(_JAVA_HOME "${_CMD_JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 0) + endif() + unset(_CMD_JAVA_HOME) + endif() + unset(_ENV_JAVA_HOME) +endif() diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in new file mode 100644 index 00000000000..b822280c8ff --- /dev/null +++ b/config/cmake/FindHDFJAVA.cmake.in @@ -0,0 +1,68 @@ +# +# To be used by projects that make use of CMakeified hdf-java +# + +# +# Find the HDFJAVA includes and get all installed hdf-java library settings from +# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later +# for this feature to work. The following vars are set if hdf-java is found. +# +# HDFJAVA_FOUND - True if found, otherwise all other vars are undefined +# HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) +# HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) +# HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) +# +# Target names that are valid (depending on enabled options) +# will be the following +# +# +# To aid in finding HDFJAVA as part of a subproject set +# HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies + +INCLUDE (SelectLibraryConfigurations) +INCLUDE (FindPackageHandleStandardArgs) + +# The HINTS option should only be used for values computed from the system. +set (_HDFJAVA_HINTS + $ENV{HOME}/.local + $ENV{HDFJAVA_ROOT} + $ENV{HDFJAVA_ROOT_DIR_HINT} +) +# Hard-coded guesses should still go in PATHS. This ensures that the user +# environment can always override hard guesses. +set (_HDFJAVA_PATHS + $ENV{HOME}/.local + $ENV{HDFJAVA_ROOT} + $ENV{HDFJAVA_ROOT_DIR_HINT} + /usr/lib/@HDFJAVA_PACKAGE@ + /usr/share/@HDFJAVA_PACKAGE@ + /usr/local/@HDFJAVA_PACKAGE@ + /usr/local/@HDFJAVA_PACKAGE@/share +) + +FIND_PATH (HDFJAVA_ROOT_DIR "@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" + HINTS ${_HDFJAVA_HINTS} + PATHS ${_HDFJAVA_PATHS} + PATH_SUFFIXES + cmake/@HDFJAVA_PACKAGE@ + lib/cmake/@HDFJAVA_PACKAGE@ + share/cmake/@HDFJAVA_PACKAGE@ +) + +FIND_PATH (HDFJAVA_LIBRARY "jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar" + HINTS ${_HDFJAVA_HINTS} + PATHS ${_HDFJAVA_PATHS} + PATH_SUFFIXES + lib +) + +if (HDFJAVA_ROOT_DIR) + set (HDFJAVA_FOUND "YES") + INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) + set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") + set (HDFJAVA_INCLUDE_DIRS + ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar + ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar + ) + +endif (HDFJAVA_ROOT_DIR) diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake new file mode 100644 index 00000000000..440a9889f66 --- /dev/null +++ b/config/cmake/FindJNI.cmake @@ -0,0 +1,342 @@ +#.rst: +# FindJNI +# ------- +# +# Find JNI java libraries. +# +# This module finds if Java is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. The caller may set variable JAVA_HOME to specify a +# Java installation prefix explicitly. +# +# This module sets the following result variables: +# +# :: +# +# JNI_INCLUDE_DIRS = the include dirs to use +# JNI_LIBRARIES = the libraries to use +# JNI_FOUND = TRUE if JNI headers and libraries were found. +# JAVA_AWT_LIBRARY = the path to the jawt library +# JAVA_JVM_LIBRARY = the path to the jvm library +# JAVA_INCLUDE_PATH = the include path to jni.h +# JAVA_INCLUDE_PATH2 = the include path to jni_md.h +# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} +macro(java_append_library_directories _var) + # Determine java arch-specific library subdir + # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk + # 1.6.0_18 + icedtea patches. However, it would be much better to base the + # guess on the first part of the GNU config.guess platform triplet. + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32") + set(_java_libarch "x32" "amd64" "i386") + else() + set(_java_libarch "amd64" "i386") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(_java_libarch "i386") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") + set(_java_libarch "alpha") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + # Subdir is "arm" for both big-endian (arm) and little-endian (armel). + set(_java_libarch "arm") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + # mips* machines are bi-endian mostly so processor does not tell + # endianess of the underlying system. + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") + set(_java_libarch "ppc64" "ppc64le") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") + set(_java_libarch "ppc64" "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + set(_java_libarch "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") + # Both flavours can run on the same processor + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") + set(_java_libarch "parisc" "parisc64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") + # s390 binaries can run on s390x machines + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") + set(_java_libarch "sh") + else() + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") + endif() + + # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or + # system is non-Linux (where the code above has not been well tested) + if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + list(APPEND _java_libarch "i386" "amd64" "ppc") + endif() + + # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer + # current value to a hardcoded list. Remove possible duplicates. + list(REMOVE_DUPLICATES _java_libarch) + + foreach(_path ${ARGN}) + if(_path MATCHES "{libarch}") + foreach(_libarch ${_java_libarch}) + string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") + list(APPEND ${_var} "${_newpath}") + endforeach() + else() + list(APPEND ${_var} "${_path}") + endif() + endforeach() +endmacro() + +#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake) +INCLUDE (CMakeFindJavaCommon) + +# Save CMAKE_FIND_FRAMEWORK +if(DEFINED CMAKE_FIND_FRAMEWORK) + set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) +else() + unset(_JNI_CMAKE_FIND_FRAMEWORK) +endif() + +if(_JAVA_HOME_EXPLICIT) + set(CMAKE_FIND_FRAMEWORK NEVER) +endif() + +set(JAVA_AWT_LIBRARY_DIRECTORIES) +if(_JAVA_HOME) + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${_JAVA_HOME}/jre/lib/{libarch} + ${_JAVA_HOME}/jre/lib + ${_JAVA_HOME}/lib/{libarch} + ${_JAVA_HOME}/lib + ${_JAVA_HOME} + ) +endif() +get_filename_component(java_install_version + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) + +list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" + ) +JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + /usr/java/lib + /usr/java/jre/lib + /usr/lib + /usr/lib64 + /usr/local/lib + /usr/local/lib64 + /usr/lib/jvm/java/lib + /usr/lib64/jvm/java/lib + /usr/lib/java/jre/lib/{libarch} + /usr/lib64/java/jre/lib/{libarch} + /usr/lib/jvm/jre/lib/{libarch} + /usr/lib64/jvm/jre/lib/{libarch} + /usr/local/lib/java/jre/lib/{libarch} + /usr/local/share/java/jre/lib/{libarch} + /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} + /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} + /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun/jre/lib/{libarch} + /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} + /usr/lib/jvm/java-7-openjdk/jre/lib/{libarch} + /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} + /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora + # Debian specific paths for default JVM + /usr/lib/jvm/default-java/jre/lib/{libarch} + /usr/lib/jvm/default-java/jre/lib + /usr/lib/jvm/default-java/lib + # OpenBSD specific paths for default JVM + /usr/local/jdk-1.7.0/jre/lib/{libarch} + /usr/local/jre-1.7.0/lib/{libarch} + /usr/local/jdk-1.6.0/jre/lib/{libarch} + /usr/local/jre-1.6.0/lib/{libarch} + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/jre/lib/{libarch} + /usr/lib64/jvm/jre/lib/{libarch} + ) + +set(JAVA_JVM_LIBRARY_DIRECTORIES) +foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) + list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES + "${dir}" + "${dir}/client" + "${dir}/server" + # IBM SDK, Java Technology Edition, specific paths + "${dir}/j9vm" + "${dir}/default" + ) +endforeach() + +set(JAVA_AWT_INCLUDE_DIRECTORIES) +if(_JAVA_HOME) + list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include) +endif() +list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" + ${_JAVA_HOME}/include + /usr/include + /usr/java/include + /usr/local/include + /usr/lib/java/include + /usr/lib64/java/include + /usr/local/lib/java/include + /usr/lib/jvm/java/include + /usr/lib64/jvm/java/include + /usr/lib/jvm/java-6-sun/include + /usr/lib/jvm/java-1.5.0-sun/include + /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/include + /usr/lib/jvm/java-7-openjdk/include + /usr/lib/jvm/java-7-openjdk-i386/include + /usr/lib/jvm/java-7-openjdk-amd64/include + /usr/lib64/jvm/java-7-openjdk/include + /usr/lib64/jvm/java-7-openjdk-amd64/include + /usr/local/share/java/include + /usr/lib/j2sdk1.4-sun/include + /usr/lib/j2sdk1.5-sun/include + /opt/sun-jdk-1.5.0.04/include + # Debian specific path for default JVM + /usr/lib/jvm/default-java/include + # OpenBSD specific path for default JVM + /usr/local/jdk-1.7.0/include + /usr/local/jdk-1.6.0/include + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/include + ) + +foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") + get_filename_component(jpath "${JAVA_PROG}" PATH) + foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include) + if(EXISTS ${jpath}/${JAVA_INC_PATH}) + list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}") + endif() + endforeach() + foreach(JAVA_LIB_PATH + ../lib ../jre/lib ../jre/lib/i386 + ../java/lib ../java/jre/lib ../java/jre/lib/i386 + ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) + if(EXISTS ${jpath}/${JAVA_LIB_PATH}) + list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}") + endif() + endforeach() +endforeach() + +if(APPLE) + if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY") + set(_JNI_SEARCHES FRAMEWORK) + elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER") + set(_JNI_SEARCHES NORMAL) + elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST") + set(_JNI_SEARCHES NORMAL FRAMEWORK) + else() + set(_JNI_SEARCHES FRAMEWORK NORMAL) + endif() + set(_JNI_FRAMEWORK_JVM NAMES JavaVM) + set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}") +else() + set(_JNI_SEARCHES NORMAL) +endif() + +set(_JNI_NORMAL_JVM + NAMES jvm + PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} + ) + +set(_JNI_NORMAL_JAWT + NAMES jawt + PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} + ) + +foreach(search ${_JNI_SEARCHES}) + find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM}) + find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT}) + if(JAVA_JVM_LIBRARY) + break() + endif() +endforeach() +unset(_JNI_SEARCHES) +unset(_JNI_FRAMEWORK_JVM) +unset(_JNI_FRAMEWORK_JAWT) +unset(_JNI_NORMAL_JVM) +unset(_JNI_NORMAL_JAWT) + +# Find headers matching the library. +if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);") + set(CMAKE_FIND_FRAMEWORK ONLY) +else() + set(CMAKE_FIND_FRAMEWORK NEVER) +endif() + +# add in the include path +find_path(JAVA_INCLUDE_PATH jni.h + ${JAVA_AWT_INCLUDE_DIRECTORIES} +) + +find_path(JAVA_INCLUDE_PATH2 jni_md.h + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH}/darwin + ${JAVA_INCLUDE_PATH}/win32 + ${JAVA_INCLUDE_PATH}/linux + ${JAVA_INCLUDE_PATH}/freebsd + ${JAVA_INCLUDE_PATH}/openbsd + ${JAVA_INCLUDE_PATH}/solaris + ${JAVA_INCLUDE_PATH}/hp-ux + ${JAVA_INCLUDE_PATH}/alpha +) + +find_path(JAVA_AWT_INCLUDE_PATH jawt.h + ${JAVA_INCLUDE_PATH} +) + +# Restore CMAKE_FIND_FRAMEWORK +if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK}) + unset(_JNI_CMAKE_FIND_FRAMEWORK) +else() + unset(CMAKE_FIND_FRAMEWORK) +endif() + +#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +INCLUDE (FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY + JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) + +mark_as_advanced( + JAVA_AWT_LIBRARY + JAVA_JVM_LIBRARY + JAVA_AWT_INCLUDE_PATH + JAVA_INCLUDE_PATH + JAVA_INCLUDE_PATH2 +) + +set(JNI_LIBRARIES + ${JAVA_AWT_LIBRARY} + ${JAVA_JVM_LIBRARY} +) + +set(JNI_INCLUDE_DIRS + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH2} + ${JAVA_AWT_INCLUDE_PATH} +) + +message ("JNI_LIBRARIES=${JNI_LIBRARIES}") +message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index ec40abe993c..4c4ffd5dd07 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -9,6 +9,7 @@ It was built with the following options: -- @LIB_TYPE@ C/C++/Fortran libraries -- SZIP (encoder enabled) and ZLIB -- @LIB_TYPE@ HDF5 tools + -- Java The contents of this directory are: diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake new file mode 100644 index 00000000000..d6945176eea --- /dev/null +++ b/config/cmake/UseJava.cmake @@ -0,0 +1,1290 @@ +#.rst: +# UseJava +# ------- +# +# Use Module for Java +# +# This file provides functions for Java. It is assumed that +# FindJava.cmake has already been loaded. See FindJava.cmake for +# information on how to load Java into your CMake project. +# +# :: +# +# add_jar(target_name +# [SOURCES] source1 [source2 ...] [resource1 ...] +# [INCLUDE_JARS jar1 [jar2 ...]] +# [ENTRY_POINT entry] +# [VERSION version] +# [OUTPUT_NAME name] +# [OUTPUT_DIR dir] +# ) +# +# This command creates a .jar. It compiles the given +# source files (source) and adds the given resource files (resource) to +# the jar file. Source files can be java files or listing files +# (prefixed by '@'). If only resource files are given then just a jar file +# is created. The list of include jars are added to the classpath when +# compiling the java sources and also to the dependencies of the target. +# INCLUDE_JARS also accepts other target names created by add_jar. For +# backwards compatibility, jar files listed as sources are ignored (as +# they have been since the first version of this module). +# +# The default OUTPUT_DIR can also be changed by setting the variable +# CMAKE_JAVA_TARGET_OUTPUT_DIR. +# +# Additional instructions: +# +# :: +# +# To add compile flags to the target you can set these flags with +# the following variable: +# +# +# +# :: +# +# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) +# +# +# +# :: +# +# To add a path or a jar file to the class path you can do this +# with the CMAKE_JAVA_INCLUDE_PATH variable. +# +# +# +# :: +# +# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) +# +# +# +# :: +# +# To use a different output name for the target you can set it with: +# +# +# +# :: +# +# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) +# +# +# +# :: +# +# To use a different output directory than CMAKE_CURRENT_BINARY_DIR +# you can set it with: +# +# +# +# :: +# +# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) +# +# +# +# :: +# +# To define an entry point in your jar you can set it with the ENTRY_POINT +# named argument: +# +# +# +# :: +# +# add_jar(example ENTRY_POINT com/examples/MyProject/Main) +# +# +# +# :: +# +# To define a custom manifest for the jar, you can set it with the manifest +# named argument: +# +# +# +# :: +# +# add_jar(example MANIFEST /path/to/manifest) +# +# +# +# :: +# +# To add a VERSION to the target output name you can set it using +# the VERSION named argument to add_jar. This will create a jar file with the +# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar +# pointing to the jar with the version information. +# +# +# +# :: +# +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) +# +# +# +# :: +# +# If the target is a JNI library, utilize the following commands to +# create a JNI symbolic link: +# +# +# +# :: +# +# set(CMAKE_JNI_TARGET TRUE) +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) +# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) +# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) +# +# +# +# :: +# +# If a single target needs to produce more than one jar from its +# java source code, to prevent the accumulation of duplicate class +# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior +# to calling the add_jar() function: +# +# +# +# :: +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) +# add_jar(foo foo.java) +# +# +# +# :: +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) +# add_jar(bar bar.java) +# +# +# +# Target Properties: +# +# :: +# +# The add_jar() functions sets some target properties. You can get these +# properties with the +# get_property(TARGET PROPERTY ) +# command. +# +# +# +# :: +# +# INSTALL_FILES The files which should be installed. This is used by +# install_jar(). +# JNI_SYMLINK The JNI symlink which should be installed. +# This is used by install_jni_symlink(). +# JAR_FILE The location of the jar file so that you can include +# it. +# CLASS_DIR The directory where the class files can be found. For +# example to use them with javah. +# +# :: +# +# find_jar( +# name | NAMES name1 [name2 ...] +# [PATHS path1 [path2 ... ENV var]] +# [VERSIONS version1 [version2]] +# [DOC "cache documentation string"] +# ) +# +# This command is used to find a full path to the named jar. A cache +# entry named by is created to stor the result of this command. +# If the full path to a jar is found the result is stored in the +# variable and the search will not repeated unless the variable is +# cleared. If nothing is found, the result will be -NOTFOUND, and +# the search will be attempted again next time find_jar is invoked with +# the same variable. The name of the full path to a file that is +# searched for is specified by the names listed after NAMES argument. +# Additional search locations can be specified after the PATHS argument. +# If you require special a version of a jar file you can specify it with +# the VERSIONS argument. The argument after DOC will be used for the +# documentation string in the cache. +# +# :: +# +# install_jar(target_name destination) +# install_jar(target_name DESTINATION destination [COMPONENT component]) +# +# This command installs the TARGET_NAME files to the given DESTINATION. +# It should be called in the same scope as add_jar() or it will fail. +# +# :: +# +# install_jni_symlink(target_name destination) +# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) +# +# This command installs the TARGET_NAME JNI symlinks to the given +# DESTINATION. It should be called in the same scope as add_jar() or it +# will fail. +# +# :: +# +# create_javadoc( +# PACKAGES pkg1 [pkg2 ...] +# [SOURCEPATH ] +# [CLASSPATH ] +# [INSTALLPATH ] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# Create java documentation based on files or packages. For more +# details please read the javadoc manpage. +# +# There are two main signatures for create_javadoc. The first signature +# works with package names on a path with source files: +# +# :: +# +# Example: +# create_javadoc(my_example_doc +# PACKAGES com.exmaple.foo com.example.bar +# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "

My example

" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# +# +# The second signature for create_javadoc works on a given list of +# files. +# +# :: +# +# create_javadoc( +# FILES file1 [file2 ...] +# [CLASSPATH ] +# [INSTALLPATH ] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# +# +# Example: +# +# :: +# +# create_javadoc(my_example_doc +# FILES ${example_SRCS} +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "

My example

" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# +# +# Both signatures share most of the options. These options are the same +# as what you can find in the javadoc manpage. Please look at the +# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION. +# +# The documentation will be by default installed to +# +# :: +# +# ${CMAKE_INSTALL_PREFIX}/share/javadoc/ +# +# +# +# if you don't set the INSTALLPATH. +# +# :: +# +# create_javah(TARGET +# GENERATED_FILES +# CLASSES ... +# [CLASSPATH ...] +# [DEPENDS ...] +# [OUTPUT_NAME |OUTPUT_DIR ] +# ) +# +# Create C header files from java classes. These files provide the connective glue +# that allow your Java and C code to interact. +# +# There are two main signatures for create_javah. The first signature +# returns generated files throught variable specified by GENERATED_FILES option: +# +# :: +# +# Example: +# Create_javah(GENERATED_FILES files_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# The second signature for create_javah creates a target which encapsulates +# header files generation. +# +# :: +# +# Example: +# Create_javah(TARGET target_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# Both signatures share same options. +# +# ``CLASSES ...`` +# Specifies Java classes used to generate headers. +# +# ``CLASSPATH ...`` +# Specifies various paths to look up classes. Here .class files, jar files or targets +# created by command add_jar can be used. +# +# ``DEPENDS ...`` +# Targets on which the javah target depends +# +# ``OUTPUT_NAME `` +# Concatenates the resulting header files for all the classes listed by option CLASSES +# into . Same behavior as option '-o' of javah tool. +# +# ``OUTPUT_DIR `` +# Sets the directory where the header files will be generated. Same behavior as option +# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. + +#============================================================================= +# Copyright 2013 OpenGamma Ltd. +# Copyright 2010-2011 Andreas schneider +# Copyright 2010-2013 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +function (__java_copy_file src dest comment) + add_custom_command( + OUTPUT ${dest} + COMMAND cmake -E copy_if_different + ARGS ${src} + ${dest} + DEPENDS ${src} + COMMENT ${comment}) +endfunction () + +# define helper scripts +set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) +set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) + +function(add_jar _TARGET_NAME) + + cmake_parse_arguments(_add_jar + "" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" + "SOURCES;INCLUDE_JARS" + ${ARGN} + ) + + # In CMake < 2.8.12, add_jar used variables which were set prior to calling + # add_jar for customizing the behavior of add_jar. In order to be backwards + # compatible, check if any of those variables are set, and use them to + # initialize values of the named arguments. (Giving the corresponding named + # argument will override the value set here.) + # + # New features should use named arguments only. + if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION) + set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}") + endif() + if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}") + endif() + if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) + set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}") + # reset + set(CMAKE_JAVA_TARGET_OUTPUT_NAME) + endif() + if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) + set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") + endif() + + set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) + + if (NOT DEFINED _add_jar_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if (_add_jar_ENTRY_POINT) + set(_ENTRY_POINT_OPTION e) + set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) + endif () + + if (_add_jar_MANIFEST) + set(_MANIFEST_OPTION m) + set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + endif () + + if (LIBRARY_OUTPUT_PATH) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) + else () + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${_add_jar_OUTPUT_DIR}) + endif () + + set(CMAKE_JAVA_INCLUDE_PATH + ${CMAKE_JAVA_INCLUDE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_JAVA_OBJECT_OUTPUT_PATH} + ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} + ) + + if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") + else () + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") + endif() + + foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") + endforeach() + + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") + if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}-${_add_jar_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_add_jar_OUTPUT_NAME}.jar") + elseif (_add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${_add_jar_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") + elseif (_add_jar_OUTPUT_NAME) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}.jar") + endif () + + set(_JAVA_CLASS_FILES) + set(_JAVA_COMPILE_FILES) + set(_JAVA_COMPILE_FILELISTS) + set(_JAVA_DEPENDS) + set(_JAVA_COMPILE_DEPENDS) + set(_JAVA_RESOURCE_FILES) + set(_JAVA_RESOURCE_FILES_RELATIVE) + foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) + get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) + get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) + get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) + + if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$") + get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE) + list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) + + elseif (_JAVA_EXT MATCHES ".java") + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) + string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) + string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) + if (${_BIN_LEN} LESS ${_SRC_LEN}) + set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) + else () + set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) + endif () + get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) + + list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) + set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) + + elseif (_JAVA_EXT MATCHES ".jar" + OR _JAVA_EXT MATCHES ".war" + OR _JAVA_EXT MATCHES ".ear" + OR _JAVA_EXT MATCHES ".sar") + # Ignored for backward compatibility + + elseif (_JAVA_EXT STREQUAL "") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) + list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) + + else () + __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} + ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} + "Copying ${_JAVA_SOURCE_FILE} to the build directory") + list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) + endif () + endforeach() + + foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS}) + if (TARGET ${_JAVA_INCLUDE_JAR}) + get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) + if (_JAVA_JAR_PATH) + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) + list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) + list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR}) + else () + message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar") + endif () + else () + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}") + endif () + endforeach() + + # create an empty java_class_filelist + if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") + endif() + + if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS) + set (_JAVA_SOURCES_FILELISTS) + + if (_JAVA_COMPILE_FILES) + # Create the list of files to compile. + set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) + string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") + file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}") + endif() + if (_JAVA_COMPILE_FILELISTS) + foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}") + endforeach() + endif() + + # Compile the java files and create a list of class files + add_custom_command( + # NOTE: this command generates an artificial dependency file + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + COMMAND ${Java_JAVAC_EXECUTABLE} + ${CMAKE_JAVA_COMPILE_FLAGS} + -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" + -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ${_JAVA_SOURCES_FILELISTS} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building Java objects for ${_TARGET_NAME}.jar" + ) + add_custom_command( + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMAND ${CMAKE_COMMAND} + -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} + -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" + -P ${_JAVA_CLASS_FILELIST_SCRIPT} + DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + endif () + + # create the jar file + set(_JAVA_JAR_OUTPUT_PATH + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + if (CMAKE_JNI_TARGET) + add_custom_command( + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} + COMMAND ${Java_JAR_EXECUTABLE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + else () + add_custom_command( + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} + COMMAND ${Java_JAR_EXECUTABLE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + endif () + + # Add the target and make sure we have the latest resource files. + add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${_JAVA_JAR_OUTPUT_PATH} + ) + + if (_JAVA_TARGET_OUTPUT_LINK) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${_JAVA_JAR_OUTPUT_PATH} + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + + if (CMAKE_JNI_TARGET) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + endif () + endif () + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JAR_FILE + ${_JAVA_JAR_OUTPUT_PATH} + ) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + CLASSDIR + ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ) + +endfunction() + +function(INSTALL_JAR _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jar + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jar_DESTINATION) + set (_DESTINATION ${_install_jar_DESTINATION}) + else() + message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jar_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_COMPONENT}) + endif() + endif() + + get_property(__FILES + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ) + + if (__FILES) + install( + FILES + ${__FILES} + DESTINATION + ${_DESTINATION} + ${_COMPONENT} + ) + else () + message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.") + endif () +endfunction() + +function(INSTALL_JNI_SYMLINK _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jni_symlink + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jni_symlink_DESTINATION) + set (_DESTINATION ${_install_jni_symlink_DESTINATION}) + else() + message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jni_symlink_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT}) + endif() + endif() + + get_property(__SYMLINK + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ) + + if (__SYMLINK) + install( + FILES + ${__SYMLINK} + DESTINATION + ${_DESTINATION} + ${_COMPONENT} + ) + else () + message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.") + endif () +endfunction() + +function (find_jar VARIABLE) + set(_jar_names) + set(_jar_files) + set(_jar_versions) + set(_jar_paths + /usr/share/java/ + /usr/local/share/java/ + ${Java_JAR_PATHS}) + set(_jar_doc "NOTSET") + + set(_state "name") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "name") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_names ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif () + endif () + elseif (${_state} STREQUAL "versions") + if (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_versions ${_jar_versions} ${arg}) + endif () + elseif (${_state} STREQUAL "names") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_names ${_jar_names} ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif () + endif () + elseif (${_state} STREQUAL "paths") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_paths ${_jar_paths} ${arg}) + endif () + elseif (${_state} STREQUAL "doc") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + else () + set(_jar_doc ${arg}) + endif () + endif () + endforeach () + + if (NOT _jar_names) + message(FATAL_ERROR "find_jar: No name to search for given") + endif () + + foreach (jar_name ${_jar_names}) + foreach (version ${_jar_versions}) + set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) + endforeach () + set(_jar_files ${_jar_files} ${jar_name}.jar) + endforeach () + + find_file(${VARIABLE} + NAMES ${_jar_files} + PATHS ${_jar_paths} + DOC ${_jar_doc} + NO_DEFAULT_PATH) +endfunction () + +function(create_javadoc _target) + set(_javadoc_packages) + set(_javadoc_files) + set(_javadoc_sourcepath) + set(_javadoc_classpath) + set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc") + set(_javadoc_doctitle) + set(_javadoc_windowtitle) + set(_javadoc_author FALSE) + set(_javadoc_version FALSE) + set(_javadoc_use FALSE) + + set(_state "package") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "package") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_packages ${arg}) + set(_state "packages") + endif () + elseif (${_state} STREQUAL "packages") + if (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_packages ${arg}) + endif () + elseif (${_state} STREQUAL "files") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_files ${arg}) + endif () + elseif (${_state} STREQUAL "sourcepath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_sourcepath ${arg}) + endif () + elseif (${_state} STREQUAL "classpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_classpath ${arg}) + endif () + elseif (${_state} STREQUAL "installpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_installpath ${arg}) + endif () + elseif (${_state} STREQUAL "doctitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_doctitle ${arg}) + endif () + elseif (${_state} STREQUAL "windowtitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_windowtitle ${arg}) + endif () + elseif (${_state} STREQUAL "author") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_author ${arg}) + endif () + elseif (${_state} STREQUAL "use") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_use ${arg}) + endif () + elseif (${_state} STREQUAL "version") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_version ${arg}) + endif () + endif () + endforeach () + + set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target}) + set(_javadoc_options -d ${_javadoc_builddir}) + + if (_javadoc_sourcepath) + set(_start TRUE) + foreach(_path ${_javadoc_sourcepath}) + if (_start) + set(_sourcepath ${_path}) + set(_start FALSE) + else () + set(_sourcepath ${_sourcepath}:${_path}) + endif () + endforeach() + set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) + endif () + + if (_javadoc_classpath) + set(_start TRUE) + foreach(_path ${_javadoc_classpath}) + if (_start) + set(_classpath ${_path}) + set(_start FALSE) + else () + set(_classpath ${_classpath}:${_path}) + endif () + endforeach() + set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") + endif () + + if (_javadoc_doctitle) + set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') + endif () + + if (_javadoc_windowtitle) + set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') + endif () + + if (_javadoc_author) + set(_javadoc_options ${_javadoc_options} -author) + endif () + + if (_javadoc_use) + set(_javadoc_options ${_javadoc_options} -use) + endif () + + if (_javadoc_version) + set(_javadoc_options ${_javadoc_options} -version) + endif () + + add_custom_target(${_target}_javadoc ALL + COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} + ${_javadoc_files} + ${_javadoc_packages} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + DIRECTORY ${_javadoc_builddir} + DESTINATION ${_javadoc_installpath} + ) +endfunction() + +function (create_javah) + cmake_parse_arguments(_create_javah + "" + "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR" + "CLASSES;CLASSPATH;DEPENDS" + ${ARGN}) + + # ckeck parameters + if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES) + message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.") + endif() + if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR) + message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.") + endif() + + if (NOT _create_javah_CLASSES) + message (FATAL_ERROR "create_javah: CLASSES is a required parameter.") + endif() + + set (_output_files) + if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(_classpath_sep ";") + else () + set(_classpath_sep ":") + endif() + + # handle javah options + set (_javah_options) + + if (_create_javah_CLASSPATH) + # CLASSPATH can specify directories, jar files or targets created with add_jar command + set (_classpath) + foreach (_path IN LISTS _create_javah_CLASSPATH) + if (TARGET ${_path}) + get_target_property (_jar_path ${_path} JAR_FILE) + if (_jar_path) + list (APPEND _classpath "${_jar_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + else() + message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.") + endif() + elseif (EXISTS "${_path}") + list (APPEND _classpath "${_path}") + if (NOT IS_DIRECTORY "${_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + endif() + else() + message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.") + endif() + endforeach() + string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") + list (APPEND _javah_options -classpath ${_classpath}) + endif() + + if (_create_javah_OUTPUT_DIR) + list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}") + endif() + + if (_create_javah_OUTPUT_NAME) + list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}") + set (_output_files "${_create_javah_OUTPUT_NAME}") + + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY) + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE) + endif() + + if (NOT _create_javah_OUTPUT_DIR) + set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + if (NOT _create_javah_OUTPUT_NAME) + # compute output names + foreach (_class IN LISTS _create_javah_CLASSES) + string (REPLACE "." "_" _c_header "${_class}") + set (_c_header "${_create_javah_OUTPUT_DIR}/${_c_header}.h") + list (APPEND _output_files "${_c_header}") + endforeach() + endif() + + # finalize custom command arguments + if (_create_javah_DEPENDS) + list (INSERT _create_javah_DEPENDS 0 DEPENDS) + endif() + + add_custom_command (OUTPUT ${_output_files} + COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES} + ${_create_javah_DEPENDS} + WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR} + COMMENT "Building C header files from classes...") + + if (_create_javah_TARGET) + add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files}) + endif() + if (_create_javah_GENERATED_FILES) + set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE) + endif() +endfunction() diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake new file mode 100644 index 00000000000..e8e6f014cf7 --- /dev/null +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -0,0 +1,58 @@ +#.rst: +# UseJavaClassFilelist +# -------------------- +# +# +# +# +# +# This script create a list of compiled Java class files to be added to +# a jar file. This avoids including cmake files which get created in +# the binary directory. + +#============================================================================= +# Copyright 2010-2011 Andreas schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if (CMAKE_JAVA_CLASS_OUTPUT_PATH) + if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") + + set(_JAVA_GLOBBED_FILES) + if (CMAKE_JAR_CLASSES_PREFIX) + foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) + message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}") + + file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") + if (_JAVA_GLOBBED_TMP_FILES) + list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) + endif () + endforeach() + else() + file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class") + endif () + + set(_JAVA_CLASS_FILES) + # file(GLOB_RECURSE foo RELATIVE) is broken so we need this. + foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) + file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE}) + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n) + endforeach() + + # write to file + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES}) + + else () + message(SEND_ERROR "FATAL: Java class output path doesn't exist") + endif () +else () + message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH") +endif () diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake new file mode 100644 index 00000000000..90ffdd53575 --- /dev/null +++ b/config/cmake/UseJavaSymlinks.cmake @@ -0,0 +1,38 @@ +#.rst: +# UseJavaSymlinks +# --------------- +# +# +# +# +# +# Helper script for UseJava.cmake + +#============================================================================= +# Copyright 2010-2011 Andreas schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) + if (_JAVA_TARGET_OUTPUT_NAME) + find_program(LN_EXECUTABLE + NAMES + ln + ) + + execute_process( + COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}" + WORKING_DIRECTORY ${_JAVA_TARGET_DIR} + ) + else () + message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME") + endif () +endif () diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 3577e40fa55..3f95d769391 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -14,6 +14,7 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS HL CXX_HL Fortran_HL + Java Tools ) @@ -23,6 +24,7 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS set (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) set (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) +set (${HDF5_PACKAGE_NAME}_BUILD_JAVA @HDF5_BUILD_JAVA@) set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) @@ -40,6 +42,16 @@ if (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL) set (${HDF5_PACKAGE_NAME}_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") endif () +if (${HDF5_PACKAGE_NAME}_BUILD_JAVA) + set (${HDF5_PACKAGE_NAME}_JAVA_INCLUDE_DIRS + @PACKAGE_CURRENT_BUILD_DIR@/lib/jarhdf5-@HDF5_VERSION_STRING@.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.5.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.5.jar + ) + set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib") + set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}") +endif() + #----------------------------------------------------------------------------- # Directories #----------------------------------------------------------------------------- @@ -123,6 +135,8 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) set (hdf5_comp "hdf5_hl") elseif (${comp} STREQUAL "CXX_HL") set (hdf5_comp "hdf5_hl_cpp") + elseif (${comp} STREQUAL "Java") + set (hdf5_comp "hdf5_java") elseif (${comp} STREQUAL "Tools") set (hdf5_comp "hdf5_tools") elseif (${comp} STREQUAL "Fortran") diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake new file mode 100644 index 00000000000..7a928678cf3 --- /dev/null +++ b/config/cmake/jrunTest.cmake @@ -0,0 +1,212 @@ +# runTest.cmake executes a command and captures the output in a file. File is then compared +# against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) + +# arguments checking +if (NOT TEST_TESTER) + message (FATAL_ERROR "Require TEST_TESTER to be defined") +endif (NOT TEST_TESTER) +if (NOT TEST_PROGRAM) + message (FATAL_ERROR "Require TEST_PROGRAM to be defined") +endif (NOT TEST_PROGRAM) +if (NOT TEST_LIBRARY_DIRECTORY) + message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") +endif (NOT TEST_LIBRARY_DIRECTORY) +if (NOT TEST_FOLDER) + message ( FATAL_ERROR "Require TEST_FOLDER to be defined") +endif (NOT TEST_FOLDER) +if (NOT TEST_OUTPUT) + message (FATAL_ERROR "Require TEST_OUTPUT to be defined") +endif (NOT TEST_OUTPUT) +if (NOT TEST_CLASSPATH) + message (STATUS "Require TEST_CLASSPATH to be defined") +endif (NOT TEST_CLASSPATH) +if (NOT TEST_REFERENCE) + message (FATAL_ERROR "Require TEST_REFERENCE to be defined") +endif (NOT TEST_REFERENCE) + +if (NOT TEST_ERRREF) + set (ERROR_APPEND 1) +endif (NOT TEST_ERRREF) + +if (NOT TEST_LOG_LEVEL) + set (LOG_LEVEL "info") +else (NOT TEST_LOG_LEVEL) + set (LOG_LEVEL "${TEST_LOG_LEVEL}") +endif (NOT TEST_LOG_LEVEL) + +message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") + +if (WIN32 AND NOT MINGW) + set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") +endif (WIN32 AND NOT MINGW) + +# run the test program, capture the stdout/stderr and the result var +execute_process ( + COMMAND ${TEST_TESTER} -Xmx1024M + -Dorg.slf4j.simpleLogger.defaultLogLevel=${LOG_LEVEL} + -Djava.library.path=${TEST_LIBRARY_DIRECTORY} + -cp "${TEST_CLASSPATH}" ${TEST_ARGS} ${TEST_PROGRAM} + ${ARGN} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + ERROR_VARIABLE TEST_ERROR +) + +message (STATUS "COMMAND Result: ${TEST_RESULT}") + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif (TEST_MASK_FILE) + + if (ERROR_APPEND) + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else (ERROR_APPEND) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif (ERROR_APPEND) +endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + +if (TEST_MASK_ERROR) + if (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + else (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + endif (NOT TEST_ERRREF) + string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") + #string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "HDF5 .[1-9]*[.][0-9]*[.][0-9]*[^)]*" "HDF5 (version (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + if (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif (NOT TEST_ERRREF) +endif (TEST_MASK_ERROR) + +# if the return value is !=0 bail out +if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") +endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + +message (STATUS "COMMAND Error: ${TEST_ERROR}") + +if (NOT TEST_SKIP_COMPARE) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif (WIN32 AND NOT MINGW) + + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + if (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif (NOT "${str_act}" STREQUAL "") + endif (NOT "${str_act}" STREQUAL "${str_ref}") + endforeach (line RANGE 0 ${_FP_LEN}) + endif (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif (NOT ${len_act} STREQUAL ${len_ref}) + endif (NOT ${TEST_RESULT} STREQUAL 0) + + message (STATUS "COMPARE Result: ${TEST_RESULT}") + + # again, if return value is !=0 scream and shout + if (NOT ${TEST_RESULT} STREQUAL 0) + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif (NOT ${TEST_RESULT} STREQUAL 0) + + if (TEST_ERRREF) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + endif (WIN32 AND NOT MINGW) + + # now compare the error output with the error reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_RESULT + ) + if (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) + MATH (EXPR _FP_LEN "${len_ref} - 1") + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif (NOT "${str_act}" STREQUAL "") + endif (NOT "${str_act}" STREQUAL "${str_ref}") + endforeach (line RANGE 0 ${_FP_LEN}) + endif (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif (NOT ${len_act} STREQUAL ${len_ref}) + endif (NOT ${TEST_RESULT} STREQUAL 0) + + message (STATUS "COMPARE Result: ${TEST_RESULT}") + + # again, if return value is !=0 scream and shout + if (NOT ${TEST_RESULT} STREQUAL 0) + message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") + endif (NOT ${TEST_RESULT} STREQUAL 0) + endif (TEST_ERRREF) +endif (NOT TEST_SKIP_COMPARE) + +if (TEST_GREP_COMPARE) + # now grep the output with the reference + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) + if (${TEST_RESULT} STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif (${TEST_RESULT} STREQUAL "0") + + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (${TEST_EXPECT} STREQUAL "1") + # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match + string (LENGTH "${TEST_MATCH}" TEST_RESULT) + if (NOT ${TEST_RESULT} STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif (NOT ${TEST_RESULT} STREQUAL "0") + endif (${TEST_EXPECT} STREQUAL "0") +endif (TEST_GREP_COMPARE) + +# everything went fine... +message ("${TEST_PROGRAM} Passed") + diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index cc6ae3ea6b1..8348af0af41 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -1,43 +1,50 @@ - SUMMARY OF THE HDF5 CONFIGURATION - ================================= + SUMMARY OF THE HDF5 CONFIGURATION + ================================= General Information: ------------------- HDF5 Version: @HDF5_PACKAGE_VERSION_STRING@ Configured on: @CONFIG_DATE@ Configured by: @CMAKE_GENERATOR@ - Configure mode: CMAKE @CMAKE_VERSION@ Host system: @CMAKE_HOST_SYSTEM@ Uname information: @CMAKE_SYSTEM_NAME@ Byte sex: @BYTESEX@ - Libraries: @BUILD_NAME_EXT@ Installation point: @CMAKE_INSTALL_PREFIX@ Compiling Options: ------------------ - Compilation Mode: @CMAKE_BUILD_TYPE@ - C Compiler: @CMAKE_C_COMPILER@ - CFLAGS: @CMAKE_C_FLAGS@ - H5_CFLAGS: @H5_CFLAGS@ - AM_CFLAGS: @AM_CFLAGS@ - CPPFLAGS: @CPPFLAGS@ - H5_CPPFLAGS: @H5_CPPFLAGS@ - AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared C Library: @H5_ENABLE_SHARED_LIB@ - Static C Library: @H5_ENABLE_STATIC_LIB@ + Build Mode: @CMAKE_BUILD_TYPE@ + Debugging Symbols: @SYMBOLS@ + Asserts: @ASSERTS@ + Profiling: @PROFILING@ + Optimization Level: @OPTIMIZATION@ + +Linking Options: +---------------- + Libraries: @BUILD_NAME_EXT@ Statically Linked Executables: @BUILD_STATIC_EXECS@ LDFLAGS: @CMAKE_SHARED_LINKER_FLAGS@ + H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ Extra libraries: @LINK_LIBS@ Archiver: @CMAKE_AR@ Ranlib: @CMAKE_RANLIB@ - Debugged Packages: @DEBUG_PKG@ - API Tracing: @HDF5_ENABLE_TRACE@ Languages: ---------- + C: yes + C Compiler: @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_VERSION@ + CPPFLAGS: @CPPFLAGS@ + H5_CPPFLAGS: @H5_CPPFLAGS@ + AM_CPPFLAGS: @AM_CPPFLAGS@ + CFLAGS: @CMAKE_C_FLAGS@ + H5_CFLAGS: @H5_CFLAGS@ + AM_CFLAGS: @AM_CFLAGS@ + Shared C Library: @H5_ENABLE_SHARED_LIB@ + Static C Library: YES + Fortran: @HDF5_BUILD_FORTRAN@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @@ -45,27 +52,32 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES C++: @HDF5_BUILD_CPP_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ +@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES + JAVA: @HDF5_BUILD_JAVA@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ + Features: --------- Parallel HDF5: @HDF5_ENABLE_PARALLEL@ - High Level library: @HDF5_BUILD_HL_LIB@ + High-level library: @HDF5_BUILD_HL_LIB@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ - Default API Mapping: @DEFAULT_API_VERSION@ - With Deprecated Public Symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ + Default API mapping: @DEFAULT_API_VERSION@ + With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @H5_HAVE_LIBLMPE@ Direct VFD: @H5_HAVE_DIRECT@ dmalloc: @H5_HAVE_LIBDMALLOC@ -Clear file buffers before write: @HDF5_Enable_Clear_File_Buffers@ + Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ + API Tracing: @HDF5_ENABLE_TRACE@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ + Metadata trace file: @METADATATRACEFILE@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/commence.am b/config/commence.am index 554c9fb8280..1a26a851f63 100644 --- a/config/commence.am +++ b/config/commence.am @@ -37,6 +37,7 @@ LIBH5TEST=$(top_builddir)/test/libh5test.la LIBH5F=$(top_builddir)/fortran/src/libhdf5_fortran.la LIBH5FTEST=$(top_builddir)/fortran/test/libh5test_fortran.la LIBH5CPP=$(top_builddir)/c++/src/libhdf5_cpp.la +LIBH5JNI=$(top_builddir)/java/src/jni/libhdf5_java.la LIBH5TOOLS=$(top_builddir)/tools/lib/libh5tools.la LIBH5_HL=$(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL=$(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la diff --git a/configure.ac b/configure.ac index 54ad5a205ed..d547ac5b996 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,7 @@ AC_CONFIG_COMMANDS([pubconf], [ AC_CANONICAL_HOST AC_SUBST([CPPFLAGS]) +AC_SUBST([JNIFLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) @@ -107,6 +108,9 @@ AC_SUBST([H5_CFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) +AC_SUBST([H5_JNIFLAGS]) +AC_SUBST([H5_JAVACFLAGS]) +AC_SUBST([H5_JAVAFLAGS]) AC_SUBST([H5_LDFLAGS]) ## AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5, @@ -115,6 +119,9 @@ AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_FCFLAGS]) AC_SUBST([AM_CXXFLAGS]) AC_SUBST([AM_CPPFLAGS]) +AC_SUBST([AM_JNIFLAGS]) +AC_SUBST([AM_JAVACFLAGS]) +AC_SUBST([AM_JAVAFLAGS]) AC_SUBST([AM_LDFLAGS]) ## Make sure flags are initialized. @@ -122,11 +129,17 @@ AM_CFLAGS="${AM_CFLAGS}" AM_CXXFLAGS="${AM_CXXFLAGS}" AM_FCFLAGS="${AM_FCFLAGS}" AM_CPPFLAGS="${AM_CPPFLAGS}" +AM_JNIFLAGS="${AM_JNIFLAGS}" +AM_JAVACFLAGS="${AM_JAVACFLAGS}" +AM_JAVAFLAGS="${AM_JAVAFLAGS}" AM_LDFLAGS="${AM_LDFLAGS}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" CPPFLAGS="${CPPFLAGS}" +JNIFLAGS="${JNIFLAGS}" +JAVACFLAGS="${JAVACFLAGS}" +JAVAFLAGS="${JAVAFLAGS}" LDFLAGS="${LDFLAGS}" ## Configure may need to alter any of the *FLAGS variables in order for @@ -135,6 +148,8 @@ LDFLAGS="${LDFLAGS}" saved_user_CFLAGS="$CFLAGS" saved_user_CXXFLAGS="$CXXFLAGS" saved_user_FCFLAGS="$FCFLAGS" +saved_user_JAVACFLAGS="$JAVACFLAGS" +saved_user_JAVAFLAGS="$JAVAFLAGS" saved_user_LDFLAGS="$LDFLAGS" saved_user_CPPFLAGS="$CPPFLAGS" @@ -326,6 +341,8 @@ esac ## reset this value at the end of configure, to preserve the user's settings. CFLAGS="${AM_CFLAGS} ${CFLAGS}" FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}" +JAVACFLAGS="${AM_JAVACFLAGS} ${JAVACFLAGS}" +JAVAFLAGS="${AM_JAVAFLAGS} ${JAVAFLAGS}" CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}" CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}" LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}" @@ -834,6 +851,55 @@ case "`uname`" in ;; esac +## ---------------------------------------------------------------------- +## Check if they would like the Java native interface (JNI) compiled +## + +AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH="" +AC_MSG_CHECKING([if Java JNI interface enabled]) + +AC_ARG_ENABLE([java], + [AS_HELP_STRING([--enable-java], + [Compile the Java JNI interface [default=no]])], + [HDF_JAVA=$enableval], + [HDF_JAVA=no]) + +if test "X$HDF_JAVA" = "Xyes" && test "X${enable_shared}" != "Xno"; then + echo "yes" + if test "X$CLASSPATH" = "X"; then + H5_CLASSPATH=".:$srcdir/java/lib" + else + H5_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib" + fi +## Checks for programs. + AX_JAVA_OPTIONS + H5_JAVACFLAGS=$JAVACFLAGS + H5_JAVAFLAGS=$JAVAFLAGS + AX_PROG_JAVAC + AX_PROG_JAVA + AX_PROG_JAR + AX_PROG_JAVADOC + ## Find the include directories needed for building JNI code + AX_JNI_INCLUDE_DIR() + for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS + do + JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR" + done + ## Find junit for testing the JNI code + AX_CHECK_CLASSPATH() + CLASSPATH_ENV=$H5_CLASSPATH + AX_CHECK_JUNIT() + AX_CHECK_JAVA_HOME + + AC_MSG_RESULT([yes]) +else + if test "X${enable_shared}" = "Xno"; then + AC_MSG_ERROR([Java requires shared libraries to be built]) + fi + HDF_JAVA="no" + AC_MSG_RESULT([no]) +fi + ## ---------------------------------------------------------------------- ## Fortran libraries are not currently supported on Mac. Disable them. ## (this is overridable with --enable-unsupported). @@ -3071,7 +3137,7 @@ CXX_NOFLAGS=`echo $CXX | sed 's/ -.*//'` if `echo $CXX_NOFLAGS | grep ^/ >/dev/null 2>&1`; then CXX_VERSION="$CXX" else - CXX_VERSION="$FC"; + CXX_VERSION="$CXX"; for x in `echo $PATH | sed -e 's/:/ /g'`; do if test -x $x/$CXX_NOFLAGS; then CXX_VERSION="$x/$CXX" @@ -3083,6 +3149,27 @@ if test -n "$cxx_version_info"; then CXX_VERSION="$CXX_VERSION ( $cxx_version_info)" fi +AC_SUBST([JAVA_VERSION]) +## Strip anything that looks like a flag off of $JAVA +JAVA_NOFLAGS=`echo $JAVA | sed 's/ -.*//'` + +if `echo $JAVA_NOFLAGS | grep ^/ >/dev/null 2>&1`; then + JAVA_VERSION="$JAVA" +else + JAVA_VERSION="$JAVA"; + for x in `echo $PATH | sed -e 's/:/ /g'`; do + if test -x $x/$JAVA_NOFLAGS; then + JAVA_VERSION="$x/$JAVA" + break + fi + done +fi +java_version_info=`$JAVA -version 2>&1 |\ + grep 'version' | sed -e 's/version "//' | sed -e 's/"//'` +if test -n "$java_version_info"; then + JAVA_VERSION="$JAVA_VERSION ( $java_version_info)" +fi + ## ---------------------------------------------------------------------- ## Where is the root of the source tree. Give an absolute address so ## we can find it no matter which directory of the distribution is our @@ -3296,6 +3383,8 @@ CFLAGS="$saved_user_CFLAGS" FCFLAGS="$saved_user_FCFLAGS" CXXFLAGS="$saved_user_CXXFLAGS" CPPFLAGS="$saved_user_CPPFLAGS" +JAVACFLAGS="$saved_user_JAVACFLAGS" +JAVAFLAGS="$saved_user_JAVAFLAGS" LDFLAGS="$saved_user_LDFLAGS" @@ -3306,6 +3395,7 @@ LDFLAGS="$saved_user_LDFLAGS" AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"]) AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"]) +AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"]) AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) @@ -3451,6 +3541,20 @@ AC_CONFIG_FILES([src/libhdf5.settings fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh + java/Makefile + java/src/Makefile + java/src/jni/Makefile + java/test/Makefile + java/test/junit.sh + java/examples/Makefile + java/examples/intro/Makefile + java/examples/intro/runExample.sh + java/examples/datasets/Makefile + java/examples/datasets/runExample.sh + java/examples/datatypes/Makefile + java/examples/datatypes/runExample.sh + java/examples/groups/Makefile + java/examples/groups/runExample.sh hl/Makefile hl/src/Makefile hl/test/Makefile diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 5854f75193a..8ebbbd09564 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -139,7 +139,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE C @@ -235,7 +235,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${MPI_Fortran_LIBRARIES}) endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 0cbd17f1de5..005a5c87f16 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -65,7 +65,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ) - H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE C @@ -128,7 +128,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index e37c5bab70f..425a2fefa2e 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -34,7 +34,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_LIBSH_TARGET} ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED ${HDF5_HL_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ead21be2d29..a5663148bfa 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -91,7 +91,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE C @@ -163,7 +163,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 472f1eea762..a86bf4fd51f 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -42,7 +42,7 @@ if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED ${HDF5_HL_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt new file mode 100644 index 00000000000..0440d41b08d --- /dev/null +++ b/java/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.1.0) +PROJECT ( HDF5_JAVA C Java ) + +set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}") +find_package (Java) +#----------------------------------------------------------------------------- +# Include some macros for reusable code +#----------------------------------------------------------------------------- +include (${HDF_RESOURCES_DIR}/UseJava.cmake) + +message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}") +find_package (JNI) + +INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} ) + +#----------------------------------------------------------------------------- +# Include the main src and config directories +#----------------------------------------------------------------------------- +set (HDF5_JAVA_INCLUDE_DIRECTORIES + ${HDF5_JAVA_JNI_SRC_DIR} + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH2} +) +INCLUDE_DIRECTORIES (${HDF5_JAVA_INCLUDE_DIRECTORIES}) +set (CMAKE_JAVA_INCLUDE_PATH "") + + +#----------------------------------------------------------------------------- +# Traverse source subdirectory +#----------------------------------------------------------------------------- +add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src) + +#----------------------------------------------------------------------------- +# Build the Java Examples +#----------------------------------------------------------------------------- +if (HDF5_BUILD_EXAMPLES) + add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples) +endif (HDF5_BUILD_EXAMPLES) + +#----------------------------------------------------------------------------- +# Testing +#----------------------------------------------------------------------------- +if (BUILD_TESTING) + add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test) +endif (BUILD_TESTING) + +#----------------------------------------------------------------------------- +# Add Required Jar(s) +#----------------------------------------------------------------------------- +install ( + FILES + ${HDF5_JAVA_LOGGING_JAR} + ${HDF5_JAVA_LOGGING_NOP_JAR} + ${HDF5_JAVA_LOGGING_SIMPLE_JAR} + DESTINATION ${HDF5_INSTALL_JAR_DIR} + COMPONENT libraries +) + +#----------------------------------------------------------------------------- +# Option to include jre +#----------------------------------------------------------------------------- +option (HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF) +if (HDF5_JAVA_PACK_JRE) + if (WIN32) + install ( + DIRECTORY "C:/Program Files/Java/jre8" + DESTINATION ${HDF5_INSTALL_BIN_DIR} + USE_SOURCE_PERMISSIONS + ) + else (WIN32) + install ( + DIRECTORY "/usr/lib/jvm/jre" + DESTINATION ${HDF5_INSTALL_BIN_DIR} + USE_SOURCE_PERMISSIONS + ) + endif (WIN32) +endif (HDF5_JAVA_PACK_JRE) diff --git a/java/COPYING b/java/COPYING new file mode 100644 index 00000000000..6903dafbb64 --- /dev/null +++ b/java/COPYING @@ -0,0 +1,16 @@ + + Copyright by The HDF Group and + The Board of Trustees of the University of Illinois. + All rights reserved. + + The files and subdirectories in this directory are part of HDF5. + The full HDF5 copyright notice, including terms governing use, + modification, and redistribution, is contained in the files COPYING + and Copyright.html. COPYING can be found at the root of the source + code distribution tree; Copyright.html can be found at the root + level of an installed copy of the electronic HDF5 document set and + is linked from the top-level documents page. It can also be found + at http://www.hdfgroup.org/HDF5/doc/Copyright.html. If you do not + have access to either file, you may request a copy from + help@hdfgroup.org. + diff --git a/java/Makefile.am b/java/Makefile.am new file mode 100644 index 00000000000..10b1e9117f4 --- /dev/null +++ b/java/Makefile.am @@ -0,0 +1,38 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Makefile(.in) + +include $(top_srcdir)/config/commence.am + +## Only recurse into subdirectories if the Java (JNI) interface is enabled. +if BUILD_JAVA_CONDITIONAL + +# Mark this directory as part of the JNI API +JAVA_API=yes + +SUBDIRS=src test examples + +endif + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt new file mode 100644 index 00000000000..0430bdb09ed --- /dev/null +++ b/java/examples/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES) + +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datatypes datatypes) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/groups groups) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/intro intro) diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am new file mode 100644 index 00000000000..e685e011ab8 --- /dev/null +++ b/java/examples/Makefile.am @@ -0,0 +1,31 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +## Only recurse into subdirectories if the Java (JNI) interface is enabled. + SUBDIRS=intro groups datasets datatypes + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt new file mode 100644 index 00000000000..23383255976 --- /dev/null +++ b/java/examples/datasets/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_DATASETS Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_D_Alloc + H5Ex_D_Checksum + H5Ex_D_Chunk + H5Ex_D_Compact + H5Ex_D_External + H5Ex_D_FillValue + H5Ex_D_Gzip + H5Ex_D_Hyperslab + H5Ex_D_ReadWrite + H5Ex_D_Shuffle + H5Ex_D_Szip + H5Ex_D_UnlimitedAdd + H5Ex_D_UnlimitedGzip + H5Ex_D_UnlimitedMod + H5Ex_D_Nbit + H5Ex_D_Transform + H5Ex_D_Sofloat + H5Ex_D_Soint +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.datasets.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_datasets-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_PROGRAM=examples.datasets.${resultfile}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datasets/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=datasets/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_datasets-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + if (${example} STREQUAL "H5Ex_D_External") + add_test ( + NAME JAVA_datasets-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data + ${example}.out + ${example}.out.err + ) + else (${example} STREQUAL "H5Ex_D_External") + add_test ( + NAME JAVA_datasets-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + endif (${example} STREQUAL "H5Ex_D_External") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datasets-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_datasets-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt + ${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clearall-objects) + set (last_test "JAVA_datasets-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java new file mode 100644 index 00000000000..69fee38cf8e --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Alloc.java @@ -0,0 +1,301 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the space allocation time + for a dataset. The program first creates two datasets, + one with the default allocation time (late) and one with + early allocation time, and displays whether each has been + allocated and their allocation size. Next, it writes data + to the datasets, and again displays whether each has been + allocated and their allocation size. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Alloc { + private static String FILENAME = "H5Ex_D_Alloc.h5"; + private static String DATASETNAME1 = "DS1"; + private static String DATASETNAME2 = "DS2"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int FILLVAL = 99; + private static final int RANK = 2; + + // Values for the status of space allocation + enum H5D_space_status { + H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED(1), H5D_SPACE_STATUS_ALLOCATED( + 2); + private static final Map lookup = new HashMap(); + + static { + for (H5D_space_status s : EnumSet.allOf(H5D_space_status.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_space_status(int space_status) { + this.code = space_status; + } + + public int getCode() { + return this.code; + } + + public static H5D_space_status get(int code) { + return lookup.get(code); + } + } + + private static void allocation() { + long file_id = -1; + long filespace_id = -1; + long dataset_id1 = -1; + long dataset_id2 = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int space_status = 0; + long storage_size = 0; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = FILLVAL; + + // Create a file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + if (dcpl_id >= 0) + H5.H5Pset_alloc_time(dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creating datasets..."); + System.out.println(DATASETNAME1 + " has allocation time H5D_ALLOC_TIME_LATE"); + System.out.println(DATASETNAME2 + " has allocation time H5D_ALLOC_TIME_EARLY"); + System.out.println(); + + // Create the dataset using the dataset default creation property list. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id1 = H5.H5Dcreate(file_id, DATASETNAME1, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the dataset creation property list. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id2 = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset1. + try { + if (dataset_id1 >= 0) + space_status = H5.H5Dget_space_status(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id1 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + String the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME1 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME1 + " is: " + storage_size + " bytes."); + + // Retrieve and print space status and storage size for dset2. + try { + if (dataset_id2 >= 0) + space_status = H5.H5Dget_space_status(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME2 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME2 + " is: " + storage_size + " bytes."); + System.out.println(); + + System.out.println("Writing data..."); + System.out.println(); + + // Write the data to the datasets. + try { + if (dataset_id1 >= 0) + H5.H5Dwrite(dataset_id1, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + H5.H5Dwrite(dataset_id2, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset1. + try { + if (dataset_id1 >= 0) + space_status = H5.H5Dget_space_status(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id1 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME1 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME1 + " is: " + storage_size + " bytes."); + + // Retrieve and print space status and storage size for dset2. + try { + if (dataset_id2 >= 0) + space_status = H5.H5Dget_space_status(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME2 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME2 + " is: " + storage_size + " bytes."); + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id1 >= 0) + H5.H5Dclose(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id2 >= 0) + H5.H5Dclose(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Alloc.allocation(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java new file mode 100644 index 00000000000..3a2f98f2237 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Checksum.java @@ -0,0 +1,347 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Fletcher32 checksum filter. The program first + checks if the Fletcher32 filter is available, then if it + is it writes integers to a dataset using Fletcher32, then + closes the file. Next, it reopens the file, reads back + the data, checks if the filter detected an error and + outputs the type of filter and the maximum value in the + dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Checksum { + private static String FILENAME = "H5Ex_D_Checksum.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(-1), H5Z_FILTER_NONE(0), H5Z_FILTER_DEFLATE(1), H5Z_FILTER_SHUFFLE(2), H5Z_FILTER_FLETCHER32(3), H5Z_FILTER_SZIP( + 4), H5Z_FILTER_NBIT(5), H5Z_FILTER_SCALEOFFSET(6), H5Z_FILTER_RESERVED(256), H5Z_FILTER_MAX(65535); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkFletcher32Filter() { + try { + int available = H5.H5Zfilter_avail(H5Z_filter.H5Z_FILTER_FLETCHER32.getCode()); + if (available == 0) { + System.out.println("N-Bit filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("N-Bit filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeChecksum() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the N-Bit filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_fletcher32(dcpl_id); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readChecksum() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Check if the read was successful. Normally we do not perform + // error checking in these examples for the sake of clarity, but in + // this case we will make an exception because this is how the + // fletcher32 checksum filter reports data errors. + if (status < 0) { + System.out.print("Dataset read failed!"); + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + return; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if the Fletcher32 filter is available and can be used for + // both encoding and decoding. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + // size to be the current size. + if (H5Ex_D_Checksum.checkFletcher32Filter()) { + H5Ex_D_Checksum.writeChecksum(); + H5Ex_D_Checksum.readChecksum(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java new file mode 100644 index 00000000000..7f02e5a1877 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -0,0 +1,366 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create a chunked dataset. The + program first writes integers in a hyperslab selection to + a chunked dataset with dataspace dimensions of DIM_XxDIM_Y + and chunk size of CHUNK_XxCHUNK_Y, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. Finally it reads the data again + using a different hyperslab selection, and outputs + the result to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Chunk { + private static String FILENAME = "H5Ex_D_Chunk.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5D_layout { + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + private static final Map lookup = new HashMap(); + + static { + for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_layout(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5D_layout get(int code) { + return lookup.get(code); + } + } + + private static void writeChunk() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data to "1", to make it easier to see the selections. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 1; + + // Print the data to the screen. + System.out.println("Original Data:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the chunked dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Define and select the first part of the hyperslab selection. + long[] start = { 0, 0 }; + long[] stride = { 3, 3 }; + long[] count = { 2, 3 }; + long[] block = { 2, 2 }; + try { + if ((filespace_id >= 0)) + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + } + catch (Exception e) { + e.printStackTrace(); + } + // Define and select the second part of the hyperslab selection, + // which is subtracted from the first selection by the use of + // H5S_SELECT_NOTB + block[0] = 1; + block[1] = 1; + try { + if ((filespace_id >= 0)) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + + // Write the data to the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readChunk() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the storage layout. + try { + if (dcpl_id >= 0) { + int layout_type = H5.H5Pget_layout(dcpl_id); + System.out.print("Storage layout for " + DATASETNAME + " is: "); + switch (H5D_layout.get(layout_type)) { + case H5D_COMPACT: + System.out.println("H5D_COMPACT"); + break; + case H5D_CONTIGUOUS: + System.out.println("H5D_CONTIGUOUS"); + break; + case H5D_CHUNKED: + System.out.println("H5D_CHUNKED"); + break; + case H5D_LAYOUT_ERROR: + break; + case H5D_NLAYOUTS: + break; + default: + break; + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written to disk by hyberslabs:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Initialize the read array. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 0; + + // Define and select the hyperslab to use for reading. + try { + if (dataset_id >= 0) { + filespace_id = H5.H5Dget_space(dataset_id); + + long[] start = { 0, 1 }; + long[] stride = { 4, 4 }; + long[] count = { 2, 2 }; + long[] block = { 2, 3 }; + + if (filespace_id >= 0) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Read the data using the previously defined hyperslab. + if ((dataset_id >= 0) && (filespace_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as read from disk by hyberslab:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Chunk.writeChunk(); + H5Ex_D_Chunk.readChunk(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java new file mode 100644 index 00000000000..4f1e2f02325 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -0,0 +1,289 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a compact + dataset. The program first writes integers to a compact + dataset with dataspace dimensions of DIM_XxDIM_Y, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Compact { + private static String FILENAME = "H5Ex_D_Compact.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + + // Values for the status of space allocation + enum H5D_layout { + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + private static final Map lookup = new HashMap(); + + static { + for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_layout(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5D_layout get(int code) { + return lookup.get(code); + } + } + + private static void writeCompact() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the layout to compact. + try { + if (dcpl_id >= 0) + H5.H5Pset_layout(dcpl_id, H5D_layout.H5D_COMPACT.getCode()); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readCompact() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file and dataset using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the storage layout. + try { + if (dcpl_id >= 0) { + int layout_type = H5.H5Pget_layout(dcpl_id); + System.out.print("Storage layout for " + DATASETNAME + " is: "); + switch (H5D_layout.get(layout_type)) { + case H5D_COMPACT: + System.out.println("H5D_COMPACT"); + break; + case H5D_CONTIGUOUS: + System.out.println("H5D_CONTIGUOUS"); + break; + case H5D_CHUNKED: + System.out.println("H5D_CHUNKED"); + break; + case H5D_LAYOUT_ERROR: + break; + case H5D_NLAYOUTS: + break; + default: + break; + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data for " + DATASETNAME + " is: "); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Compact.writeCompact(); + H5Ex_D_Compact.readCompact(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java new file mode 100644 index 00000000000..5fdc696c418 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_External.java @@ -0,0 +1,238 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to an + external dataset. The program first writes integers to an + external dataset with dataspace dimensions of DIM_XxDIM_Y, + then closes the file. Next, it reopens the file, reads + back the data, and outputs the name of the external data + file and the data to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_External { + private static String FILENAME = "H5Ex_D_External.h5"; + private static String EXTERNALNAME = "H5Ex_D_External.data"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + private static final int NAME_BUF_SIZE = 32; + + private static void writeExternal() { + long file_id = -1; + long dcpl_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // set the external file. + try { + if (dcpl_id >= 0) + H5.H5Pset_external(dcpl_id, EXTERNALNAME, 0, HDF5Constants.H5F_UNLIMITED); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the HDF5Constants.dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void readExternal() { + long file_id = -1; + long dcpl_id = -1; + long dataset_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + String[] Xname = new String[1]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the name of the external file. + long[] Xsize = new long[NAME_BUF_SIZE]; + try { + if (dcpl_id >= 0) + H5.H5Pget_external(dcpl_id, 0, Xsize.length, Xname, Xsize); + } + catch (Exception e) { + e.printStackTrace(); + } + System.out.println(DATASETNAME + " is stored in file: " + Xname[0]); + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_External.writeExternal(); + H5Ex_D_External.readExternal(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java new file mode 100644 index 00000000000..982d2cb44d8 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_FillValue.java @@ -0,0 +1,246 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the fill value for a + dataset. The program first sets the fill value to + FILLVAL, creates a dataset with dimensions of DIM_XxDIM_Y, + reads from the uninitialized dataset, and outputs the + contents to the screen. Next, it writes integers to the + dataset, reads the data back, and outputs it to the + screen. Finally it extends the dataset, reads from it, + and outputs the result to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_FillValue { + private static String FILENAME = "H5Ex_D_FillValue.h5"; + private static String DATASETNAME = "ExtendibleArray"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + + private static void fillValue() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the fill value for the dataset + try { + int[] fill_value = { FILLVAL }; + if (dcpl_id >= 0) + H5.H5Pset_fill_value(dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + if (dcpl_id >= 0) + H5.H5Pset_alloc_time(dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the dataset creation property list. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read values from the dataset, which has not been written to yet. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before being written to:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(read_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data back. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after being written to:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(read_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read from the extended dataset. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < EDIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < EDIM_Y; jndx++) + System.out.print(extend_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_D_FillValue.fillValue(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java new file mode 100644 index 00000000000..b8133672f55 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Gzip.java @@ -0,0 +1,336 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using gzip compression (also called zlib or deflate). The + program first checks if gzip compression is available, + then if it is it writes integers to a dataset using gzip, + then closes the file. Next, it reopens the file, reads + back the data, and outputs the type of compression and the + maximum value in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Gzip { + private static String FILENAME = "H5Ex_D_Gzip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeGzip() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the gzip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readGzip() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_Gzip.checkGzipFilter()) { + H5Ex_D_Gzip.writeGzip(); + H5Ex_D_Gzip.readGzip(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java new file mode 100644 index 00000000000..482e2c0a801 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Hyperslab.java @@ -0,0 +1,269 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a + dataset by hyberslabs. The program first writes integers + in a hyperslab selection to a dataset with dataspace + dimensions of DIM_XxDIM_Y, then closes the file. Next, it + reopens the file, reads back the data, and outputs it to + the screen. Finally it reads the data again using a + different hyperslab selection, and outputs the result to + the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Hyperslab { + private static String FILENAME = "H5Ex_D_Hyperslab.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int RANK = 2; + + private static void writeHyperslab() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data to "1", to make it easier to see the selections. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 1; + + // Print the data to the screen. + System.out.println("Original Data:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Define and select the first part of the hyperslab selection. + long[] start = { 0, 0 }; + long[] stride = { 3, 3 }; + long[] count = { 2, 3 }; + long[] block = { 2, 2 }; + try { + if ((filespace_id >= 0)) + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + } + catch (Exception e) { + e.printStackTrace(); + } + // Define and select the second part of the hyperslab selection, + // which is subtracted from the first selection by the use of + // H5S_SELECT_NOTB + block[0] = 1; + block[1] = 1; + try { + if ((filespace_id >= 0)) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + + // Write the data to the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readHyperslab() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written to disk by hyberslabs:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Initialize the read array. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 0; + + // Define and select the hyperslab to use for reading. + try { + if (dataset_id >= 0) { + filespace_id = H5.H5Dget_space(dataset_id); + + long[] start = { 0, 1 }; + long[] stride = { 4, 4 }; + long[] count = { 2, 2 }; + long[] block = { 2, 3 }; + + if (filespace_id >= 0) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Read the data using the previously defined hyperslab. + if ((dataset_id >= 0) && (filespace_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as read from disk by hyberslab:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Hyperslab.writeHyperslab(); + H5Ex_D_Hyperslab.readHyperslab(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java new file mode 100644 index 00000000000..f74b6751501 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Nbit.java @@ -0,0 +1,305 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the N-Bit filter. The program first checks if the + N-Bit filter is available, then if it is it writes integers + to a dataset using N-Bit, then closes the file. Next, it + reopens the file, reads back the data, and outputs the type + of filter and the maximum value in the dataset to the screen. + ************************************************************/ + +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Nbit { + private static String FILENAME = "H5Ex_D_Nbit.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkNbitFilter() { + try { + // Check if N-Bit compression is available and can be used for both compression and decompression. + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); + if (available == 0) { + System.out.println("N-Bit filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("N-Bit filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() throws Exception { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dtype_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + try { + // Create a new file using the default properties. + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + filespace_id = H5.H5Screate_simple(RANK, dims, null); + + // Create the datatype to use with the N-Bit filter. It has an uncompressed size of 32 bits, + // but will have a size of 16 bits after being packed by the N-Bit filter. + dtype_id = H5.H5Tcopy(HDF5Constants.H5T_STD_I32LE); + H5.H5Tset_precision(dtype_id, 16); + H5.H5Tset_offset(dtype_id, 5); + + // Create the dataset creation property list, add the N-Bit filter and set the chunk size. + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + H5.H5Pset_nbit(dcpl_id); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + + // Create the dataset. + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, dtype_id, filespace_id, HDF5Constants.H5P_DEFAULT, dcpl_id, + HDF5Constants.H5P_DEFAULT); + + // Write the data to the dataset. + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + if (dtype_id >= 0) + H5.H5Tclose(dtype_id); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + private static void readData() throws Exception { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Check if the read was successful. + if (status < 0) + System.out.print("Dataset read failed!"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + /* + * Check if N-Bit compression is available and can be used for both compression and decompression. Normally we + * do not perform error checking in these examples for the sake of clarity, but in this case we will make an + * exception because this filter is an optional part of the hdf5 library. + */ + try { + if (H5Ex_D_Nbit.checkNbitFilter()) { + H5Ex_D_Nbit.writeData(); + H5Ex_D_Nbit.readData(); + } + } + catch (Exception ex) { + ex.printStackTrace(); + } + } +} diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java new file mode 100644 index 00000000000..de94ccbd409 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_ReadWrite.java @@ -0,0 +1,179 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + + This example shows how to read and write data to a + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_ReadWrite { + private static String FILENAME = "H5Ex_D_ReadWrite.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + + private static void WriteDataset() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void ReadDataset() { + long file_id = -1; + long dataset_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_ReadWrite.WriteDataset(); + H5Ex_D_ReadWrite.ReadDataset(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java new file mode 100644 index 00000000000..ac3c1b4bc48 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Shuffle.java @@ -0,0 +1,373 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the shuffle filter with gzip compression. The + program first checks if the shuffle and gzip filters are + available, then if they are it writes integers to a + dataset using shuffle+gzip, then closes the file. Next, + it reopens the file, reads back the data, and outputs the + types of filters and the maximum value in the dataset to + the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Shuffle { + private static String FILENAME = "H5Ex_D_Shuffle.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static boolean checkShuffleFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + if (available == 0) { + System.out.println("Shuffle filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Shuffle filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeShuffle() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the shuffle + // filter and the gzip compression filter. + // The order in which the filters are added here is significant - + // we will see much greater results when the shuffle is applied + // first. The order in which the filters are added to the property + // list is the order in which they will be invoked when writing + // data. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_shuffle(dcpl_id); + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readShuffle() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the number of filters, and retrieve and print the + // type of each. + try { + if (dcpl_id >= 0) { + int nfilters = H5.H5Pget_nfilters(dcpl_id); + for (int indx = 0; indx < nfilters; indx++) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, indx, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); + System.out.print("Filter " + indx + ": Type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + // Similarly, check for availability of the shuffle filter. + if (H5Ex_D_Shuffle.checkGzipFilter() && H5Ex_D_Shuffle.checkShuffleFilter()) { + H5Ex_D_Shuffle.writeShuffle(); + H5Ex_D_Shuffle.readShuffle(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java new file mode 100644 index 00000000000..26c8d49896f --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Sofloat.java @@ -0,0 +1,356 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Scale-Offset filter. The program first checks + if the Scale-Offset filter is available, then if it is it + writes floating point numbers to a dataset using + Scale-Offset, then closes the file Next, it reopens the + file, reads back the data, and outputs the type of filter + and the maximum value in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Sofloat { + + private static String FILENAME = "H5Ex_D_Sofloat.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkScaleoffsetFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (available == 0) { + System.out.println("Scale-Offset filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Scale-Offset filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + double[][] dset_data = new double[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + double x = indx; + double y = jndx; + dset_data[indx][jndx] = (x + 1) / (y + 0.3) + y; + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + double max = dset_data[0][0]; + double min = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + if (min > dset_data[indx][jndx]) + min = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in write buffer is: " + max); + System.out.println("Minimum value in write buffer is: " + min); + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the Scale-Offset + // filter and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_FLOAT_DSCALE, 2); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + double[][] dset_data = new double[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + double max = dset_data[0][0]; + double min = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + if (min > dset_data[indx][jndx]) + min = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + System.out.println("Minimum value in " + DATASETNAME + " is: " + min); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + + // Check if Scale-Offset compression is available and can be used + // for both compression and decompression. Normally we do not + // perform error checking in these examples for the sake of + // clarity, but in this case we will make an exception because this + // filter is an optional part of the hdf5 library. + if (H5Ex_D_Sofloat.checkScaleoffsetFilter()) { + H5Ex_D_Sofloat.writeData(); + H5Ex_D_Sofloat.readData(); + } + } +} diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java new file mode 100644 index 00000000000..7939883ca28 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Soint.java @@ -0,0 +1,335 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Scale-Offset filter. The program first checks + if the Scale-Offset filter is available, then if it is it + writes integers to a dataset using Scale-Offset, then + closes the file Next, it reopens the file, reads back the + data, and outputs the type of filter and the maximum value + in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Soint { + + private static String FILENAME = "H5Ex_D_Soint.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkScaleoffsetFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (available == 0) { + System.out.println("Scale-Offset filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Scale-Offset filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the Scale-Offset + // filter and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_INT, HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + + // Check if Scale-Offset compression is available and can be used + // for both compression and decompression. Normally we do not + // perform error checking in these examples for the sake of + // clarity, but in this case we will make an exception because this + // filter is an optional part of the hdf5 library. + if (H5Ex_D_Soint.checkScaleoffsetFilter()) { + H5Ex_D_Soint.writeData(); + H5Ex_D_Soint.readData(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java new file mode 100644 index 00000000000..52582342d44 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Szip.java @@ -0,0 +1,337 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using szip compression. The program first checks if + szip compression is available, then if it is it writes + integers to a dataset using szip, then closes the file. + Next, it reopens the file, reads back the data, and + outputs the type of compression and the maximum value in + the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Szip { + private static String FILENAME = "H5Ex_D_Szip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkSzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); + if (available == 0) { + System.out.println("szip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("szip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeSzip() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the szip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_szip(dcpl_id, HDF5Constants.H5_SZIP_NN_OPTION_MASK, 8); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readSzip() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_Szip.checkSzipFilter()) { + H5Ex_D_Szip.writeSzip(); + H5Ex_D_Szip.readSzip(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java new file mode 100644 index 00000000000..1f289f3806a --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Transform.java @@ -0,0 +1,250 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using a data transform expression. The program first + writes integers to a dataset using the transform + expression TRANSFORM, then closes the file. Next, it + reopens the file, reads back the data without a transform, + and outputs the data to the screen. Finally it reads the + data using the transform expression RTRANSFORM and outputs + the results to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Transform { + + private static String FILE = "H5Ex_D_Transform.h5"; + private static String DATASET = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static String TRANSFORM = "x+1"; + private static String RTRANSFORM = "x-1"; + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dxpl_id = -1; + + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int i = 0; i < DIM_X; i++) + for (int j = 0; j < DIM_Y; j++) + dset_data[i][j] = i * j - j; + + // Output the data to the screen. + System.out.println("Original Data:"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset transfer property list and define the transform expression. + try { + dxpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + if (dxpl_id >= 0) + H5.H5Pset_data_transform(dxpl_id, TRANSFORM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the default properties. Unfortunately we must save as + // a native type or the transform operation will fail. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASET, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset using the dataset transfer property list. + try { + if ((dataset_id >= 0) && (dxpl_id >= 0)) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + dxpl_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dxpl_id >= 0) + H5.H5Pclose(dxpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + + long file_id = -1; + long dataset_id = -1; + long dxpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file using the default properties. + try { + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASET, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written with transform '" + TRANSFORM + "'"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Create the dataset transfer property list and define the transform expression. + try { + dxpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + if (dxpl_id >= 0) + H5.H5Pset_data_transform(dxpl_id, RTRANSFORM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the dataset transfer property list. + try { + if ((dataset_id >= 0) && (dxpl_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + dxpl_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + + System.out.println("Data as written with transform '" + TRANSFORM + "' and read with transform '" + + RTRANSFORM + "'"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Close and release resources. + try { + if (dxpl_id >= 0) + H5.H5Pclose(dxpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Transform.writeData(); + H5Ex_D_Transform.readData(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java new file mode 100644 index 00000000000..ada8df03662 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java @@ -0,0 +1,393 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, + outputs it to the screen, extends the dataset, and writes + new data to the extended portions of the dataset. Finally + it reopens the file again, reads back the data, and + outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedAdd { + private static String FILENAME = "H5Ex_D_UnlimitedAdd.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] start = { 0, 0 }; + long[] count = new long[2]; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Select the entire dataspace. + try { + if (dataspace_id >= 0) { + H5.H5Sselect_all(dataspace_id); + + // Subtract a hyperslab reflecting the original dimensions from the + // selection. The selection now contains only the newly extended + // portions of the dataset. + count[0] = dims[0]; + count[1] = dims[1]; + H5.H5Sselect_hyperslab(dataspace_id, HDF5Constants.H5S_SELECT_NOTB, start, null, count, null); + + // Write the data to the selected portion of the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_UnlimitedAdd.writeUnlimited(); + H5Ex_D_UnlimitedAdd.extendUnlimited(); + H5Ex_D_UnlimitedAdd.readUnlimited(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java new file mode 100644 index 00000000000..c08ceef5a85 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java @@ -0,0 +1,504 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset with gzip compression. The program first writes + integers to a gzip compressed dataset with dataspace + dimensions of DIM_XxDIM_Y, then closes the file. Next, it + reopens the file, reads back the data, outputs it to the + screen, extends the dataset, and writes new data to the + extended portions of the dataset. Finally it reopens the + file again, reads back the data, and outputs it to the + screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedGzip { + private static String FILENAME = "H5Ex_D_UnlimitedGzip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the gzip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] start = { 0, 0 }; + long[] count = new long[2]; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Select the entire dataspace. + try { + if (dataspace_id >= 0) { + H5.H5Sselect_all(dataspace_id); + + // Subtract a hyperslab reflecting the original dimensions from the + // selection. The selection now contains only the newly extended + // portions of the dataset. + count[0] = dims[0]; + count[1] = dims[1]; + H5.H5Sselect_hyperslab(dataspace_id, HDF5Constants.H5S_SELECT_NOTB, start, null, count, null); + + // Write the data to the selected portion of the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_UnlimitedGzip.checkGzipFilter()) { + H5Ex_D_UnlimitedGzip.writeUnlimited(); + H5Ex_D_UnlimitedGzip.extendUnlimited(); + H5Ex_D_UnlimitedGzip.readUnlimited(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java new file mode 100644 index 00000000000..884cad3b74b --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java @@ -0,0 +1,379 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, + outputs it to the screen, extends the dataset, and writes + new data to the entire extended dataset. Finally it + reopens the file again, reads back the data, and utputs it + to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedMod { + private static String FILENAME = "H5Ex_D_UnlimitedMod.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Write the data tto the extended dataset. + try { + if ((dataspace_id >= 0) && (dataset_id >= 0)) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_UnlimitedMod.writeUnlimited(); + H5Ex_D_UnlimitedMod.extendUnlimited(); + H5Ex_D_UnlimitedMod.readUnlimited(); + } + +} diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am new file mode 100644 index 00000000000..49888a01500 --- /dev/null +++ b/java/examples/datasets/Makefile.am @@ -0,0 +1,78 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/datasets +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)datasets.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_D_Alloc.java \ + H5Ex_D_Checksum.java \ + H5Ex_D_Chunk.java \ + H5Ex_D_Compact.java \ + H5Ex_D_External.java \ + H5Ex_D_FillValue.java \ + H5Ex_D_Gzip.java \ + H5Ex_D_Hyperslab.java \ + H5Ex_D_ReadWrite.java \ + H5Ex_D_Shuffle.java \ + H5Ex_D_Szip.java \ + H5Ex_D_UnlimitedAdd.java \ + H5Ex_D_UnlimitedGzip.java \ + H5Ex_D_UnlimitedMod.java \ + H5Ex_D_Nbit.java \ + H5Ex_D_Transform.java \ + H5Ex_D_Sofloat.java \ + H5Ex_D_Soint.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in new file mode 100644 index 00000000000..8ac28a7be4d --- /dev/null +++ b/java/examples/datasets/runExample.sh.in @@ -0,0 +1,413 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" + +TESTNAME=EX_Datasets +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/datasets" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@datasets.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Chunk.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Compact.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_External.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_FillValue.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Gzip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Hyperslab.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_ReadWrite.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Shuffle.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Szip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Nbit.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Transform.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Sofloat.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc > H5Ex_D_Alloc.out) +if diff H5Ex_D_Alloc.out examples.datasets.H5Ex_D_Alloc.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Alloc" +else + echo "**FAILED** datasets.H5Ex_D_Alloc" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum > H5Ex_D_Checksum.out) +if diff H5Ex_D_Checksum.out examples.datasets.H5Ex_D_Checksum.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Checksum" +else + echo "**FAILED** datasets.H5Ex_D_Checksum" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk > H5Ex_D_Chunk.out) +if diff H5Ex_D_Chunk.out examples.datasets.H5Ex_D_Chunk.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Chunk" +else + echo "**FAILED** datasets.H5Ex_D_Chunk" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact > H5Ex_D_Compact.out) +if diff H5Ex_D_Compact.out examples.datasets.H5Ex_D_Compact.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Compact" +else + echo "**FAILED** datasets.H5Ex_D_Compact" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External > H5Ex_D_External.out) +if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_External" +else + echo "**FAILED** datasets.H5Ex_D_External" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue > H5Ex_D_FillValue.out) +if diff H5Ex_D_FillValue.out examples.datasets.H5Ex_D_FillValue.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_FillValue" +else + echo "**FAILED** datasets.H5Ex_D_FillValue" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip > H5Ex_D_Gzip.out) +if diff H5Ex_D_Gzip.out examples.datasets.H5Ex_D_Gzip.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Gzip" +else + echo "**FAILED** datasets.H5Ex_D_Gzip" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab > H5Ex_D_Hyperslab.out) +if diff H5Ex_D_Hyperslab.out examples.datasets.H5Ex_D_Hyperslab.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Hyperslab" +else + echo "**FAILED** datasets.H5Ex_D_Hyperslab" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite > H5Ex_D_ReadWrite.out) +if diff H5Ex_D_ReadWrite.out examples.datasets.H5Ex_D_ReadWrite.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_ReadWrite" +else + echo "**FAILED** datasets.H5Ex_D_ReadWrite" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle > H5Ex_D_Shuffle.out) +if diff H5Ex_D_Shuffle.out examples.datasets.H5Ex_D_Shuffle.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Shuffle" +else + echo "**FAILED** datasets.H5Ex_D_Shuffle" + nerrors="`expr $nerrors + 1`" +fi + +if test $USE_FILTER_SZIP = "yes"; then + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip" + ($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip > H5Ex_D_Szip.out) + if diff H5Ex_D_Szip.out examples.datasets.H5Ex_D_Szip.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Szip" + else + echo "**FAILED** datasets.H5Ex_D_Szip" + nerrors="`expr $nerrors + 1`" + fi +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd > H5Ex_D_UnlimitedAdd.out) +if diff H5Ex_D_UnlimitedAdd.out examples.datasets.H5Ex_D_UnlimitedAdd.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedAdd" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedAdd" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip > H5Ex_D_UnlimitedGzip.out) +if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedGzip" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedGzip" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod > H5Ex_D_UnlimitedMod.out) +if diff H5Ex_D_UnlimitedMod.out examples.datasets.H5Ex_D_UnlimitedMod.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedMod" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedMod" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit > H5Ex_D_Nbit.out) +if diff H5Ex_D_Nbit.out examples.datasets.H5Ex_D_Nbit.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Nbit" +else + echo "**FAILED** datasets.H5Ex_D_Nbit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform > H5Ex_D_Transform.out) +if diff H5Ex_D_Transform.out examples.datasets.H5Ex_D_Transform.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Transform" +else + echo "**FAILED** datasets.H5Ex_D_Transform" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat > H5Ex_D_Sofloat.out) +if diff H5Ex_D_Sofloat.out examples.datasets.H5Ex_D_Sofloat.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Sofloat" +else + echo "**FAILED** datasets.H5Ex_D_Sofloat" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint > H5Ex_D_Soint.out) +if diff H5Ex_D_Soint.out examples.datasets.H5Ex_D_Soint.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Soint" +else + echo "**FAILED** datasets.H5Ex_D_Soint" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt new file mode 100644 index 00000000000..6525506377e --- /dev/null +++ b/java/examples/datatypes/CMakeLists.txt @@ -0,0 +1,109 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_DATATYPES Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_T_Array + H5Ex_T_ArrayAttribute + H5Ex_T_Bit + H5Ex_T_BitAttribute + H5Ex_T_Commit + H5Ex_T_Compound + H5Ex_T_CompoundAttribute + H5Ex_T_Float + H5Ex_T_FloatAttribute + H5Ex_T_Integer + H5Ex_T_IntegerAttribute + H5Ex_T_ObjectReference + H5Ex_T_ObjectReferenceAttribute + H5Ex_T_Opaque + H5Ex_T_OpaqueAttribute + H5Ex_T_String + H5Ex_T_StringAttribute + H5Ex_T_VLString +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.datatypes.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_datatypes-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.datatypes.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datatypes/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=datatypes/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_datatypes-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_datatypes-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datatypes-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_datatypes-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt + ${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clearall-objects) + set (last_test "JAVA_datatypes-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java new file mode 100644 index 00000000000..7b7009acbde --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Array.java @@ -0,0 +1,282 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write array datatypes + to a dataset. The program first writes integers arrays of + dimension ADIM0xADIM1 to a dataset with a dataspace of + DIM0, then closes the file. Next, it reopens the file, + reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Array { + private static String FILENAME = "H5Ex_T_Array.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; + + // Initialize data. indx is the element in the dataspace, jndx and kndx the + // elements within the array datatype. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < ADIM0; jndx++) + for (int kndx = 0; kndx < ADIM1; kndx++) + dset_data[indx][jndx][kndx] = indx * jndx - jndx * kndx + indx * kndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for file. + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype. + try { + if (dataset_id >= 0) + filetype_id = H5.H5Dget_type(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype's dimensions. + try { + if (filetype_id >= 0) + H5.H5Tget_array_dims(filetype_id, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, 2, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]:"); + for (int jndx = 0; jndx < adims[0]; jndx++) { + System.out.print(" ["); + for (int kndx = 0; kndx < adims[1]; kndx++) + System.out.print(dset_data[indx][jndx][kndx] + " "); + System.out.println("]"); + } + System.out.println(); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Array.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Array.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java new file mode 100644 index 00000000000..ce97457cb6f --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java @@ -0,0 +1,322 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write array datatypes + to an attribute. The program first writes integers arrays + of dimension ADIM0xADIM1 to an attribute with a dataspace + of DIM0, then closes the file. Next, it reopens the + file, reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ArrayAttribute { + private static String FILENAME = "H5Ex_T_ArrayAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; + + // Initialize data. indx is the element in the dataspace, jndx and kndx the + // elements within the array datatype. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < ADIM0; jndx++) + for (int kndx = 0; kndx < ADIM1; kndx++) + dset_data[indx][jndx][kndx] = indx * jndx - jndx * kndx + indx * kndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for file. + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype. + try { + if (attribute_id >= 0) + filetype_id = H5.H5Aget_type(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype's dimensions. + try { + if (filetype_id >= 0) + H5.H5Tget_array_dims(filetype_id, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, 2, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + " [" + indx + "]:"); + for (int jndx = 0; jndx < adims[0]; jndx++) { + System.out.print(" ["); + for (int kndx = 0; kndx < adims[1]; kndx++) + System.out.print(dset_data[indx][jndx][kndx] + " "); + System.out.println("]"); + } + System.out.println(); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_ArrayAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_ArrayAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java new file mode 100644 index 00000000000..f76c7d5b6b7 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Bit.java @@ -0,0 +1,227 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write bitfield + datatypes to a dataset. The program first writes bit + fields to a dataset with a dataspace of DIM0xDIM1, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Bit { + private static String FILENAME = "H5Ex_T_Bit.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = 0; + dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the bitfield data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print("{" + (dset_data[indx][jndx] & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 2) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 4) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 6) & 0x03) + "}"); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Bit.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Bit.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java new file mode 100644 index 00000000000..a5ab81b0c6f --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -0,0 +1,267 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write bitfield + datatypes to an attribute. The program first writes bit + fields to an attribute with a dataspace of DIM0xDIM1, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_BitAttribute { + private static String FILENAME = "H5Ex_T_BitAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = 0; + dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_B8, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_B8, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print("{" + (dset_data[indx][jndx] & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 2) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 4) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 6) & 0x03) + "}"); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_BitAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_BitAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java new file mode 100644 index 00000000000..d4e43f9cc19 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Commit.java @@ -0,0 +1,265 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to commit a named datatype to a + file, and read back that datatype. The program first + defines a compound datatype, commits it to a file, then + closes the file. Next, it reopens the file, opens the + datatype, and outputs the names of its fields to the + screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_T_Commit { + private static String FILENAME = "H5Ex_T_Commit.h5"; + private static String DATATYPENAME = "Sensor_Type"; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + // Values for the various classes of datatypes + enum H5T_class { + H5T_NO_CLASS(HDF5Constants.H5T_NO_CLASS), // error + H5T_INTEGER(HDF5Constants.H5T_INTEGER), // integer types + H5T_FLOAT(HDF5Constants.H5T_FLOAT), // floating-point types + H5T_TIME(HDF5Constants.H5T_TIME), // date and time types + H5T_STRING(HDF5Constants.H5T_STRING), // character string types + H5T_BITFIELD(HDF5Constants.H5T_BITFIELD), // bit field types + H5T_OPAQUE(HDF5Constants.H5T_OPAQUE), // opaque types + H5T_COMPOUND(HDF5Constants.H5T_COMPOUND), // compound types + H5T_REFERENCE(HDF5Constants.H5T_REFERENCE), // reference types + H5T_ENUM(HDF5Constants.H5T_ENUM), // enumeration types + H5T_VLEN(HDF5Constants.H5T_VLEN), // Variable-Length types + H5T_ARRAY(HDF5Constants.H5T_ARRAY), // Array types + H5T_NCLASSES(11); // this must be last + + private static final Map lookup = new HashMap(); + + static { + for (H5T_class s : EnumSet.allOf(H5T_class.class)) + lookup.put(s.getCode(), s); + } + + private long code; + + H5T_class(long layout_type) { + this.code = layout_type; + } + + public long getCode() { + return this.code; + } + + public static H5T_class get(long typeclass_id) { + return lookup.get(typeclass_id); + } + } + + // The supporting Sensor_Datatype class. + private static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, HDF5Constants.H5T_IEEE_F64BE, + HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members not the object. + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + private static void CreateDataType() { + long file_id = -1; + long strtype_id = -1; + long filetype_id = -1; + Sensor_Datatype datatypes = new Sensor_Datatype(); + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = datatypes.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, datatypes.memberNames[indx], Sensor_Datatype.getOffset(indx), type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Commit the compound datatype to the file, creating a named datatype. + try { + if ((file_id >= 0) && (filetype_id >= 0)) + H5.H5Tcommit(file_id, DATATYPENAME, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the str type. + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataType() { + long file_id = -1; + long typeclass_id = -1; + long filetype_id = -1; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open named datatype. + try { + if (file_id >= 0) + filetype_id = H5.H5Topen(file_id, DATATYPENAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Named datatype: " + DATATYPENAME + ":"); + + // Get datatype class. If it isn't compound, we won't print anything. + try { + if (filetype_id >= 0) + typeclass_id = H5.H5Tget_class(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + // Read data. + try { + if (H5T_class.get(typeclass_id) == H5T_class.H5T_COMPOUND) { + System.out.println(" Class: H5T_COMPOUND"); + int nmembs = H5.H5Tget_nmembers(filetype_id); + // Iterate over compound datatype members. + for (int indx = 0; indx < nmembs; indx++) { + String member_name = H5.H5Tget_member_name(filetype_id, indx); + System.out.println(" " + member_name); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Commit.CreateDataType(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Commit.ReadDataType(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java new file mode 100644 index 00000000000..f270cb9d3bd --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Compound.java @@ -0,0 +1,443 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write compound + datatypes to a dataset. The program first writes + compound structures to a dataset with a dataspace of DIM0, + then closes the file. Next, it reopens the file, reads + back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; + +public class H5Ex_T_Compound { + private static String FILENAME = "H5Ex_T_Compound.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; + static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members. + static long getTotalDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return DIM0 * data_size; + } + + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + static class Sensor { + public int serial_no; + public String location; + public double temperature; + public double pressure; + + Sensor(int serial_no, String location, double temperature, double pressure) { + this.serial_no = serial_no; + this.location = location; + this.temperature = temperature; + this.pressure = pressure; + } + + Sensor(ByteBuffer databuf, int dbposition) { + readBuffer(databuf, dbposition); + } + + void writeBuffer(ByteBuffer databuf, int dbposition) { + databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); + byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + for (int ndx = 0; ndx < arraylen; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); + for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); + } + + void readBuffer(ByteBuffer databuf, int dbposition) { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + ByteBuffer stringbuf = databuf.duplicate(); + stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); + stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); + byte[] bytearr = new byte[stringbuf.remaining()]; + stringbuf.get(bytearr); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + } + + @Override + public String toString() { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); + } + } + + private static void CreateDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data = new Sensor[DIM0]; + byte[] dset_data = null; + + // Initialize data. + object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); + object_data[1] = new Sensor(1184, new String("Intake"), 55.12, 22.95); + object_data[2] = new Sensor(1027, new String("Intake manifold"), 103.55, 31.23); + object_data[3] = new Sensor(1313, new String("Exhaust manifold"), 1252.89, 84.11); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the compound data to the dataset. + // allocate memory for read buffer. + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; + ByteBuffer outBuf = ByteBuffer.wrap(dset_data); + outBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data2; + byte[] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // allocate memory for read buffer. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + + object_data2 = new Sensor[(int) dims[0]]; + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + + ByteBuffer inBuf = ByteBuffer.wrap(dset_data); + inBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]:"); + System.out.println(object_data2[indx].toString()); + } + System.out.println(); + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Compound.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Compound.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java new file mode 100644 index 00000000000..25581d446ac --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java @@ -0,0 +1,486 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write compound + datatypes to an attribute. The program first writes + compound structures to an attribute with a dataspace of + DIM0, then closes the file. Next, it reopens the file, + reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; + +public class H5Ex_T_CompoundAttribute { + private static String FILENAME = "H5Ex_T_CompoundAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + // Using Java Externalization will add a two-byte object header in + // the stream, which needs to be called out in the datatypes. + static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; + static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members not the object. + static long getTotalDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return DIM0 * data_size; + } + + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + static class Sensor { + public int serial_no; + public String location; + public double temperature; + public double pressure; + + Sensor(int serial_no, String location, double temperature, double pressure) { + this.serial_no = serial_no; + this.location = location; + this.temperature = temperature; + this.pressure = pressure; + } + + Sensor(ByteBuffer databuf, int dbposition) { + readBuffer(databuf, dbposition); + } + + void writeBuffer(ByteBuffer databuf, int dbposition) { + databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); + byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + for (int ndx = 0; ndx < arraylen; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); + for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); + } + + void readBuffer(ByteBuffer databuf, int dbposition) { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + ByteBuffer stringbuf = databuf.duplicate(); + stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); + stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); + byte[] bytearr = new byte[stringbuf.remaining()]; + stringbuf.get(bytearr); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + } + + @Override + public String toString() { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); + } + } + + private static void CreateDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data = new Sensor[DIM0]; + byte[] dset_data = null; + + // Initialize data. + object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); + object_data[1] = new Sensor(1184, new String("Intake"), 55.12, 22.95); + object_data[2] = new Sensor(1027, new String("Intake manifold"), 103.55, 31.23); + object_data[3] = new Sensor(1313, new String("Exhaust manifold"), 1252.89, 84.11); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the compound data. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + ByteBuffer outBuf = ByteBuffer.wrap(dset_data); + outBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data2; + byte[] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // three dimensional dataset when the array datatype is included so + // the dynamic allocation must be done in steps. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // allocate memory for read buffer. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + + object_data2 = new Sensor[(int) dims[0]]; + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + + ByteBuffer inBuf = ByteBuffer.wrap(dset_data); + inBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + " [" + indx + "]:"); + System.out.println(object_data2[indx].toString()); + } + System.out.println(); + + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_CompoundAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_CompoundAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java new file mode 100644 index 00000000000..1b5fd9bd67c --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -0,0 +1,227 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to a dataset. The program first writes integers to a + dataset with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Float { + private static String FILENAME = "H5Ex_T_Float.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data = new double[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx / (jndx + 0.5) + jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the floating point data to it. In + // this example we will save the data as 64 bit little endian IEEE + // floating point numbers, regardless of the native type. The HDF5 + // library automatically converts between different floating point + // types. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new double[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0.0000"); + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Float.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Float.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java new file mode 100644 index 00000000000..de1dac71ec0 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -0,0 +1,263 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write floating point + datatypes to an attribute. The program first writes + floating point numbers to an attribute with a dataspace of + DIM0xDIM1, then closes the file. Next, it reopens the + file, reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_FloatAttribute { + private static String FILENAME = "H5Ex_T_FloatAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data = new double[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx / (jndx + 0.5) + jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_DOUBLE, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new double[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_DOUBLE, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0.0000"); + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_FloatAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_FloatAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java new file mode 100644 index 00000000000..2f365cd23b5 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Integer.java @@ -0,0 +1,226 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to a dataset. The program first writes integers to a + dataset with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Integer { + private static String FILENAME = "H5Ex_T_Integer.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx * jndx - jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the integer data to it. In this + // example we will save the data as 64 bit big endian integers, + // regardless of the native integer type. The HDF5 library + // automatically converts between different integer types. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0"); + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Integer.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Integer.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java new file mode 100644 index 00000000000..c153d99453b --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java @@ -0,0 +1,263 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to an attribute. The program first writes integers to an + attribute with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_IntegerAttribute { + private static String FILENAME = "H5Ex_T_IntegerAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx * jndx - jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_INT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_INT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0"); + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_IntegerAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_IntegerAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java new file mode 100644 index 00000000000..3cad6c91503 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java @@ -0,0 +1,347 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write object references + to a dataset. The program first creates objects in the + file and writes references to those objects to a dataset + with a dataspace of DIM0, then closes the file. Next, it + reopens the file, dereferences the references, and outputs + the names of their targets to the screen. + ************************************************************/ +package examples.datatypes; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ObjectReference { + private static String FILENAME = "H5Ex_T_ObjectReference.h5"; + private static String DATASETNAME = "DS1"; + private static String DATASETNAME2 = "DS2"; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; + + // Values for the status of space allocation + enum H5G_obj { + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ + private static final Map lookup = new HashMap(); + + static { + for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_obj(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_obj get(int code) { + return lookup.get(code); + } + } + + private static void writeObjRef() { + long file_id = -1; + long dataspace_id = -1; + long filespace_id = -1; + long group_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][8]; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if ((file_id >= 0) && (dataspace_id >= 0)) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + if (group_id >= 0) + H5.H5Gclose(group_id); + group_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create references to the previously created objects. Passing -1 + // as space_id causes this parameter to be ignored. Other values + // besides valid dataspaces result in an error. + try { + if (file_id >= 0) { + byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1); + byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1); + for (int indx = 0; indx < 8; indx++) { + dset_data[0][indx] = rbuf0[indx]; + dset_data[1][indx] = rbuf1[indx]; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_REF_OBJ, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the object references to it. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readObjRef() { + long file_id = -1; + long dataset_id = -1; + long dataspace_id = -1; + int object_type = -1; + long object_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new byte[(int)dims[0]][8]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + "[" + indx + "]:"); + System.out.print(" ->"); + // Open the referenced object, get its name and type. + try { + if (dataset_id >= 0) { + object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]); + object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]); + } + String[] obj_name = new String[1]; + long name_size = 1; + if (object_type >= 0) { + // Get the length of the name and retrieve the name. + name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size); + } + if ((object_id >= 0) && (object_type >= -1)) { + switch (H5G_obj.get(object_type)) { + case H5G_GROUP: + System.out.print("H5G_GROUP"); + try { + if (object_id >= 0) + H5.H5Gclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_DATASET: + System.out.print("H5G_DATASET"); + try { + if (object_id >= 0) + H5.H5Dclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_TYPE: + System.out.print("H5G_TYPE"); + try { + if (object_id >= 0) + H5.H5Tclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + default: + System.out.print("UNHANDLED"); + } + } + // Print the name. + if (name_size > 1) + System.out.println(": " + obj_name[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // End access to the dataset and release resources used by it. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + H5Ex_T_ObjectReference.writeObjRef(); + H5Ex_T_ObjectReference.readObjRef(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java new file mode 100644 index 00000000000..e3540297337 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java @@ -0,0 +1,389 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write object references + to an attribute. The program first creates objects in the + file and writes references to those objects to an + attribute with a dataspace of DIM0, then closes the file. + Next, it reopens the file, dereferences the references, + and outputs the names of their targets to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ObjectReferenceAttribute { + private static String FILENAME = "H5Ex_T_ObjectReferenceAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static String DATASETNAME2 = "DS2"; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; + + // Values for the status of space allocation + enum H5G_obj { + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ + private static final Map lookup = new HashMap(); + + static { + for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_obj(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_obj get(int code) { + return lookup.get(code); + } + } + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long group_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][8]; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + if (group_id >= 0) + H5.H5Gclose(group_id); + group_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create references to the previously created objects. Passing -1 + // as space_id causes this parameter to be ignored. Other values + // besides valid dataspaces result in an error. + try { + if (file_id >= 0) { + byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1); + byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1); + for (int indx = 0; indx < 8; indx++) { + dset_data[0][indx] = rbuf0[indx]; + dset_data[1][indx] = rbuf1[indx]; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace to serve as the parent + // for the attribute. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF_OBJ, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + int object_type = -1; + long object_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new byte[(int) dims[0]][8]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + "[" + indx + "]:"); + System.out.print(" ->"); + // Open the referenced object, get its name and type. + try { + if (dataset_id >= 0) { + object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]); + object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]); + } + String[] obj_name = new String[1]; + long name_size = 1; + if (object_type >= 0) { + // Get the length of the name and retrieve the name. + name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size); + } + if ((object_id >= 0) && (object_type >= -1)) { + switch (H5G_obj.get(object_type)) { + case H5G_GROUP: + System.out.print("H5G_GROUP"); + try { + if (object_id >= 0) + H5.H5Gclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_DATASET: + System.out.print("H5G_DATASET"); + try { + if (object_id >= 0) + H5.H5Dclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_TYPE: + System.out.print("H5G_TYPE"); + try { + if (object_id >= 0) + H5.H5Tclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + default: + System.out.print("UNHANDLED"); + } + } + // Print the name. + if (name_size > 1) + System.out.println(": " + obj_name[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_ObjectReferenceAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_ObjectReferenceAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java new file mode 100644 index 00000000000..eb45686786f --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Opaque.java @@ -0,0 +1,270 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write opaque datatypes + to a dataset. The program first writes opaque data to a + dataset with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Opaque { + private static String FILENAME = "H5Ex_T_Opaque.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long datatype_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[] dset_data = new byte[DIM0 * LEN]; + byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < LEN - 1; jndx++) + dset_data[jndx + indx * LEN] = str_data[jndx]; + dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create opaque datatype and set the tag to something appropriate. + // For this example we will write and view the data as a character + // array. + try { + datatype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)LEN); + if (datatype_id >= 0) + H5.H5Tset_tag(datatype_id, "Character array"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the integer data to it. In this + // example we will save the data as 64 bit big endian integers, + // regardless of the native integer type. The HDF5 library + // automatically converts between different integer types. + try { + if ((file_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, datatype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the opaque data to the dataset. + try { + if ((dataset_id >= 0) && (datatype_id >= 0)) + H5.H5Dwrite(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long datatype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long type_len = -1; + long[] dims = { DIM0 }; + byte[] dset_data; + String tag_name = null; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get datatype and properties for the datatype. + try { + if (dataset_id >= 0) + datatype_id = H5.H5Dget_type(dataset_id); + if (datatype_id >= 0) { + type_len = H5.H5Tget_size(datatype_id); + tag_name = H5.H5Tget_tag(datatype_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate buffer. + dset_data = new byte[(int) (dims[0] * type_len)]; + + // Read data. + try { + if ((dataset_id >= 0) && (datatype_id >= 0)) + H5.H5Dread(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Datatype tag for " + DATASETNAME + " is: \"" + tag_name + "\""); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(DATASETNAME + "[" + indx + "]: "); + for (int jndx = 0; jndx < type_len; jndx++) { + char temp = (char) dset_data[jndx + indx * (int)type_len]; + System.out.print(temp); + } + System.out.println(""); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Opaque.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Opaque.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java new file mode 100644 index 00000000000..e42bfe8efdd --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java @@ -0,0 +1,307 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write opaque datatypes + to an attribute. The program first writes opaque data to + an attribute with a dataspace of DIM0, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_OpaqueAttribute { + private static String FILENAME = "H5Ex_T_OpaqueAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long datatype_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[] dset_data = new byte[DIM0 * LEN]; + byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < LEN - 1; jndx++) + dset_data[jndx + indx * LEN] = str_data[jndx]; + dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create opaque datatype and set the tag to something appropriate. + // For this example we will write and view the data as a character + // array. + try { + datatype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)LEN); + if (datatype_id >= 0) + H5.H5Tset_tag(datatype_id, "Character array"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, datatype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((attribute_id >= 0) && (datatype_id >= 0)) + H5.H5Awrite(attribute_id, datatype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long datatype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long type_len = -1; + long[] dims = { DIM0 }; + byte[] dset_data; + String tag_name = null; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get datatype and properties for the datatype. + try { + if (attribute_id >= 0) + datatype_id = H5.H5Aget_type(attribute_id); + if (datatype_id >= 0) { + type_len = H5.H5Tget_size(datatype_id); + tag_name = H5.H5Tget_tag(datatype_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate buffer. + dset_data = new byte[(int) (dims[0] * type_len)]; + + // Read data. + try { + if ((attribute_id >= 0) && (datatype_id >= 0)) + H5.H5Aread(attribute_id, datatype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Datatype tag for " + ATTRIBUTENAME + " is: \"" + tag_name + "\""); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(ATTRIBUTENAME + "[" + indx + "]: "); + for (int jndx = 0; jndx < type_len; jndx++) { + char temp = (char) dset_data[jndx + indx * (int)type_len]; + System.out.print(temp); + } + System.out.println(""); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_OpaqueAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_OpaqueAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java new file mode 100644 index 00000000000..469172db5bc --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_String.java @@ -0,0 +1,311 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write string datatypes + to a dataset. The program first writes strings to a + dataset with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_String { + private static String FILENAME = "H5Ex_T_String.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][SDIM]; + StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), + new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create file and memory datatypes. For this example we will save + // the strings as FORTRAN strings, therefore they do not need space + // for the null terminator in the file. + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_FORTRAN_S1); + if (filetype_id >= 0) + H5.H5Tset_size(filetype_id, SDIM - 1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, SDIM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the string data to it. + try { + if ((file_id >= 0) && (filetype_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < SDIM; jndx++) { + if (jndx < str_data[indx].length()) + dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + else + dset_data[indx][jndx] = 0; + } + } + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long sdim = 0; + long[] dims = { DIM0 }; + byte[][] dset_data; + StringBuffer[] str_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype and its size. + try { + if (dataset_id >= 0) + filetype_id = H5.H5Dget_type(dataset_id); + if (filetype_id >= 0) { + sdim = H5.H5Tget_size(filetype_id); + sdim++; // Make room for null terminator + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate space for data. + dset_data = new byte[(int) dims[0]][(int)sdim]; + str_data = new StringBuffer[(int) dims[0]]; + + // Create the memory datatype. + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, sdim); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + byte[] tempbuf = new byte[(int)sdim]; + for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int jndx = 0; jndx < sdim; jndx++) { + tempbuf[jndx] = dset_data[indx][jndx]; + } + str_data[indx] = new StringBuffer(new String(tempbuf).trim()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_String.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_String.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java new file mode 100644 index 00000000000..49361bc3745 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java @@ -0,0 +1,351 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write string datatypes + to an attribute. The program first writes strings to an + attribute with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_StringAttribute { + private static String FILENAME = "H5Ex_T_StringAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][SDIM]; + StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), + new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create file and memory datatypes. For this example we will save + // the strings as FORTRAN strings, therefore they do not need space + // for the null terminator in the file. + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_FORTRAN_S1); + if (filetype_id >= 0) + H5.H5Tset_size(filetype_id, SDIM - 1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, SDIM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < SDIM; jndx++) { + if (jndx < str_data[indx].length()) + dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + else + dset_data[indx][jndx] = 0; + } + } + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long sdim = 0; + long[] dims = { DIM0 }; + byte[][] dset_data; + StringBuffer[] str_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype and its size. + try { + if (attribute_id >= 0) + filetype_id = H5.H5Aget_type(attribute_id); + if (filetype_id >= 0) { + sdim = H5.H5Tget_size(filetype_id); + sdim++; // Make room for null terminator + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate space for data. + dset_data = new byte[(int) dims[0]][(int)sdim]; + str_data = new StringBuffer[(int) dims[0]]; + + // Create the memory datatype. + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, sdim); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + byte[] tempbuf = new byte[(int)sdim]; + for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int jndx = 0; jndx < sdim; jndx++) { + tempbuf[jndx] = dset_data[indx][jndx]; + } + str_data[indx] = new StringBuffer(new String(tempbuf).trim()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_StringAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_StringAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java new file mode 100644 index 00000000000..c8892bac769 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_VLString.java @@ -0,0 +1,138 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and writing a VL string to a file. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_VLString +{ + private static String FILENAME = "H5Ex_T_VLString.h5"; + private static String DATASETNAME = "DS1"; + + private static void createDataset() { + long file_id = -1; + long type_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + int rank = 1; + String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; + long[] dims = { str_data.length }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + type_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + H5.H5Tset_size(type_id, HDF5Constants.H5T_VARIABLE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(rank, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the string data to it. + try { + if ((file_id >= 0) && (type_id >= 0) && (dataspace_id >= 0)) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, type_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + H5.H5Sclose(dataspace_id); + H5.H5Tclose(type_id); + H5.H5Dclose(dataset_id); + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readDataset() { + long file_id = -1; + long type_id = -1; + long dataset_id = -1; + String[] str_data = { "", "", "", "" }; + + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + type_id = H5.H5Dget_type(dataset_id); + H5.H5Dread_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, + str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + for (int indx = 0; indx < str_data.length; indx++) + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + + try { + H5.H5Tclose(type_id); + H5.H5Dclose(dataset_id); + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_T_VLString.createDataset(); + H5Ex_T_VLString.readDataset(); + } + +} diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am new file mode 100644 index 00000000000..de2ea9d642a --- /dev/null +++ b/java/examples/datatypes/Makefile.am @@ -0,0 +1,78 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/datatypes +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)datatypes.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_T_Array.java \ + H5Ex_T_ArrayAttribute.java \ + H5Ex_T_Bit.java \ + H5Ex_T_BitAttribute.java \ + H5Ex_T_Commit.java \ + H5Ex_T_Compound.java \ + H5Ex_T_CompoundAttribute.java \ + H5Ex_T_Float.java \ + H5Ex_T_FloatAttribute.java \ + H5Ex_T_Integer.java \ + H5Ex_T_IntegerAttribute.java \ + H5Ex_T_ObjectReference.java \ + H5Ex_T_ObjectReferenceAttribute.java \ + H5Ex_T_Opaque.java \ + H5Ex_T_OpaqueAttribute.java \ + H5Ex_T_String.java \ + H5Ex_T_StringAttribute.java \ + H5Ex_T_VLString.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in new file mode 100644 index 00000000000..9ed3954088b --- /dev/null +++ b/java/examples/datatypes/runExample.sh.in @@ -0,0 +1,408 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Datatypes +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/datatypes" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@datatypes.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Bit.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Commit.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Compound.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Float.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Integer.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Opaque.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_String.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array > H5Ex_T_Array.out) +if diff H5Ex_T_Array.out examples.datatypes.H5Ex_T_Array.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Array" +else + echo "**FAILED** datatypes.H5Ex_T_Array" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute > H5Ex_T_ArrayAttribute.out) +if diff H5Ex_T_ArrayAttribute.out examples.datatypes.H5Ex_T_ArrayAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ArrayAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_ArrayAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit > H5Ex_T_Bit.out) +if diff H5Ex_T_Bit.out examples.datatypes.H5Ex_T_Bit.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Bit" +else + echo "**FAILED** datatypes.H5Ex_T_Bit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute > H5Ex_T_BitAttribute.out) +if diff H5Ex_T_BitAttribute.out examples.datatypes.H5Ex_T_BitAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_BitAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_BitAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit > H5Ex_T_Commit.out) +if diff H5Ex_T_Commit.out examples.datatypes.H5Ex_T_Commit.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Commit" +else + echo "**FAILED** datatypes.H5Ex_T_Commit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound > H5Ex_T_Compound.out) +if diff H5Ex_T_Compound.out examples.datatypes.H5Ex_T_Compound.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Compound" +else + echo "**FAILED** datatypes.H5Ex_T_Compound" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute > H5Ex_T_CompoundAttribute.out) +if diff H5Ex_T_CompoundAttribute.out examples.datatypes.H5Ex_T_CompoundAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_CompoundAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_CompoundAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float > H5Ex_T_Float.out) +if diff H5Ex_T_Float.out examples.datatypes.H5Ex_T_Float.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Float" +else + echo "**FAILED** datatypes.H5Ex_T_Float" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute > H5Ex_T_FloatAttribute.out) +if diff H5Ex_T_FloatAttribute.out examples.datatypes.H5Ex_T_FloatAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_FloatAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_FloatAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer > H5Ex_T_Integer.out) +if diff H5Ex_T_Integer.out examples.datatypes.H5Ex_T_Integer.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Integer" +else + echo "**FAILED** datatypes.H5Ex_T_Integer" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute > H5Ex_T_IntegerAttribute.out) +if diff H5Ex_T_IntegerAttribute.out examples.datatypes.H5Ex_T_IntegerAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_IntegerAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_IntegerAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference > H5Ex_T_ObjectReference.out) +if diff H5Ex_T_ObjectReference.out examples.datatypes.H5Ex_T_ObjectReference.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ObjectReference" +else + echo "**FAILED** datatypes.H5Ex_T_ObjectReference" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute > H5Ex_T_ObjectReferenceAttribute.out) +if diff H5Ex_T_ObjectReferenceAttribute.out examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ObjectReferenceAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_ObjectReferenceAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque > H5Ex_T_Opaque.out) +if diff H5Ex_T_Opaque.out examples.datatypes.H5Ex_T_Opaque.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Opaque" +else + echo "**FAILED** datatypes.H5Ex_T_Opaque" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute > H5Ex_T_OpaqueAttribute.out) +if diff H5Ex_T_OpaqueAttribute.out examples.datatypes.H5Ex_T_OpaqueAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_OpaqueAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_OpaqueAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String > H5Ex_T_String.out) +if diff H5Ex_T_String.out examples.datatypes.H5Ex_T_String.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_String" +else + echo "**FAILED** datatypes.H5Ex_T_String" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute > H5Ex_T_StringAttribute.out) +if diff H5Ex_T_StringAttribute.out examples.datatypes.H5Ex_T_StringAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_StringAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_StringAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString > H5Ex_T_VLString.out) +if diff H5Ex_T_VLString.out examples.datatypes.H5Ex_T_VLString.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_VLString" +else + echo "**FAILED** datatypes.H5Ex_T_VLString" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt new file mode 100644 index 00000000000..0849f0c43dd --- /dev/null +++ b/java/examples/groups/CMakeLists.txt @@ -0,0 +1,138 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_GROUPS Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_G_Create + H5Ex_G_Iterate + H5Ex_G_Compact + H5Ex_G_Corder + H5Ex_G_Intermediate + H5Ex_G_Phase + H5Ex_G_Visit +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.groups.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +set (HDF_JAVA_TEST_FILES + h5ex_g_iterate.h5 + h5ex_g_visit.h5 +) + +foreach (h5_file ${HDF_JAVA_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( + TARGET H5Ex_G_Visit + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +endforeach (h5_file ${HDF_JAVA_TEST_FILES}) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_groups-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.groups.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=groups/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=groups/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_groups-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-clearall-objects") + if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") + if (${example} STREQUAL "H5Ex_G_Compact") + add_test ( + NAME JAVA_groups-${example}-clearall-h5s + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 + ) + else (${example} STREQUAL "H5Ex_G_Compact") + add_test ( + NAME JAVA_groups-${example}-clearall-h5s + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ) + endif (${example} STREQUAL "H5Ex_G_Compact") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-clearall-h5s PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-clearall-h5s") + endif (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") + add_test ( + NAME JAVA_groups-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt + ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java new file mode 100644 index 00000000000..ca9b6c817fe --- /dev/null +++ b/java/examples/groups/H5Ex_G_Compact.java @@ -0,0 +1,266 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating a file and print the storage layout. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Compact { + + private static final String FILE1 = "H5Ex_G_Compact1.h5"; + private static final String FILE2 = "H5Ex_G_Compact2.h5"; + private static final String GROUP = "G1"; + + enum H5G_storage { + H5G_STORAGE_TYPE_UNKNOWN(-1), + H5G_STORAGE_TYPE_SYMBOL_TABLE(0), + H5G_STORAGE_TYPE_COMPACT(1), + H5G_STORAGE_TYPE_DENSE(2); + + private static final Map lookup = new HashMap(); + + static { + for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_storage(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_storage get(int code) { + return lookup.get(code); + } + } + + public static void CreateGroup() { + long file_id = -1; + long group_id = -1; + long fapl_id = -1; + H5G_info_t ginfo; + long size; + + // Create file 1. This file will use original format groups. + try { + file_id = H5.H5Fcreate (FILE1, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Create a group in the file1. + try { + if(file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type. + try { + if(group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print("Group storage type for " + FILE1 + " is: "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // close the file 1. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open file 1. Need to get the correct file size. + try { + file_id = H5.H5Fopen(FILE1, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain and print the file size. + try { + if (file_id >= 0) { + size = H5.H5Fget_filesize(file_id); + System.out.println("File size for " + FILE1 + " is: " + size + " bytes"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close FILE1. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set file access property list to allow the latest file format. + // This will allow the library to create new compact format groups. + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + if (fapl_id >= 0) + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + } + catch (Exception e) { + e.printStackTrace(); + } + System.out.println(); + // Create file 2 using the new file access property list. + try { + file_id = H5.H5Fcreate(FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + // Create group in file2. + try { + if(file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type. + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print("Group storage type for " + FILE2 + " is: "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // close the file 2. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open file 2. Needed to get the correct file size. + try { + file_id = H5.H5Fopen(FILE2, HDF5Constants.H5F_ACC_RDONLY, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain and print the file size. + try { + if (file_id >= 0) { + size = H5.H5Fget_filesize(file_id); + System.out.println("File size for " + FILE2 + " is: " + size + " bytes"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close FILE2. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Compact.CreateGroup(); + } +} diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java new file mode 100644 index 00000000000..95790bfa30b --- /dev/null +++ b/java/examples/groups/H5Ex_G_Corder.java @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/************************************************************ + Creating a file with creation properties and traverse the + groups in alpabetical and creation order. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +public class H5Ex_G_Corder { + private static String FILE = "H5Ex_G_Corder.h5"; + + private static void CreateGroup() throws Exception { + long file_id = -1; + long group_id = -1; + long subgroup_id = -1; + long gcpl_id = -1; + int status; + H5G_info_t ginfo; + int i; + String name; + + try { + // Create a new file using default properties. + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create group creation property list and enable link creation order tracking. + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + status = H5.H5Pset_link_creation_order(gcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); + + // Create primary group using the property list. + if (status >= 0) + group_id = H5.H5Gcreate(file_id, "index_group", HDF5Constants.H5P_DEFAULT, gcpl_id, + HDF5Constants.H5P_DEFAULT); + + try { + /* + * Create subgroups in the primary group. These will be tracked by creation order. Note that these + * groups do not have to have the creation order tracking property set. + */ + subgroup_id = H5.H5Gcreate(group_id, "H", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "D", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "F", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "5", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + + // Get group info. + ginfo = H5.H5Gget_info(group_id); + + // Traverse links in the primary group using alphabetical indices (H5_INDEX_NAME). + System.out.println("Traversing group using alphabetical indices:"); + for (i = 0; i < ginfo.nlinks; i++) { + // Retrieve the name of the ith link in a group + name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + i, HDF5Constants.H5P_DEFAULT); + System.out.println("Index " + i + ": " + name); + } + + // Traverse links in the primary group by creation order (H5_INDEX_CRT_ORDER). + System.out.println("Traversing group using creation order indices:"); + for (i = 0; i < ginfo.nlinks; i++) { + // Retrieve the name of the ith link in a group + name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); + System.out.println("Index " + i + ": " + name); + } + + } + catch (Exception e) { + e.printStackTrace(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + if (group_id >= 0) + H5.H5Gclose(group_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + public static void main(String[] args) { + try { + H5Ex_G_Corder.CreateGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + +} diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java new file mode 100644 index 00000000000..1902d86b53f --- /dev/null +++ b/java/examples/groups/H5Ex_G_Create.java @@ -0,0 +1,94 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create, open, and close a group. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_G_Create { + private static String FILENAME = "H5Ex_G_Create.h5"; + private static String GROUPNAME = "G1"; + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. The handle "group" can no longer be used. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open the group, obtaining a new handle. + try { + if (file_id >= 0) + group_id = H5.H5Gopen(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_G_Create.CreateGroup(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java new file mode 100644 index 00000000000..a3d620bb6fc --- /dev/null +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -0,0 +1,125 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create intermediate groups with + a single call to H5Gcreate. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.structs.H5O_info_t; + +import java.util.ArrayList; + +public class H5Ex_G_Intermediate { + + private static String FILE = "H5Ex_G_Intermediate.h5"; + + private void CreateGroup() throws Exception { + + long file_id = -1; + long group_id = -1; + long gcpl_id = -1; + + try { + // Create a new file_id using the default properties. + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create group_id creation property list and set it to allow creation of intermediate group_ids. + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); + H5.H5Pset_create_intermediate_group(gcpl_id, true); + + /* + * Create the group_id /G1/G2/G3. Note that /G1 and /G1/G2 do not exist yet. This call would cause an error + * if we did not use the previously created property list. + */ + group_id = H5 + .H5Gcreate(file_id, "/G1/G2/G3", gcpl_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Print all the objects in the file_ids to show that intermediate group_ids have been created. + System.out.println("Objects in the file_id:"); + + // H5O_iterate_t iter_data = null; + H5O_iterate_t iter_data = new H5O_iter_data(); + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + if (group_id >= 0) + H5.H5Gclose(group_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + public static void main(String[] args) { + try { + (new H5Ex_G_Intermediate()).CreateGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + private class idata { + public String link_name = null; + public int link_type = -1; + + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + + private class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data) op_data).iterdata.add(id); + + System.out.print("/"); /* Print root group in object path */ + + // Check if the current object is the root group, and if not print the full path name and type. + + if (name.charAt(0) == '.') /* Root group, do not print '.' */ + System.out.println(" (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_GROUP) + System.out.println(name + " (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_DATASET) + System.out.println(name + " (Dataset)"); + else if (info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) + System.out.println(name + " (Datatype)"); + else + System.out.println(name + " (Unknown)"); + + return 0; + } + } + +} diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java new file mode 100644 index 00000000000..d0b4ea4f10b --- /dev/null +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -0,0 +1,119 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to iterate over group members using + H5Gget_obj_info_all. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Iterate { + private static String FILENAME = "groups/h5ex_g_iterate.h5"; + private static String DATASETNAME = "/"; + + enum H5O_type { + H5O_TYPE_UNKNOWN(-1), // Unknown object type + H5O_TYPE_GROUP(0), // Object is a group + H5O_TYPE_DATASET(1), // Object is a dataset + H5O_TYPE_NAMED_DATATYPE(2), // Object is a named data type + H5O_TYPE_NTYPES(3); // Number of different object types + private static final Map lookup = new HashMap(); + + static { + for (H5O_type s : EnumSet.allOf(H5O_type.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5O_type(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5O_type get(int code) { + return lookup.get(code); + } + } + + private static void do_iterate() { + long file_id = -1; + + // Open a file using default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Begin iteration. + System.out.println("Objects in root group:"); + try { + if (file_id >= 0) { + int count = (int) H5.H5Gn_members(file_id, DATASETNAME); + String[] oname = new String[count]; + int[] otype = new int[count]; + int[] ltype = new int[count]; + long[] orefs = new long[count]; + H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, orefs, HDF5Constants.H5_INDEX_NAME); + + // Get type of the object and display its name and type. + for (int indx = 0; indx < otype.length; indx++) { + switch (H5O_type.get(otype[indx])) { + case H5O_TYPE_GROUP: + System.out.println(" Group: " + oname[indx]); + break; + case H5O_TYPE_DATASET: + System.out.println(" Dataset: " + oname[indx]); + break; + case H5O_TYPE_NAMED_DATATYPE: + System.out.println(" Datatype: " + oname[indx]); + break; + default: + System.out.println(" Unknown: " + oname[indx]); + } + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Iterate.do_iterate(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java new file mode 100644 index 00000000000..f23d6f29cd2 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Phase.java @@ -0,0 +1,241 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the conditions for + conversion between compact and dense (indexed) groups. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Phase { + private static String FILE = "H5Ex_G_Phase.h5"; + private static int MAX_GROUPS = 7; + private static int MAX_COMPACT = 5; + private static int MIN_DENSE = 3; + + enum H5G_storage { + H5G_STORAGE_TYPE_UNKNOWN(-1), + H5G_STORAGE_TYPE_SYMBOL_TABLE(0), + H5G_STORAGE_TYPE_COMPACT(1), + H5G_STORAGE_TYPE_DENSE(2); + + private static final Map lookup = new HashMap(); + + static { + for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_storage(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_storage get(int code) { + return lookup.get(code); + } + } + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + long subgroup_id = -1; + long fapl_id = -1; + long gcpl_id = -1; + H5G_info_t ginfo; + String name = "G0"; // Name of subgroup_id + int i; + + // Set file access property list to allow the latest file format.This will allow the library to create new + // format groups. + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + if (fapl_id >= 0) + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group access property list and set the phase change conditions. + try { + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + if (gcpl_id >= 0) + H5.H5Pset_link_phase_change(gcpl_id, MAX_COMPACT, MIN_DENSE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a new file using the default properties. + try { + if (fapl_id >= 0) + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create primary group. + try { + if ((file_id >= 0) && (gcpl_id >= 0)) + group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is created. + for (i = 1; i <= MAX_GROUPS; i++) { + // Define the subgroup name and create the subgroup. + char append = (char) (((char) i) + '0'); + name = name + append; /* G1, G2, G3 etc. */ + try { + if (group_id >= 0) { + subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5.H5Gclose(subgroup_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + System.out.println(); + + // Delete subgroups one at a time, print the storage type for "group" after each subgroup is deleted. + for (i = MAX_GROUPS; i >= 1; i--) { + // Define the subgroup name and delete the subgroup. + try { + H5.H5Ldelete(group_id, name, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + name = name.substring(0, i + 1); + + // Obtain the group info and print the group storage type + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // Close and release resources + try { + if (fapl_id >= 0) + H5.H5Pclose(fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_G_Phase.CreateGroup(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java new file mode 100644 index 00000000000..b00fe97b600 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -0,0 +1,167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ +This example shows a way to recursively traverse the file +using H5Literate. The method shown here guarantees that +the recursion will not enter an infinite loop, but does +not prevent objects from being visited more than once. +The program prints the directory structure of the file +specified in FILE. The default file used by this example +implements the structure described in the User's Guide, +chapter 4, figure 26. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; +import examples.groups.H5Ex_G_Iterate.H5O_type; + +class opdata implements H5L_iterate_t { + int recurs; + opdata prev; + long addr; +} + +public class H5Ex_G_Traverse { + + private static String FILE = "h5ex_g_traverse.h5"; + public static H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + + private static void OpenGroup() { + long file_id = -1; + H5O_info_t infobuf; + opdata od = new opdata(); + + // Open file and initialize the operator data structure. + try { + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + if (file_id >= 0) { + infobuf = H5.H5Oget_info(file_id); + od.recurs = 0; + od.prev = null; + od.addr = infobuf.addr; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the root group and formatting, begin iteration. + try { + System.out.println("/ {"); + // H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, od); + System.out.println("}"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Traverse.OpenGroup(); + } +} + +class H5L_iter_callbackT implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + + H5O_info_t infobuf; + int return_val = 0; + opdata od = (opdata) op_data; // Type conversion + int spaces = 2 * (od.recurs + 1); // Number of white spaces to prepend to output. + + // Get type of the object and display its name and type. + // The name of the object is passed to this function by the Library. + try { + infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); + + for (int i = 0; i < spaces; i++) + System.out.print(" "); // Format output. + switch (H5O_type.get(infobuf.type)) { + case H5O_TYPE_GROUP: + System.out.println("Group: " + name + " { "); + // Check group address against linked list of operator + // data structures. We will always run the check, as the + // reference count cannot be relied upon if there are + // symbolic links, and H5Oget_info_by_name always follows + // symbolic links. Alternatively we could use H5Lget_info + // and never recurse on groups discovered by symbolic + // links, however it could still fail if an object's + // reference count was manually manipulated with + // H5Odecr_refcount. + if (group_check(od, infobuf.addr)) { + for (int i = 0; i < spaces; i++) + System.out.print(" "); + System.out.println(" Warning: Loop detected!"); + } + else { + // Initialize new object of type opdata and begin + // recursive iteration on the discovered + // group. The new opdata is given a pointer to the + // current one. + opdata nextod = new opdata(); + nextod.recurs = od.recurs + 1; + nextod.prev = od; + nextod.addr = infobuf.addr; + H5L_iterate_cb iter_cb2 = new H5L_iter_callbackT(); + return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, HDF5Constants.H5P_DEFAULT); + } + for (int i = 0; i < spaces; i++) + System.out.print(" "); + System.out.println("}"); + break; + case H5O_TYPE_DATASET: + System.out.println("Dataset: " + name); + break; + case H5O_TYPE_NAMED_DATATYPE: + System.out.println("Datatype: " + name); + break; + default: + System.out.println("Unknown: " + name); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + return return_val; + } + + public boolean group_check(opdata od, long target_addr) { + if (od.addr == target_addr) + return true; // Addresses match + else if (od.recurs == 0) + return false; // Root group reached with no matches + else + return group_check(od.prev, target_addr); // Recursively examine the next node + } + +} diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java new file mode 100644 index 00000000000..c2367a6316b --- /dev/null +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -0,0 +1,152 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to recursively traverse a file + using H5Ovisit and H5Lvisit. The program prints all of + the objects in the file specified in FILE, then prints all + of the links in that file. The default file used by this + example implements the structure described in the User's + Guide, chapter 4, figure 26. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; + +import java.util.ArrayList; + +public class H5Ex_G_Visit { + + private static String FILE = "groups/h5ex_g_visit.h5"; + + public static void main(String[] args) { + try { + (new H5Ex_G_Visit()).VisitGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + private void VisitGroup() throws Exception { + + long file_id = -1; + + try { + // Open file + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + + // Begin iteration using H5Ovisit + System.out.println("Objects in the file:"); + H5O_iterate_t iter_data = new H5O_iter_data(); + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + System.out.println(); + // Repeat the same process using H5Lvisit + H5L_iterate_t iter_data2 = new H5L_iter_data(); + H5L_iterate_cb iter_cb2 = new H5L_iter_callback(); + System.out.println("Links in the file:"); + H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2); + + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + /************************************************************ + * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link points + * to, and calls the operator function for H5Ovisit. + ************************************************************/ + + private class idata { + public String link_name = null; + public int link_type = -1; + + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + + private class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + + idata id = new idata(name, info.type); + ((H5L_iter_data) op_data).iterdata.add(id); + + H5O_info_t infobuf; + int ret = 0; + try { + // Get type of the object and display its name and type. The name of the object is passed to this + // function by the Library. + infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); + H5O_iterate_cb iter_cbO = new H5O_iter_callback(); + H5O_iterate_t iter_dataO = new H5O_iter_data(); + ret = iter_cbO.callback(group, name, infobuf, iter_dataO); + } + catch (Exception e) { + e.printStackTrace(); + } + + return ret; + } + } + + private class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data) op_data).iterdata.add(id); + + System.out.print("/"); /* Print root group in object path */ + + // Check if the current object is the root group, and if not print the full path name and type. + + if (name.charAt(0) == '.') /* Root group, do not print '.' */ + System.out.println(" (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_GROUP) + System.out.println(name + " (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_DATASET) + System.out.println(name + " (Dataset)"); + else if (info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) + System.out.println(name + " (Datatype)"); + else + System.out.println(name + " (Unknown)"); + + return 0; + } + } + +} diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am new file mode 100644 index 00000000000..802e2b0ae2e --- /dev/null +++ b/java/examples/groups/Makefile.am @@ -0,0 +1,68 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/groups +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)groups.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_G_Create.java \ + H5Ex_G_Iterate.java \ + H5Ex_G_Compact.java \ + H5Ex_G_Corder.java \ + H5Ex_G_Intermediate.java \ + H5Ex_G_Phase.java \ + H5Ex_G_Visit.java + + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/groups/h5ex_g_iterate.h5 b/java/examples/groups/h5ex_g_iterate.h5 new file mode 100644 index 0000000000000000000000000000000000000000..e4627035fb4a95d6779c38d053eea6eb3c6607be GIT binary patch literal 2928 zcmeHIJ5B>J5PjYa!3siJs1TLQv~YqTd0`6_A~pv|Ny!l+(ZCHTDY*<1CC8woKmyN? z5X3GO5J*N^&&M+!`|XT2-fj;>-lKy8IV&=}D4lQ2>*jK!&Q1+e6(*`z<-v$W zwfD_Wxv`@?kzy@E91A~IyRH9V0sn-LPs>S;%T187tY{e#XsWkIz31=WKMo0?dUz5YzZ!zp<$616 zJ34*q+x=|1(EHEo_~Sl;F7spo?aMCgtV5UkS_WVZo<)~seDqxVzDVcn@F@b14t?R` zX5o$8L*lYr5ViM)H2P$1U_0d}BHP9Duma9l|EWQCH_K*qIZ#s*9zd7{wMc|_M)R8J oJMpFzhWE9=%4x~|8QyolfVcFqd%O4ldOy*xT?C5t{@gZR0g_@_i~s-t literal 0 HcmV?d00001 diff --git a/java/examples/groups/h5ex_g_visit.h5 b/java/examples/groups/h5ex_g_visit.h5 new file mode 100644 index 0000000000000000000000000000000000000000..d8267b14e87b5c41f8808c0f76fe4c479a42803b GIT binary patch literal 6312 zcmeHLy-ve05Wb}RghEk32oO`oj{NRLqNr1;fCpdzQ3QgDABiy|ya6L)AAv{c*vII| z$OiV^ccl%oS}`!-c*xn#olp1WzO$X@+TMPtxK?IKRDlXl)R&+$7TVdaCeGU?)_ zb1*tb^@BZY6G1;lz0&%fwbMG*nGplkYfsDg2@=bBBV4@gtq268c$?0NUd~%@Qf4Sn z7jIp>3TTRX&YOu@Y0@y*axn-)rep#8Ol*if!JZO+1|%64h?<%^Wkg~Z7KG_~zF}Wx zMOm9@5f#MF&volHq9*(MtB2Mxtxq4QPcHw00#RPaTnNeh)y4ItInF!VZ*i~TLrGQ< zmFLAp1nG3>$&1swvwL%$>Noox?3nLYTi^F9&G+p7qxoINg>BUS(_0i*N#A4M@d*Lf zJ;lXKSH3mJ%(vHNK{xRUbzhTw1t)$UZ^N|5?ggwf6?NJWxi!#akDzgtq}Dz;D$5g&gMb5U}UN!E?Eu k3t4XeJRfFPWxas|CXda6S`YL;f7VXN*?R%o@3`&10I0UlaR2}S literal 0 HcmV?d00001 diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in new file mode 100644 index 00000000000..a59a894c6b8 --- /dev/null +++ b/java/examples/groups/runExample.sh.in @@ -0,0 +1,349 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Groups +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDREFDIR="./groups" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/groups" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR +test -d $BLDREFDIR || mkdir -p $BLDREFDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_REF_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.h5 +$HDFTEST_HOME/h5ex_g_visit.h5 +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Corder.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Intermediate.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Phase.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +COPY_REFFILES="$LIST_REF_FILES" + +COPY_REFFILES_TO_BLDREFDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_REFFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDREFDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_REFFILES_AND_BLDREFDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDREFDIR + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR +COPY_REFFILES_TO_BLDREFDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create > H5Ex_G_Create.out) +if diff H5Ex_G_Create.out examples.groups.H5Ex_G_Create.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Create" +else + echo "**FAILED** groups.H5Ex_G_Create" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate > H5Ex_G_Iterate.out) +if diff H5Ex_G_Iterate.out examples.groups.H5Ex_G_Iterate.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Iterate" +else + echo "**FAILED** groups.H5Ex_G_Iterate" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact > H5Ex_G_Compact.out) +if diff H5Ex_G_Compact.out examples.groups.H5Ex_G_Compact.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Compact" +else + echo "**FAILED** groups.H5Ex_G_Compact" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder > H5Ex_G_Corder.out) +if diff H5Ex_G_Corder.out examples.groups.H5Ex_G_Corder.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Corder" +else + echo "**FAILED** groups.H5Ex_G_Corder" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate > H5Ex_G_Intermediate.out) +if diff H5Ex_G_Intermediate.out examples.groups.H5Ex_G_Intermediate.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Intermediate" +else + echo "**FAILED** groups.H5Ex_G_Intermediate" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase > H5Ex_G_Phase.out) +if diff H5Ex_G_Phase.out examples.groups.H5Ex_G_Phase.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Phase" +else + echo "**FAILED** groups.H5Ex_G_Phase" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit > H5Ex_G_Visit.out) +if diff H5Ex_G_Visit.out examples.groups.H5Ex_G_Visit.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Visit" +else + echo "**FAILED** groups.H5Ex_G_Visit" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR +CLEAN_REFFILES_AND_BLDREFDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt new file mode 100644 index 00000000000..ae3f585af76 --- /dev/null +++ b/java/examples/intro/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_INTRO Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5_CreateAttribute + H5_CreateDataset + H5_CreateFile + H5_CreateGroup + H5_CreateGroupAbsoluteRelative + H5_CreateGroupDataset + H5_ReadWrite +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.intro.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.intro.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_OBJECT_EXAMPLES}) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_intro-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.intro.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=intro/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=intro/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_intro-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_intro-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_intro-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_intro-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt + ${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clearall-objects) + set (last_test "JAVA_intro-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) + +endif (BUILD_TESTING) diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java new file mode 100644 index 00000000000..16c53d6e8d3 --- /dev/null +++ b/java/examples/intro/H5_CreateAttribute.java @@ -0,0 +1,145 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating a dataset attribute. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateAttribute { + private static String FILENAME = "H5_CreateAttribute.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static String DATASETATTRIBUTE = "Units"; + + private static void CreateDatasetAttribute() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims1 = { DIM_X, DIM_Y }; + long[] dims = { 2 }; + int[] attr_data = { 100, 200 }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims1, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the attribute. + try { + dataspace_id = H5.H5Screate_simple(1, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a dataset attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, DATASETATTRIBUTE, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the attribute data. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_INT, attr_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the attribute. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the dataspace. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_CreateAttribute.CreateDatasetAttribute(); + } + +} diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java new file mode 100644 index 00000000000..a16cfe6211d --- /dev/null +++ b/java/examples/intro/H5_CreateDataset.java @@ -0,0 +1,97 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a dataset. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateDataset { + private static String FILENAME = "H5_CreateDataset.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateDataset.CreateDataset(); + } + +} diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java new file mode 100644 index 00000000000..eb9f277d78a --- /dev/null +++ b/java/examples/intro/H5_CreateFile.java @@ -0,0 +1,55 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a file. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateFile { + static final String FILENAME = "H5_CreateFile.h5"; + + private static void CreateFile() { + long file_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateFile.CreateFile(); + } + +} diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java new file mode 100644 index 00000000000..36bd49aa223 --- /dev/null +++ b/java/examples/intro/H5_CreateGroup.java @@ -0,0 +1,76 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a group. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroup { + private static String FILENAME = "H5_CreateGroup.h5"; + private static String GROUPNAME = "MyGroup"; + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateGroup.CreateGroup(); + } + +} diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java new file mode 100644 index 00000000000..e0127cca667 --- /dev/null +++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java @@ -0,0 +1,118 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating groups using absolute and relative names. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroupAbsoluteRelative { + private static String FILENAME = "H5_CreateGroupAbsoluteRelative.h5"; + private static String GROUPNAME = "MyGroup"; + private static String GROUPNAME_A = "GroupA"; + private static String GROUPNAME_B = "GroupB"; + + private static void CreateGroupAbsoluteAndRelative() { + long file_id = -1; + long group1_id = -1; + long group2_id = -1; + long group3_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group named "/MyGroup" in the file. + try { + if (file_id >= 0) + group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group "Group_A" in group "MyGroup" using absolute name. + try { + if (file_id >= 0) + group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group "Group_B" in group "MyGroup" using relative name. + try { + if (group1_id >= 0) + group3_id = H5.H5Gcreate(group1_id, GROUPNAME_B, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group3. + try { + if (group3_id >= 0) + H5.H5Gclose(group3_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group2. + try { + if (group2_id >= 0) + H5.H5Gclose(group2_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group1. + try { + if (group1_id >= 0) + H5.H5Gclose(group1_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateGroupAbsoluteRelative.CreateGroupAbsoluteAndRelative(); + } + +} diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java new file mode 100644 index 00000000000..0607bbd95dc --- /dev/null +++ b/java/examples/intro/H5_CreateGroupDataset.java @@ -0,0 +1,207 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Create two datasets within groups. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroupDataset { + private static String FILENAME = "H5_CreateGroupDataset.h5"; + private static String GROUPNAME = "MyGroup"; + private static String GROUPNAME_A = "GroupA"; + private static String DATASETNAME1 = "dset1"; + private static String DATASETNAME2 = "dset2"; + private static final int DIM1_X = 3; + private static final int DIM1_Y = 3; + private static final int DIM2_X = 2; + private static final int DIM2_Y = 10; + + private static void h5_crtgrpd() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long group_id = -1; + long group1_id = -1; + long group2_id = -1; + int[][] dset1_data = new int[DIM1_X][DIM1_Y]; + int[][] dset2_data = new int[DIM2_X][DIM2_Y]; + long[] dims1 = { DIM1_X, DIM1_Y }; + long[] dims2 = { DIM2_X, DIM2_Y }; + + // Initialize the first dataset. + for (int indx = 0; indx < DIM1_X; indx++) + for (int jndx = 0; jndx < DIM1_Y; jndx++) + dset1_data[indx][jndx] = jndx + 1; + + // Initialize the second dataset. + for (int indx = 0; indx < DIM2_X; indx++) + for (int jndx = 0; jndx < DIM2_Y; jndx++) + dset2_data[indx][jndx] = jndx + 1; + + // Create a file. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + // Create a group named "/MyGroup" in the file. + if (file_id >= 0) { + group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Create group "Group_A" in group "MyGroup" using absolute name. + if (group1_id >= 0) { + group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (group2_id >= 0) + H5.H5Gclose(group2_id); + } + if (group1_id >= 0) + H5.H5Gclose(group1_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the first dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims1, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset in group "MyGroup". + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + GROUPNAME + "/" + DATASETNAME1, HDF5Constants.H5T_STD_I32BE, + dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the first dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset1_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the data space for the first dataset. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the first dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing group of the specified file. + try { + if (file_id >= 0) + group_id = H5.H5Gopen(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the second dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims2, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the second dataset in group "Group_A". + try { + if ((group_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(group_id, DATASETNAME2, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the second dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset2_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the data space for the second dataset. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the second dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_CreateGroupDataset.h5_crtgrpd(); + } + +} diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java new file mode 100644 index 00000000000..0d738842e8e --- /dev/null +++ b/java/examples/intro/H5_ReadWrite.java @@ -0,0 +1,112 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Writing and reading an existing dataset. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_ReadWrite { + private static String FILENAME = "H5_ReadWrite.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + + private static void ReadWriteDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * 6 + jndx + 1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_ReadWrite.ReadWriteDataset(); + } + +} diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am new file mode 100644 index 00000000000..fef33d255e0 --- /dev/null +++ b/java/examples/intro/Makefile.am @@ -0,0 +1,67 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/intro +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)intro.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5_CreateAttribute.java \ + H5_CreateDataset.java \ + H5_CreateFile.java \ + H5_CreateGroup.java \ + H5_CreateGroupAbsoluteRelative.java \ + H5_CreateGroupDataset.java \ + H5_ReadWrite.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in new file mode 100644 index 00000000000..ecc51ca52e4 --- /dev/null +++ b/java/examples/intro/runExample.sh.in @@ -0,0 +1,298 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Intro +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/intro" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@intro.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateFile.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroup.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroupDataset.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset > H5_CreateDataset.out) +if diff H5_CreateDataset.out examples.intro.H5_CreateDataset.txt > /dev/null; then + echo " PASSED intro.H5_CreateDataset" +else + echo "**FAILED** intro.H5_CreateDataset" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute > H5_CreateAttribute.out) +if diff H5_CreateAttribute.out examples.intro.H5_CreateAttribute.txt > /dev/null; then + echo " PASSED intro.H5_CreateAttribute" +else + echo "**FAILED** intro.H5_CreateAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile > H5_CreateFile.out) +if diff H5_CreateFile.out examples.intro.H5_CreateFile.txt > /dev/null; then + echo " PASSED intro.H5_CreateFile" +else + echo "**FAILED** intro.H5_CreateFile" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup > H5_CreateGroup.out) +if diff H5_CreateGroup.out examples.intro.H5_CreateGroup.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroup" +else + echo "**FAILED** intro.H5_CreateGroup" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative > H5_CreateGroupAbsoluteRelative.out) +if diff H5_CreateGroupAbsoluteRelative.out examples.intro.H5_CreateGroupAbsoluteRelative.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroupAbsoluteRelative" +else + echo "**FAILED** intro.H5_CreateGroupAbsoluteRelative" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset > H5_CreateGroupDataset.out) +if diff H5_CreateGroupDataset.out examples.intro.H5_CreateGroupDataset.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroupDataset" +else + echo "**FAILED** intro.H5_CreateGroupDataset" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite > H5_ReadWrite.out) +if diff H5_ReadWrite.out examples.intro.H5_ReadWrite.txt > /dev/null; then + echo " PASSED intro.H5_ReadWrite" +else + echo "**FAILED** intro.H5_ReadWrite" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt new file mode 100644 index 00000000000..6fd810be378 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt @@ -0,0 +1,16 @@ +Creating datasets... +DS1 has allocation time H5D_ALLOC_TIME_LATE +DS2 has allocation time H5D_ALLOC_TIME_EARLY + +Space for DS1 has not been allocated. +Storage size for DS1 is: 0 bytes. +Space for DS2 has been allocated. +Storage size for DS2 is: 112 bytes. + +Writing data... + +Space for DS1 has been allocated. +Storage size for DS1 is: 112 bytes. +Space for DS2 has been allocated. +Storage size for DS2 is: 112 bytes. + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt new file mode 100644 index 00000000000..676aebbe7d0 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_FLETCHER32 + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt new file mode 100644 index 00000000000..5f4c2deb7be --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt @@ -0,0 +1,26 @@ +Original Data: + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + +Storage layout for DS1 is: H5D_CHUNKED + +Data as written to disk by hyberslabs: + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + +Data as read from disk by hyberslab: + [ 0 1 0 0 0 0 0 1 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt new file mode 100644 index 00000000000..e34f3c17fee --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt @@ -0,0 +1,8 @@ +Storage layout for DS1 is: H5D_COMPACT + +Data for DS1 is: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt new file mode 100644 index 00000000000..5878149ef40 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt @@ -0,0 +1,7 @@ +DS1 is stored in file: H5Ex_D_External.data +DS1: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt new file mode 100644 index 00000000000..68d826bb3f7 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt @@ -0,0 +1,20 @@ +Dataset before being written to: + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + +Dataset after being written to: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 99 99 99 ] + [ 0 0 0 0 0 0 0 99 99 99 ] + [ 0 1 2 3 4 5 6 99 99 99 ] + [ 0 2 4 6 8 10 12 99 99 99 ] + [ 99 99 99 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 99 99 99 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt new file mode 100644 index 00000000000..255a5615db8 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_DEFLATE + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt new file mode 100644 index 00000000000..823dfcc5a8d --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt @@ -0,0 +1,24 @@ +Original Data: + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + +Data as written to disk by hyberslabs: + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + +Data as read from disk by hyberslab: + [ 0 1 0 0 0 0 0 1 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt new file mode 100644 index 00000000000..a768ba07860 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_NBIT + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt new file mode 100644 index 00000000000..e021029e981 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt @@ -0,0 +1,6 @@ +DS1: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt new file mode 100644 index 00000000000..ea95f110191 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt @@ -0,0 +1,5 @@ +Filter 0: Type is: H5Z_FILTER_SHUFFLE + +Filter 1: Type is: H5Z_FILTER_DEFLATE + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt new file mode 100644 index 00000000000..4d4b5d60111 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt @@ -0,0 +1,6 @@ +Maximum value in write buffer is: 106.66666666666667 +Minimum value in write buffer is: 1.7692307692307692 +Filter type is: H5Z_FILTER_SCALEOFFSET + +Maximum value in DS1 is: 106.66169811320755 +Minimum value in DS1 is: 1.7692307692307692 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt new file mode 100644 index 00000000000..48d0d8c52c9 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_SCALEOFFSET + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt new file mode 100644 index 00000000000..a1c0d19cc24 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_SZIP + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt new file mode 100644 index 00000000000..05257bc902a --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt @@ -0,0 +1,15 @@ +Original Data: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] +Data as written with transform 'x+1' + [ 1 0 -1 -2 -3 -4 -5 ] + [ 1 1 1 1 1 1 1 ] + [ 1 2 3 4 5 6 7 ] + [ 1 3 5 7 9 11 13 ] +Data as written with transform 'x+1' and read with transform 'x-1' + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt new file mode 100644 index 00000000000..d3a7281f005 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt @@ -0,0 +1,14 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 7 8 9 ] + [ 0 0 0 0 0 0 0 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 2 4 6 8 10 12 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt new file mode 100644 index 00000000000..9e362813d97 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt @@ -0,0 +1,16 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Filter type is: H5Z_FILTER_DEFLATE + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 7 8 9 ] + [ 0 0 0 0 0 0 0 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 2 4 6 8 10 12 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt new file mode 100644 index 00000000000..15eee16d7da --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt @@ -0,0 +1,14 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt new file mode 100644 index 00000000000..7bcd8fa8fce --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt @@ -0,0 +1,21 @@ +DS1 [0]: + [0 0 0 0 0 ] + [0 -1 -2 -3 -4 ] + [0 -2 -4 -6 -8 ] + +DS1 [1]: + [0 1 2 3 4 ] + [1 1 1 1 1 ] + [2 1 0 -1 -2 ] + +DS1 [2]: + [0 2 4 6 8 ] + [2 3 4 5 6 ] + [4 4 4 4 4 ] + +DS1 [3]: + [0 3 6 9 12 ] + [3 5 7 9 11 ] + [6 7 8 9 10 ] + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt new file mode 100644 index 00000000000..7d27c0bbf3a --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt @@ -0,0 +1,21 @@ +A1 [0]: + [0 0 0 0 0 ] + [0 -1 -2 -3 -4 ] + [0 -2 -4 -6 -8 ] + +A1 [1]: + [0 1 2 3 4 ] + [1 1 1 1 1 ] + [2 1 0 -1 -2 ] + +A1 [2]: + [0 2 4 6 8 ] + [2 3 4 5 6 ] + [4 4 4 4 4 ] + +A1 [3]: + [0 3 6 9 12 ] + [3 5 7 9 11 ] + [6 7 8 9 10 ] + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt new file mode 100644 index 00000000000..57769b21c49 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt @@ -0,0 +1,6 @@ +DS1: + [{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}{1, 0, 3, 3}{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt new file mode 100644 index 00000000000..683bc7f8c36 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt @@ -0,0 +1,6 @@ +A1: + [{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}{1, 0, 3, 3}{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt new file mode 100644 index 00000000000..e6d0befe4b0 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt @@ -0,0 +1,6 @@ +Named datatype: Sensor_Type: + Class: H5T_COMPOUND + Serial number + Location + Temperature (F) + Pressure (inHg) diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt new file mode 100644 index 00000000000..0505c7840cb --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt @@ -0,0 +1,25 @@ +DS1 [0]: +Serial number : 1153 +Location : Exterior (static) +Temperature (F) : 53.23 +Pressure (inHg) : 24.57 + +DS1 [1]: +Serial number : 1184 +Location : Intake +Temperature (F) : 55.12 +Pressure (inHg) : 22.95 + +DS1 [2]: +Serial number : 1027 +Location : Intake manifold +Temperature (F) : 103.55 +Pressure (inHg) : 31.23 + +DS1 [3]: +Serial number : 1313 +Location : Exhaust manifold +Temperature (F) : 1252.89 +Pressure (inHg) : 84.11 + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt new file mode 100644 index 00000000000..dd77f8dc93d --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt @@ -0,0 +1,25 @@ +A1 [0]: +Serial number : 1153 +Location : Exterior (static) +Temperature (F) : 53.23 +Pressure (inHg) : 24.57 + +A1 [1]: +Serial number : 1184 +Location : Intake +Temperature (F) : 55.12 +Pressure (inHg) : 22.95 + +A1 [2]: +Serial number : 1027 +Location : Intake manifold +Temperature (F) : 103.55 +Pressure (inHg) : 31.23 + +A1 [3]: +Serial number : 1313 +Location : Exhaust manifold +Temperature (F) : 1252.89 +Pressure (inHg) : 84.11 + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt new file mode 100644 index 00000000000..85d8ced3760 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt @@ -0,0 +1,6 @@ +DS1: + [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000] + [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538] + [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077] + [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt new file mode 100644 index 00000000000..cfa1f9261cb --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt @@ -0,0 +1,6 @@ +A1: + [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000] + [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538] + [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077] + [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt new file mode 100644 index 00000000000..f686bd1e121 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt @@ -0,0 +1,6 @@ +DS1: + [ 0 -1 -2 -3 -4 -5 -6] + [ 0 0 0 0 0 0 0] + [ 0 1 2 3 4 5 6] + [ 0 2 4 6 8 10 12] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt new file mode 100644 index 00000000000..dccd4a6c58e --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt @@ -0,0 +1,6 @@ +A1: + [ 0 -1 -2 -3 -4 -5 -6] + [ 0 0 0 0 0 0 0] + [ 0 1 2 3 4 5 6] + [ 0 2 4 6 8 10 12] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt new file mode 100644 index 00000000000..827c0425c6a --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt @@ -0,0 +1,4 @@ +DS1[0]: + ->H5G_GROUP: +DS1[1]: + ->H5G_DATASET: diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt new file mode 100644 index 00000000000..fe3cdc07ceb --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt @@ -0,0 +1,4 @@ +A1[0]: + ->H5G_GROUP: +A1[1]: + ->H5G_DATASET: diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt new file mode 100644 index 00000000000..fb742367e45 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt @@ -0,0 +1,6 @@ +Datatype tag for DS1 is: "Character array" +DS1[0]: OPAQUE0 +DS1[1]: OPAQUE1 +DS1[2]: OPAQUE2 +DS1[3]: OPAQUE3 + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt new file mode 100644 index 00000000000..bc9a73050ae --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt @@ -0,0 +1,6 @@ +Datatype tag for A1 is: "Character array" +A1[0]: OPAQUE0 +A1[1]: OPAQUE1 +A1[2]: OPAQUE2 +A1[3]: OPAQUE3 + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt new file mode 100644 index 00000000000..4df6a41d6ba --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt @@ -0,0 +1,5 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt new file mode 100644 index 00000000000..4df6a41d6ba --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt @@ -0,0 +1,5 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt new file mode 100644 index 00000000000..0322953e602 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt @@ -0,0 +1,4 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt new file mode 100644 index 00000000000..0a88d3fdce1 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt @@ -0,0 +1,5 @@ +Group storage type for H5Ex_G_Compact1.h5 is: H5G_STORAGE_TYPE_SYMBOL_TABLE +File size for H5Ex_G_Compact1.h5 is: 1832 bytes + +Group storage type for H5Ex_G_Compact2.h5 is: H5G_STORAGE_TYPE_COMPACT +File size for H5Ex_G_Compact2.h5 is: 342 bytes diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt new file mode 100644 index 00000000000..2d959fc4bc6 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt @@ -0,0 +1,10 @@ +Traversing group using alphabetical indices: +Index 0: 5 +Index 1: D +Index 2: F +Index 3: H +Traversing group using creation order indices: +Index 0: H +Index 1: D +Index 2: F +Index 3: 5 diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Create.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Create.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt new file mode 100644 index 00000000000..65a0fc2051a --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt @@ -0,0 +1,5 @@ +Objects in the file_id: +/ (Group) +/G1 (Group) +/G1/G2 (Group) +/G1/G2/G3 (Group) diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt new file mode 100644 index 00000000000..66a4ae927ff --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt @@ -0,0 +1,5 @@ +Objects in root group: + Dataset: DS1 + Datatype: DT1 + Group: G1 + Dataset: L1 diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt new file mode 100644 index 00000000000..9e666d4cfea --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt @@ -0,0 +1,15 @@ +1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT +2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +3 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +4 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +5 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +7 Groups: Storage type is H5G_STORAGE_TYPE_DENSE + +6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +5 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +4 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +3 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT +0 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt new file mode 100644 index 00000000000..126a5888404 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt @@ -0,0 +1,19 @@ +Objects in the file: +/ (Group) +/group1 (Group) +/group1/dset1 (Dataset) +/group1/group3 (Group) +/group1/group3/group4 (Group) +/group1/group3/group4/group1 (Group) +/group1/group3/group4/group2 (Group) + +Links in the file: +/group1 (Group) +/group1/dset1 (Dataset) +/group1/group3 (Group) +/group1/group3/dset2 (Dataset) +/group1/group3/group4 (Group) +/group1/group3/group4/group1 (Group) +/group1/group3/group4/group1/group5 (Group) +/group1/group3/group4/group2 (Group) +/group2 (Group) diff --git a/java/examples/testfiles/examples.intro.H5_CreateAttribute.txt b/java/examples/testfiles/examples.intro.H5_CreateAttribute.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_CreateDataset.txt b/java/examples/testfiles/examples.intro.H5_CreateDataset.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_CreateFile.txt b/java/examples/testfiles/examples.intro.H5_CreateFile.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroup.txt b/java/examples/testfiles/examples.intro.H5_CreateGroup.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt b/java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt b/java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/examples/testfiles/examples.intro.H5_ReadWrite.txt b/java/examples/testfiles/examples.intro.H5_ReadWrite.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/java/lib/ext/slf4j-nop-1.7.5.jar b/java/lib/ext/slf4j-nop-1.7.5.jar new file mode 100644 index 0000000000000000000000000000000000000000..e55bdd8260e5bddee49cd1397a2d7380cf87cfbc GIT binary patch literal 4091 zcma)92{@En7#@s_JsL5gY#}jOZ{3hAW1F$dP7Nc*%-9pzqL3wp8o3x{yOpdVTQyN8 zjD3qiwn7qxNXnh5M5&&8=9&MWd7kfm&-uUe{qOf4V>knl1wb1f1pyjgetf$yQ||^a zb9EU#L+t~`-@-rucWRi){bhGaIsib29smGu4l__U)YFEUnL`b zSk67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?d00001 diff --git a/java/lib/ext/slf4j-simple-1.7.5.jar b/java/lib/ext/slf4j-simple-1.7.5.jar new file mode 100644 index 0000000000000000000000000000000000000000..9dece319e93c39234a4a0c7f9486dba861841829 GIT binary patch literal 10680 zcmb7q19V;6_jQaWjcwa#(Ac(Z+h${1jqS#4Y&2?;#>R~sHvXrtzxVoHAIA6XJFdoE zbMAf4nRo4d_L_2%pkS|nzBk({cY)tN{O<+&iJw+nMucAOe_>ESHZNi94hIl) zz(7DYAV5GUe-4x8mk}2cR#c*s773EmmhE9c@wT0Qp2XKf=lg6l06Ce9B;NyDU1XJF zUwCM;M7y;ni5Xdw`pxb1ws~(kO|BWj@D{1QTk5vr^ojx#U=~Qaf8jxwO9lHDIFZW& z0nLDC_0}pe!VJ`kOhPU(5+?EbLyTU;70!iuyYp_7&Z(u{aWYkMS9X^WmZN7gVuy6F zBAP+Eq#m^rV_AWIBgm>dTVgw>%BzuAYu_E|EgW8;u z#3NUQJrq1~ona2J==uB8c&^WR&?XXT){FUGx0}4D5sr@99|{e8mDghouN20qSQRl* z6v(jdZTsAnGs0|rt0klvca+JL>DG_|W3M}BjQ8pETZXrIyTw8(P8$I!trsZMTJMS^ zGA&X{Qm4^?4obl``tRo#2#DsF%K-Lrer+90|F{BwkNAH1zDGD(nXp*=M;!cL;>@k> zto{gw`q6C)D=ps3B~1eb0wVrQyLIV!ynO)gqRV0*+G-4Bt-!8}8^nclwVz0p#@2juvgFnk>q&-`o6Rhh zOg#vzqTR^e`<@=@sddfT!5M|cP~cSuY~VL`xt{kSIfY9^#z29du_RivTLjV^gxDQQ zaVZ0**)CjD$Nf6JYA2%wX==G!LxE)v{t%JmfgdS z5eofjLS=!P*o?8el>dzYITYv|4c6&xXcw$Msn&zJB0?%dr~lg=&bt+C)xbh&SnFscT6ev@_1v zIiHdslGiHL8%C*7=BvGu!>7}SIW6cx{G#< zoB1=i`02G%)EVzC_9gFwOOIvs@R@I57qlRJ25Hn?5&Sq%^xilkO7?EMqFC>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r2duhN@CT{>%q7 zV?aZj2_5Wo}QxUvqg_57Z0j7X)HgmEz#hu|JZC!0F`v56zJAgLP zc+L3n2+W>R#2cNbgEv^z*qPh}S?G(qwIvKRWCuX24j{g*C`|-k#DVs^ zI*Q9ikhZqkYku7cN(g{)E80djhvP@X%~{f~9i@rDQ3JearFuhUdQm%Pmqp@ZjAh`v zc@P+`Hu$COsAe9D!w2qhkPtoUnl|aM-8efI=N} zFk7p~r;iWaCdYmPgQeg#(a5vO7LDLTl+3;q`L9!g9>f>UNmwu zR3iyXo$x}2Yn#28kfEgIB7F`NEf0CIK9SCRps^vx736RMUUZ#;sCX${!ecc=(soZS zuSf)0+-!8QsQ@?XNf(m29t^EUuT zHqoPt-xU?h0RK}L#OF?$qboO#1HA1b_!U+E0*}Y1kf@f9i~>9|OO57U2~Lz+WP=Mu zGsit1$8x5tJ+dAQ5lLUr@cs|~1%A(BdqgZI&e`|H6mXxii2Eyb{{kuUceA z{g0k;Q>x57_&Nu|-HNpf`&S2ep=DFT4W2SC^%U0S6J^4S_VZ6WmIBvt!8$s^9IU4v zoQXof&m+Fg=$3^UZr>);wG*UC@`C)5b_5spEYpjz5OCUS6vBM;q`} z1#}Cg??+6$$cw-UU$8CO9)qlzh4s>l1%xQ{=ux&yh*_tAS#L)*VK)sPNZ0}cAs@yK z_yTh5ngjJP^G{T<2vc#*l9+g+Fz*}QfKPzQ4elDvry&$e7CO+GrvK#=Pw0I=eEuwy zFNww$VFs*U5))6n)e1OguMQpA5YjUalsvc4FNKL)LnUxwsw}h|sWYKR9+}&5AS*ZBAVC8wwFf=lN2yqM-LSRVT=4?iOwM6X3=9rA=(U-{U4;I=rlc)4;R$z zlwvEdwEb%97lv{}KPpfb(!mc+U`7k!cj3J{e?b}b@Pp0;sl~>KSj)mwwf}-To8SV) Zm9-%!eZV646_hI`4?(783XX*6{{TREv-ki2 literal 0 HcmV?d00001 diff --git a/java/lib/simplelogger.properties b/java/lib/simplelogger.properties new file mode 100644 index 00000000000..119ee92a17e --- /dev/null +++ b/java/lib/simplelogger.properties @@ -0,0 +1,36 @@ +# SLF4J's SimpleLogger configuration file +# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. + +org.slf4j.simpleLogger.logFile=slf4j.simpleLogger.log + +# Default logging detail level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, defaults to "info". +org.slf4j.simpleLogger.defaultLog=trace + +# Logging detail level for a SimpleLogger instance named "xxxxx". +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, the default logging detail level is used. +#org.slf4j.simpleLogger.log.xxxxx= + +# Set to true if you want the current date and time to be included in output messages. +# Default is false, and will output the number of milliseconds elapsed since startup. +#org.slf4j.simpleLogger.showDateTime=false + +# The date and time format to be used in the output messages. +# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. +# If the format is not specified or is invalid, the default format is used. +# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z + +# Set to true if you want to output the current thread name. +# Defaults to true. +org.slf4j.simpleLogger.showThreadName=true + +# Set to true if you want the Logger instance name to be included in output messages. +# Defaults to true. +org.slf4j.simpleLogger.showLogName=true + +# Set to true if you want the last component of the name to be included in output messages. +# Defaults to false. +org.slf4j.simpleLogger.showShortLogName=false diff --git a/java/lib/slf4j-api-1.7.5.jar b/java/lib/slf4j-api-1.7.5.jar new file mode 100644 index 0000000000000000000000000000000000000000..8766455d8756ebdac09d36eea2c08db90c18b124 GIT binary patch literal 26084 zcmag_19W8F+BS@)W81dvbZpzUZ9Azr>DWfcR>!t&+eSwx``hpPo&VWmpa0Ytb+1{o zuCZ#ZId5L;E(K{2P-vikz3i(!h5pare+1O`QC3t%kWNxgj6valV30s|-!SqyrUCpP zKtNQ$KtQPfPnfKroTQkjvI@PdSg4Y&d@v)bFU2nZ1H_71KNm_gg3N4mIQ@FPy7KsD ztCAF5sLhw2K`fK;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1-9OE)R`34D4k^p)Vq);G*)Lk&zc!4hGJT;}{r7g!up{gh^tXET&o-~t zuZCO1|6}pOb}LLf;y0zkSL6Z?)^6ZC|Z-{nI+jivqSh z23O$z+4gVh*YM6VkIJ83bH|T%9IAD7s{FudspY`{Ki*$ZIuJ+6H;-}a3^PT&<@rB<7 zHwLKxW(<31{Og7NH|D|*gJVSgg!$Dg`w7HAy2>y6iOlly`rm;6cxk^L_^algaPGe5 hAI1ys=mi%(6IGD82K#{yBqZR)A8evnq;>J%{{dcPj^6+P literal 0 HcmV?d00001 diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt new file mode 100644 index 00000000000..ae782013edf --- /dev/null +++ b/java/src/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.0) +PROJECT ( HDF5_JAVA_SRC C Java ) + +#----------------------------------------------------------------------------- +# Traverse source subdirectory +#----------------------------------------------------------------------------- +add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/jni ${HDF5_JAVA_SRC_BINARY_DIR}/jni) +add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/hdf ${HDF5_JAVA_SRC_BINARY_DIR}/hdf) diff --git a/java/src/Makefile.am b/java/src/Makefile.am new file mode 100644 index 00000000000..76159733e58 --- /dev/null +++ b/java/src/Makefile.am @@ -0,0 +1,137 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +SUBDIRS=jni + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +hdf5_javadir = $(libdir) + +pkgpath = hdf/hdf5lib +CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +hdf5_java_JAVA = \ + ${pkgpath}/callbacks/Callbacks.java \ + ${pkgpath}/callbacks/H5A_iterate_cb.java \ + ${pkgpath}/callbacks/H5A_iterate_t.java \ + ${pkgpath}/callbacks/H5D_iterate_cb.java \ + ${pkgpath}/callbacks/H5D_iterate_t.java \ + ${pkgpath}/callbacks/H5E_walk_cb.java \ + ${pkgpath}/callbacks/H5E_walk_t.java \ + ${pkgpath}/callbacks/H5L_iterate_cb.java \ + ${pkgpath}/callbacks/H5L_iterate_t.java \ + ${pkgpath}/callbacks/H5O_iterate_cb.java \ + ${pkgpath}/callbacks/H5O_iterate_t.java \ + ${pkgpath}/callbacks/H5P_cls_close_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_close_func_t.java \ + ${pkgpath}/callbacks/H5P_cls_copy_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_copy_func_t.java \ + ${pkgpath}/callbacks/H5P_cls_create_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_create_func_t.java \ + ${pkgpath}/callbacks/H5P_prp_close_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_compare_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_copy_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_create_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_delete_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_get_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_set_func_cb.java \ + ${pkgpath}/callbacks/H5P_iterate_cb.java \ + ${pkgpath}/callbacks/H5P_iterate_t.java \ + ${pkgpath}/exceptions/HDF5AtomException.java \ + ${pkgpath}/exceptions/HDF5AttributeException.java \ + ${pkgpath}/exceptions/HDF5BtreeException.java \ + ${pkgpath}/exceptions/HDF5DataFiltersException.java \ + ${pkgpath}/exceptions/HDF5DataStorageException.java \ + ${pkgpath}/exceptions/HDF5DatasetInterfaceException.java \ + ${pkgpath}/exceptions/HDF5DataspaceInterfaceException.java \ + ${pkgpath}/exceptions/HDF5DatatypeInterfaceException.java \ + ${pkgpath}/exceptions/HDF5Exception.java \ + ${pkgpath}/exceptions/HDF5ExternalFileListException.java \ + ${pkgpath}/exceptions/HDF5FileInterfaceException.java \ + ${pkgpath}/exceptions/HDF5FunctionArgumentException.java \ + ${pkgpath}/exceptions/HDF5FunctionEntryExitException.java \ + ${pkgpath}/exceptions/HDF5HeapException.java \ + ${pkgpath}/exceptions/HDF5InternalErrorException.java \ + ${pkgpath}/exceptions/HDF5JavaException.java \ + ${pkgpath}/exceptions/HDF5LibraryException.java \ + ${pkgpath}/exceptions/HDF5LowLevelIOException.java \ + ${pkgpath}/exceptions/HDF5MetaDataCacheException.java \ + ${pkgpath}/exceptions/HDF5ObjectHeaderException.java \ + ${pkgpath}/exceptions/HDF5PropertyListInterfaceException.java \ + ${pkgpath}/exceptions/HDF5ReferenceException.java \ + ${pkgpath}/exceptions/HDF5ResourceUnavailableException.java \ + ${pkgpath}/exceptions/HDF5SymbolTableException.java \ + ${pkgpath}/structs/H5_ih_info_t.java \ + ${pkgpath}/structs/H5A_info_t.java \ + ${pkgpath}/structs/H5E_error2_t.java \ + ${pkgpath}/structs/H5F_info2_t.java \ + ${pkgpath}/structs/H5G_info_t.java \ + ${pkgpath}/structs/H5L_info_t.java \ + ${pkgpath}/structs/H5O_info_t.java \ + ${pkgpath}/structs/H5O_hdr_info_t.java \ + ${pkgpath}/structs/H5AC_cache_config_t.java \ + ${pkgpath}/H5.java \ + ${pkgpath}/HDF5Constants.java \ + ${pkgpath}/HDF5GroupInfo.java \ + ${pkgpath}/HDFArray.java \ + ${pkgpath}/HDFNativeData.java + +$(jarfile): classhdf5_java.stamp classes docs + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +hdf5_java_DATA = $(jarfile) + +.PHONY: docs classes + +WINDOWTITLE = 'HDF5 Java' +DOCTITLE = '

HDF5 Java Wrapper

' +SRCDIR = '$(pkgpath)' + +docs: + $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -classpath $(CLASSPATH_ENV) hdf.hdf5lib + +CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classhdf5_java.stamp + + +# Clean examples when check-clean is invoked +check-clean :: ; + +#include $(top_srcdir)/config/conclude.am diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt new file mode 100644 index 00000000000..f465da93971 --- /dev/null +++ b/java/src/hdf/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_HDF) + +add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib) diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt new file mode 100644 index 00000000000..56c1e59c1f7 --- /dev/null +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -0,0 +1,124 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_HDF_HDF5 Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_HDF_HDF5_SOURCE_DIR} + ${HDF5_JAVA_HDF_HDF5_BINARY_DIR} + ${HDF5_JAVA_LIB_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${HDF5_JAVA_HDF5_LIB_CORENAME}.dir/hdf/hdf5lib +) + +SET_GLOBAL_VARIABLE (HDF5_JAVA_SOURCE_PACKAGES + "${HDFJAVA_SOURCE_PACKAGES};hdf.hdf5lib.callbacks;hdf.hdf5lib.exceptions;hdf.hdf5lib.structs;hdf.hdf5lib" +) + +set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS + callbacks/H5A_iterate_cb.java + callbacks/H5A_iterate_t.java + callbacks/H5D_iterate_cb.java + callbacks/H5D_iterate_t.java + callbacks/H5E_walk_cb.java + callbacks/H5E_walk_t.java + callbacks/H5L_iterate_cb.java + callbacks/H5L_iterate_t.java + callbacks/H5O_iterate_cb.java + callbacks/H5O_iterate_t.java + callbacks/H5P_cls_close_func_cb.java + callbacks/H5P_cls_close_func_t.java + callbacks/H5P_cls_copy_func_cb.java + callbacks/H5P_cls_copy_func_t.java + callbacks/H5P_cls_create_func_cb.java + callbacks/H5P_cls_create_func_t.java + callbacks/H5P_prp_close_func_cb.java + callbacks/H5P_prp_compare_func_cb.java + callbacks/H5P_prp_copy_func_cb.java + callbacks/H5P_prp_create_func_cb.java + callbacks/H5P_prp_delete_func_cb.java + callbacks/H5P_prp_get_func_cb.java + callbacks/H5P_prp_set_func_cb.java + callbacks/H5P_iterate_cb.java + callbacks/H5P_iterate_t.java + callbacks/Callbacks.java +) + +set (HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS + exceptions/HDF5Exception.java + exceptions/HDF5AtomException.java + exceptions/HDF5AttributeException.java + exceptions/HDF5BtreeException.java + exceptions/HDF5DataFiltersException.java + exceptions/HDF5DatasetInterfaceException.java + exceptions/HDF5DataspaceInterfaceException.java + exceptions/HDF5DataStorageException.java + exceptions/HDF5DatatypeInterfaceException.java + exceptions/HDF5ExternalFileListException.java + exceptions/HDF5FileInterfaceException.java + exceptions/HDF5FunctionArgumentException.java + exceptions/HDF5FunctionEntryExitException.java + exceptions/HDF5HeapException.java + exceptions/HDF5InternalErrorException.java + exceptions/HDF5JavaException.java + exceptions/HDF5LibraryException.java + exceptions/HDF5LowLevelIOException.java + exceptions/HDF5MetaDataCacheException.java + exceptions/HDF5ObjectHeaderException.java + exceptions/HDF5PropertyListInterfaceException.java + exceptions/HDF5ReferenceException.java + exceptions/HDF5ResourceUnavailableException.java + exceptions/HDF5SymbolTableException.java +) + +set (HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS + structs/H5_ih_info_t.java + structs/H5A_info_t.java + structs/H5AC_cache_config_t.java + structs/H5E_error2_t.java + structs/H5F_info2_t.java + structs/H5G_info_t.java + structs/H5L_info_t.java + structs/H5O_hdr_info_t.java + structs/H5O_info_t.java +) + +set (HDF5_JAVA_HDF_HDF5_SRCS + HDFArray.java + HDF5Constants.java + HDF5GroupInfo.java + HDFNativeData.java + H5.java +) + +set (CMAKE_JNI_TARGET TRUE) + +file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt +" +" +) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LOGGING_JAR}") + +add_jar (${HDF5_JAVA_HDF5_LIB_TARGET} OUTPUT_NAME "${HDF5_JAVA_HDF5_LIB_TARGET}-${HDF5_PACKAGE_VERSION}" OUTPUT_DIR ${CMAKE_JAVA_TARGET_OUTPUT_DIR} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS} ${HDF5_JAVA_HDF_HDF5_SRCS}) +install_jar (${HDF5_JAVA_HDF5_LIB_TARGET} LIBRARY DESTINATION ${HDF5_INSTALL_JAR_DIR} COMPONENT libraries) +#if (NOT WIN32) +# install_jni_symlink (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_INSTALL_JAR_DIR} libraries) +#endif (NOT WIN32) + +get_target_property (${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_HDF5_LIB_TARGET} JAR_FILE) +SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS_TO_EXPORT "${HDF5_JAVA_JARS_TO_EXPORT};${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}") +SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS ${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}) + +add_dependencies (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_HDF5_LIB_TARGET} PROPERTIES FOLDER libraries/java) + +create_javadoc(hdf5_java_doc + FILES ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS} ${HDF5_JAVA_HDF_HDF5_SRCS} + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "HDF5 Java" + DOCTITLE "

HDF5 Java Wrapper

" + INSTALLPATH ${HDF5_INSTALL_DATA_DIR} + AUTHOR TRUE + USE TRUE + VERSION TRUE +) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java new file mode 100644 index 00000000000..fbfc40a729b --- /dev/null +++ b/java/src/hdf/hdf5lib/H5.java @@ -0,0 +1,9185 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +import java.io.File; +import java.nio.ByteBuffer; +import java.util.Collection; +import java.util.LinkedHashSet; +import hdf.hdf5lib.callbacks.H5A_iterate_cb; +import hdf.hdf5lib.callbacks.H5A_iterate_t; +import hdf.hdf5lib.callbacks.H5D_iterate_cb; +import hdf.hdf5lib.callbacks.H5D_iterate_t; +import hdf.hdf5lib.callbacks.H5E_walk_cb; +import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_t; +import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; +import hdf.hdf5lib.structs.H5A_info_t; +import hdf.hdf5lib.structs.H5E_error2_t; +import hdf.hdf5lib.structs.H5F_info2_t; +import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; + +/** + * This class is the Java interface for the HDF5 library. + *

+ * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps a single + * HDF5 entry point, generally with the arguments and return codes analogous to the C interface. + *

+ * For details of the HDF5 library, see the HDF5 Documentation at: http://hdfgroup.org/HDF5/ + *


+ *

+ * Mapping of arguments for Java + * + *

+ * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF + * Reference Manual. + * + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
HDF-5 C types to Java types
HDF-5Java
H5T_NATIVE_INTint, Integer
H5T_NATIVE_SHORTshort, Short
H5T_NATIVE_FLOATfloat, Float
H5T_NATIVE_DOUBLEdouble, Double
H5T_NATIVE_CHARbyte, Byte
H5T_C_S1java.lang.String
void *
+ * (i.e., pointer to `Any')
Special -- see HDFArray
+ *
+ *
General Rules for Passing Arguments and Results
+ *

+ * In general, arguments passed IN to Java are the analogous basic types, as above. The exception is for arrays, + * which are discussed below. + *

+ * The return value of Java methods is also the analogous type, as above. A major exception to that rule is that + * all HDF functions that return SUCCEED/FAIL are declared boolean in the Java version, rather than int as + * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. However, in most + * cases the Java method will raise an exception instead of returning an error code. See Errors and + * Exceptions below. + *

+ * Java does not support pass by reference of arguments, so arguments that are returned through OUT parameters + * must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in arrays. + *

+ * For instance, a function that returns two integers is declared: + * + *

+ *       h_err_t HDF5dummy( int *a1, int *a2)
+ * 
+ * + * For the Java interface, this would be declared: + * + *
+ * public synchronized static native int HDF5dummy(int args[]);
+ * 
+ * + * where a1 is args[0] and a2 is args[1], and would be invoked: + * + *
+ * H5.HDF5dummy(a);
+ * 
+ * + *

+ * All the routines where this convention is used will have specific documentation of the details, given below. + *

+ * Arrays + *

+ * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the + * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, + * + *

+ *      herr_t H5Dread(int fid, int filetype, int memtype, int memspace,
+ *      void * data);
+ * 
+ * + *

+ * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that is the + * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the array on + * disk (source) and in memory (destination). + *

+ * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional + * arrays are definitely not layed out contiguously in memory. It would be infeasible to declare a separate + * routine for every combination of number type and dimensionality. For that reason, the HDFArray class is used to discover the type, shape, and size of the + * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order. + *

+ * The upshot is that any Java array of numbers (either primitive or sub-classes of type Number) can be passed as + * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by the C + * library. So the function above would be declared: + * + *

+ * public synchronized static native int H5Dread(int fid, int filetype, int memtype, int memspace, Object data);
+ * 
+ * OPEN_IDS.addElement(id); + + * and the parameter data can be any multi-dimensional array of numbers, such as float[][], or int[][][], or + * Double[][]. + *

+ * HDF-5 Constants + *

+ * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs + * via the class HDF5Constants. For example, the parameters for + * the h5open() call include two numeric values, HDFConstants.H5F_ACC_RDWR and + * HDF5Constants.H5P_DEFAULT. As would be expected, these numbers correspond to the C constants + * H5F_ACC_RDWR and H5P_DEFAULT. + *

+ * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and "hsize_t". + * These values are determined at run time by the HDF-5 C library. To support these parameters, the Java class HDF5CDataTypes looks up the values when initiated. The values + * can be accessed as public variables of the Java class, such as: + * + *

+ * int data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
+ * 
+ * + * The Java application uses both types of constants the same way, the only difference is that the + * HDF5CDataTypes may have different values on different platforms. + *

+ * Error handling and Exceptions + *

+ * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the + * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural + * for Java programming. + *

+ * The exceptions of the JHI5 are organized as sub-classes of the class HDF5Exception. There are two subclasses of + * HDF5Exception, HDF5LibraryException + * and HDF5JavaException. The sub-classes of the + * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the JHI5 + * wrapper and support code. + *

+ * The super-class HDF5LibraryException implements the method 'printStackTrace()', which + * prints out the HDF-5 error stack, as described in the HDF-5 C API H5Eprint(). This may be used by Java + * exception handlers to print out the HDF-5 error stack. + *


+ * + * @version HDF5 1.9
+ * See also: hdf.hdf5lib.HDFArray
+ * hdf.hdf5lib.HDF5Constants
+ * hdf.hdf5lib.HDF5CDataTypes
+ * hdf.hdf5lib.HDF5Exception
+ * http://hdfgroup.org/HDF5" + **/ +public class H5 implements java.io.Serializable { + /** + * + */ + private static final long serialVersionUID = 6129888282117053288L; + + private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(H5.class); + + /** + * The version number of the HDF5 library: + * LIB_VERSION[0]: The major version of the library. + * LIB_VERSION[1]: The minor version of the library. + * LIB_VERSION[2]: The release number of the library. + * + * Make sure to update the versions number when a different library is used. + */ + public final static int LIB_VERSION[] = { 1, 9, 9999 }; + + public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; + + // add system property to load library by name from library path, via + // System.loadLibrary() + public final static String H5_LIBRARY_NAME_PROPERTY_KEY = "hdf.hdf5lib.H5.loadLibraryName"; + private static String s_libraryName; + private static boolean isLibraryLoaded = false; + + private final static boolean IS_CRITICAL_PINNING = true; + // change from Vector to LinkedHashSet - jp 6-Oct-2014 + private final static LinkedHashSet OPEN_IDS = new LinkedHashSet(); + + static { + loadH5Lib(); + } + + public static void loadH5Lib() { + // Make sure that the library is loaded only once + if (isLibraryLoaded) + return; + + // first try loading library by name from user supplied library path + s_libraryName = System.getProperty(H5_LIBRARY_NAME_PROPERTY_KEY, null); + String mappedName = null; + if ((s_libraryName != null) && (s_libraryName.length() > 0)) { + try { + mappedName = System.mapLibraryName(s_libraryName); + System.loadLibrary(s_libraryName); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: " + s_libraryName); + log.debug(" resolved to: " + mappedName + "; "); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded from system property"); + } + } + + if (!isLibraryLoaded) { + // else try loading library via full path + String filename = System.getProperty(H5PATH_PROPERTY_KEY, null); + if ((filename != null) && (filename.length() > 0)) { + File h5dll = new File(filename); + if (h5dll.exists() && h5dll.canRead() && h5dll.isFile()) { + try { + System.load(filename); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: "); + log.debug(filename); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded."); + } + } + else { + isLibraryLoaded = false; + throw (new UnsatisfiedLinkError("Invalid HDF5 library, " + filename)); + } + } + } + + // else load standard library + if (!isLibraryLoaded) { + try { + s_libraryName = "hdf5_java"; + mappedName = System.mapLibraryName(s_libraryName); + System.loadLibrary("hdf5_java"); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: " + s_libraryName); + log.debug(" resolved to: " + mappedName + "; "); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded from java.library.path"); + } + } + + /* Important! Exit quietly */ + try { + H5.H5dont_atexit(); + } + catch (HDF5LibraryException e) { + System.exit(1); + } + + /* Important! Disable error output to C stdout */ + if (!log.isDebugEnabled()) + H5.H5error_off(); + + /* + * Optional: confirm the version This will crash immediately if not the specified version. + */ + Integer majnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5maj", null); + Integer minnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5min", null); + Integer relnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5rel", null); + if ((majnum != null) && (minnum != null) && (relnum != null)) { + H5.H5check_version(majnum.intValue(), minnum.intValue(), relnum.intValue()); + } + } + + // //////////////////////////////////////////////////////////// + // // + // H5: General Library Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * Get number of open IDs. + * + * @return Returns a count of open IDs + */ + public final static int getOpenIDCount() { + return OPEN_IDS.size(); + } + + /** + * Get the open IDs + * + * @return Returns a collection of open IDs + */ + public final static Collection getOpenIDs() { + return OPEN_IDS; + } + + /** + * H5check_version verifies that the arguments match the version numbers compiled into the library. + * + * @param majnum + * The major version of the library. + * @param minnum + * The minor version of the library. + * @param relnum + * The release number of the library. + * @return a non-negative value if successful. Upon failure (when the versions do not match), this function causes + * the application to abort (i.e., crash) + * + * See C API function: herr_t H5check_version() + **/ + public synchronized static native int H5check_version(int majnum, int minnum, int relnum); + + /** + * H5close flushes all data to disk, closes all file identifiers, and cleans up all memory used by the library. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5close() throws HDF5LibraryException; + + /** + * H5open initialize the library. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5open() throws HDF5LibraryException; + + /** + * H5dont_atexit indicates to the library that an atexit() cleanup routine should not be installed. In order to be + * effective, this routine must be called before any other HDF function calls, and must be called each time the + * library is loaded/linked into the application (the first time and after it's been unloaded). + *

+ * This is called by the static initializer, so this should never need to be explicitly called by a Java program. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + private synchronized static native int H5dont_atexit() throws HDF5LibraryException; + + /** + * Turn off error handling By default, the C library prints the error stack of the HDF-5 C library on stdout. This + * behavior may be disabled by calling H5error_off(). + * + * @return a non-negative value if successful + */ + public synchronized static native int H5error_off(); + + /** + * H5garbage_collect collects on all free-lists of all types. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5garbage_collect() throws HDF5LibraryException; + + /** + * H5get_libversion retrieves the major, minor, and release numbers of the version of the HDF library which is + * linked to the application. + * + * @param libversion + * The version information of the HDF library. + * + *

+     *      libversion[0] = The major version of the library.
+     *      libversion[1] = The minor version of the library.
+     *      libversion[2] = The release number of the library.
+     * 
+ * @return a non-negative value if successful, along with the version information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5get_libversion(int[] libversion) throws HDF5LibraryException; + + public synchronized static native int H5set_free_list_limits(int reg_global_lim, int reg_list_lim, + int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim) throws HDF5LibraryException; + + /** + * H5export_dataset is a utility function to save data in a file. + * + * @param file_export_name + * The file name to export data into. + * @param file_name + * The name of the HDF5 file containing the dataset. + * @param object_path + * The full path of the dataset to be exported. + * @param binary_order + * 99 - export data as text. + * 1 - export data as binary Native Order. + * 2 - export data as binary Little Endian. + * 3 - export data as binary Big Endian. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5export_dataset(String file_export_name, String file_name, + String object_path, int binary_order) throws HDF5LibraryException; + + /** + * H5is_library_threadsafe Checks to see if the library was built with thread-safety enabled. + * + * @return true if hdf5 library implements threadsafe + * + **/ + private synchronized static native boolean H5is_library_threadsafe(); + + // /////// unimplemented //////// + // H5_DLL herr_t H5free_memory(void *mem); + // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); + // H5_DLL void *H5resize_memory(void *mem, size_t size); + + // //////////////////////////////////////////////////////////// + // // + // H5A: HDF5 1.8 Attribute Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Aclose terminates access to the attribute specified by its identifier, attr_id. + * + * @param attr_id + * IN: Attribute to release access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Aclose(long attr_id) throws HDF5LibraryException { + if (attr_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Aclose remove {}", attr_id); + OPEN_IDS.remove(attr_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Aclose(attr_id); + } + + private synchronized static native int _H5Aclose(long attr_id) throws HDF5LibraryException; + + /** + * H5Acopy copies the content of one attribute to another. + * + * @param src_aid + * the identifier of the source attribute + * @param dst_aid + * the identifier of the destination attribute + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Acopy(long src_aid, long dst_aid) throws HDF5LibraryException; + + /** + * H5Acreate creates an attribute, attr_name, which is attached to the object specified by the identifier loc_id. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param attr_name + * IN: Attribute name + * @param type_id + * IN: Attribute datatype identifier + * @param space_id + * IN: Attribute dataspace identifier + * @param acpl_id + * IN: Attribute creation property list identifier + * @param aapl_id + * IN: Attribute access property list identifier + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Acreate(long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long aapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5A create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Acreate2 an attribute, attr_name, which is attached to the object specified by the identifier loc_id. + * + * @see public static long H5Acreate( long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long + * aapl_id ) + **/ + private synchronized static native long _H5Acreate2(long loc_id, String attr_name, long type_id, long space_id, + long acpl_id, long aapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Acreate_by_name creates an attribute, attr_name, which is attached to the object specified by loc_id and + * obj_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name, relative to loc_id, of object that attribute is to be attached to + * @param attr_name + * IN: Attribute name + * @param type_id + * IN: Attribute datatype identifier + * @param space_id + * IN: Attribute dataspace identifier + * @param acpl_id + * IN: Attribute creation property list identifier (currently not used). + * @param aapl_id + * IN: Attribute access property list identifier (currently not used). + * @param lapl_id + * IN: Link access property list + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Acreate_by_name(long loc_id, String obj_name, String attr_name, long type_id, long space_id, + long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Acreate_by_name add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Acreate_by_name(long loc_id, String obj_name, String attr_name, + long type_id, long space_id, long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Adelete removes the attribute specified by its name, name, from a dataset, group, or named datatype. + * + * @param loc_id + * IN: Identifier of the dataset, group, or named datatype. + * @param name + * IN: Name of the attribute to delete. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Adelete(long loc_id, String name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Adelete_by_idx removes an attribute, specified by its location in an index, from an object. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, from which attribute is to be removed + * @param idx_type + * IN: Type of index + * @param order + * IN: Order in which to iterate over index + * @param n + * IN: Offset within index + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native void H5Adelete_by_idx(long loc_id, String obj_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Adelete_by_name removes the attribute attr_name from an object specified by location and name, loc_id and + * obj_name, respectively. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, from which attribute is to be removed + * @param attr_name + * IN: Name of attribute to delete + * @param lapl_id + * IN: Link access property list identifier. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Adelete_by_name(long loc_id, String obj_name, String attr_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aexists determines whether the attribute attr_name exists on the object specified by obj_id. + * + * @param obj_id + * IN: Object identifier. + * @param attr_name + * IN: Name of the attribute. + * + * @return boolean true if an attribute with a given name exists. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - attr_name is null. + **/ + public synchronized static native boolean H5Aexists(long obj_id, String attr_name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Aexists_by_name determines whether the attribute attr_name exists on an object. That object is specified by its + * location and name, loc_id and obj_name, respectively. + * + * @param loc_id + * IN: Location of object to which attribute is attached . + * @param obj_name + * IN: Name, relative to loc_id, of object that attribute is attached to. + * @param attr_name + * IN: Name of attribute. + * @param lapl_id + * IN: Link access property list identifier. + * + * @return boolean true if an attribute with a given name exists, otherwise returns false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Aexists_by_name(long loc_id, String obj_name, String attr_name, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_info retrieves attribute information, by attribute identifier. + * + * @param attr_id + * IN: Attribute identifier + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5A_info_t H5Aget_info(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_info_by_idx Retrieves attribute information, by attribute index position. + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native H5A_info_t H5Aget_info_by_idx(long loc_id, String obj_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_info_by_name Retrieves attribute information, by attribute name. + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param attr_name + * IN: Attribute name + * @param lapl_id + * IN: Link access property list + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native H5A_info_t H5Aget_info_by_name(long loc_id, String obj_name, String attr_name, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_name retrieves the name of an attribute specified by the identifier, attr_id. + * + * @param attr_id + * IN: Identifier of the attribute. + * + * @return String for Attribute name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Aget_name(long attr_id) + throws HDF5LibraryException; + + /** + * H5Aget_name_by_idx retrieves the name of an attribute that is attached to an object, which is specified by its + * location and name, loc_id and obj_name, respectively. + * + * @param attr_id + * IN: Attribute identifier + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list + * + * @return String for Attribute name. + * + * @exception HDF5LibraryException + * - Error from the HDF5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native String H5Aget_name_by_idx(long attr_id, String obj_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_space retrieves a copy of the dataspace for an attribute. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return attribute dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_space(long attr_id) throws HDF5LibraryException { + long id = _H5Aget_space(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_space add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_space(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_storage_size returns the amount of storage that is required for the specified attribute, attr_id. + * + * @param attr_id + * IN: Identifier of the attribute to query. + * + * @return the amount of storage size allocated for the attribute; otherwise returns 0 (zero) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Aget_storage_size(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_type retrieves a copy of the datatype for an attribute. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_type(long attr_id) throws HDF5LibraryException { + long id = _H5Aget_type(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_type(long attr_id) throws HDF5LibraryException; + + /** + * H5Aopen opens an existing attribute, attr_name, that is attached to an object specified an object identifier, + * object_id. + * + * @param obj_id + * IN: Identifier for object to which attribute is attached + * @param attr_name + * IN: Name of attribute to open + * @param aapl_id + * IN: Attribute access property list identifier + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Aopen(obj_id, attr_name, aapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen(long obj_id, String attr_name, long aapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aopen_by_idx opens an existing attribute that is attached to an object specified by location and name, loc_id + * and obj_name, respectively + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param aapl_id + * IN: Attribute access property list + * @param lapl_id + * IN: Link access property list + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id, + long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, + long n, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aopen_by_name Opens an attribute for an object by object name and attribute name + * + * @param loc_id + * IN: Location from which to find object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to loc_id + * @param attr_name + * IN: Name of attribute to open + * @param aapl_id + * IN: Attribute access property list + * @param lapl_id + * IN: Link access property list identifier + * + * @return Returns an attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen_by_name add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen_by_name(long loc_id, String obj_name, String attr_name, + long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is read into buf from the file. + * + * @param attr_id + * IN: Identifier of an attribute to read. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param buf + * IN: Buffer for data to be read. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. + **/ + public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is read into data object from the file. + * + * @param attr_id + * IN: Identifier of an attribute to read. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param obj + * IN: Object for data to be read. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. See public synchronized static native int H5Aread( ) + **/ + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, + NullPointerException { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + + // This will raise an exception if there is an error + int status = H5Aread(attr_id, mem_type_id, buf); + + // No exception: status really ought to be OK + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + return status; + } + + public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Arename changes the name of attribute that is attached to the object specified by loc_id. The attribute named + * old_attr_name is renamed new_attr_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param old_attr_name + * IN: Prior attribute name + * @param new_attr_name + * IN: New attribute name + * + * @return A non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public synchronized static native int H5Arename(long loc_id, String old_attr_name, String new_attr_name) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Arename_by_name changes the name of attribute that is attached to the object specified by loc_id and obj_name. + * The attribute named old_attr_name is renamed new_attr_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, whose attribute is to be renamed + * @param old_attr_name + * IN: Prior attribute name + * @param new_attr_name + * IN: New attribute name + * @param lapl_id + * IN: Link access property list + * + * @return A non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public synchronized static native int H5Arename_by_name(long loc_id, String obj_name, String old_attr_name, + String new_attr_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is written from buf to the file. + * + * @param attr_id + * IN: Identifier of an attribute to write. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param buf + * IN: Data to be written. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data is null. + **/ + public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is written from data object to the file. + * + * @param attr_id + * IN: Identifier of an attribute to write. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param obj + * IN: Data object to be written. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int + * mem_type_id, byte[] buf); + **/ + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) + throws HDF5Exception, NullPointerException + { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + int retVal = H5Awrite(attr_id, mem_type_id, buf); + buf = null; + theArray = null; + return retVal; + } + + public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_create_plist retrieves a copy of the attribute creation property list identifier. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return identifier for the attribute's creation property list if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_create_plist(long attr_id) + throws HDF5LibraryException + { + long id = _H5Aget_create_plist(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_create_plist(long attr_id) throws HDF5LibraryException; + + /** + * H5Aiterate2 iterates over the attributes attached to a dataset, named datatype, or group, as + * specified by obj_id. For each attribute, user-provided data, op_data, with additional information + * as defined below, is passed to a user-defined function, op, which operates on that attribute. + * + * @param loc_id + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * @param idx_type + * IN: The type of index specified by idx_type can be one of the following: + * H5_INDEX_NAME An alpha-numeric index by attribute name. + * H5_INDEX_CRT_ORDER An index by creation order. + * @param order + * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: + * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration + * incrementing the index position at each step. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration + * decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided + * as to the order, but HDF5 ensures that each element in the index will be + * visited if the iteration completes successfully. + * @param idx + * IN/OUT: Initial and returned offset within index. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Aiterate(long loc_id, int idx_type, int order, long idx, + H5A_iterate_cb op, H5A_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aiterate_by_name iterates over the attributes attached to the dataset or group specified with loc_id + * and obj_name. For each attribute, user-provided data, op_data, with additional information as defined + * below, is passed to a user-defined function, op, which operates on that attribute. + * + * @param loc_id + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * @param obj_name + * IN: Name of object, relative to location. + * @param idx_type + * IN: The type of index specified by idx_type can be one of the following: + * H5_INDEX_NAME An alpha-numeric index by attribute name. + * H5_INDEX_CRT_ORDER An index by creation order. + * @param order + * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: + * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration + * incrementing the index position at each step. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration + * decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided + * as to the order, but HDF5 ensures that each element in the index will be + * visited if the iteration completes successfully. + * @param idx + * IN/OUT: Initial and returned offset within index. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * @param lapl_id + * IN: Link access property list + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Aiterate_by_name(long loc_id, String obj_name, int idx_type, + int order, long idx, H5A_iterate_cb op, H5A_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5D: Datasets Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Dcopy copies the content of one dataset to another dataset. + * + * @param src_did + * the identifier of the source dataset + * @param dst_did + * the identifier of the destinaiton dataset + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Dcopy(long src_did, long dst_did) throws HDF5LibraryException; + + /** + * H5Dclose ends access to a dataset specified by dataset_id and releases resources used by it. + * + * @param dataset_id + * Identifier of the dataset to finish access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Dclose(long dataset_id) throws HDF5LibraryException { + if (dataset_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID"); + + log.trace("OPEN_IDS: H5Dclose remove {}", dataset_id); + OPEN_IDS.remove(dataset_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Dclose(dataset_id); + } + + private synchronized static native int _H5Dclose(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dcreate creates a new dataset named name at the location specified by loc_id. + * + * @param loc_id + * IN: Location identifier + * @param name + * IN: Dataset name + * @param type_id + * IN: Datatype identifier + * @param space_id + * IN: Dataspace identifier + * @param lcpl_id + * IN: Identifier of link creation property list. + * @param dcpl_id + * IN: Identifier of dataset creation property list. + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Dcreate(long loc_id, String name, long type_id, long space_id, long lcpl_id, long dcpl_id, + long dapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Dcreate2(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Dcreate2 creates a new dataset named name at the location specified by loc_id. + * + * @see public static int H5Dcreate(int loc_id, String name, int type_id, int space_id, int lcpl_id, int dcpl_id, + * int dapl_id) + **/ + private synchronized static native long _H5Dcreate2(long loc_id, String name, long type_id, long space_id, + long lcpl_id, long dcpl_id, long dapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dcreate_anon creates a dataset in the file specified by loc_id. + * + * @param loc_id + * IN: Location identifier + * @param type_id + * IN: Datatype identifier + * @param space_id + * IN: Dataspace identifier + * @param dcpl_id + * IN: Identifier of dataset creation property list. + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, long dapl_id) + throws HDF5LibraryException { + long id = _H5Dcreate_anon(loc_id, type_id, space_id, dcpl_id, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dcreate_anon add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, + long dapl_id) throws HDF5LibraryException; + + /** + * H5Dfill explicitly fills the dataspace selection in memory, space_id, with the fill value specified in fill. + * + * @param fill + * IN: Pointer to the fill value to be used. + * @param fill_type + * IN: Fill value datatype identifier. + * @param buf + * IN/OUT: Pointer to the memory buffer containing the selection to be filled. + * @param buf_type + * IN: Datatype of dataspace elements to be filled. + * @param space_id + * IN: Dataspace describing memory buffer and containing the selection to be filled. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native void H5Dfill(byte[] fill, long fill_type, byte[] buf, long buf_type, long space_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dget_access_plist returns an identifier for a copy of the dataset access property list for a dataset. + * + * @param dset_id + * IN: Identifier of the dataset to query. + * + * @return a dataset access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_access_plist(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_create_plist returns an identifier for a copy of the dataset creation property list for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * @return a dataset creation property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_create_plist(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_create_plist(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_create_plist(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dget_offset returns the address in the file of the dataset dset_id. + * + * @param dset_id + * IN: Identifier of the dataset in question + * + * @return the offset in bytes. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_offset(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_space returns an identifier for a copy of the dataspace for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_space(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_space(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_space add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_space(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dget_space_status determines whether space has been allocated for the dataset dset_id. + * + * @param dset_id + * IN: Identifier of the dataset to query. + * + * @return the space allocation status + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Dget_space_status(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_storage_size returns the amount of storage that is required for the dataset. + * + * @param dataset_id + * Identifier of the dataset in question + * + * @return he amount of storage space allocated for the dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_storage_size(long dataset_id) throws HDF5LibraryException, + IllegalArgumentException; + + /** + * H5Dget_type returns an identifier for a copy of the datatype for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_type(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_type(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_type(long dataset_id) throws HDF5LibraryException; + + /** + * H5Diterate iterates over all the data elements in the memory buffer buf, executing the callback function operator + * once for each such data element. + * + * @param buf + * IN/OUT: Pointer to the memory containing the elements to iterate over. + * @param buf_type + * IN: Buffer datatype identifier. + * @param space_id + * IN: Dataspace describing memory buffer. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Diterate(byte[] buf, long buf_type, long space_id, H5D_iterate_cb op, + H5D_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dopen opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * + * @param loc_id + * IN: Location identifier + * @param name + * IN: Dataset name + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Dopen2(loc_id, name, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Dopen2 opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * + * @see public static int H5Dopen(int loc_id, String name, int dapl_id) + **/ + private synchronized static native long _H5Dopen2(long loc_id, String name, long dapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application + * memory buffer buf. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Buffer to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. + **/ + public synchronized static native int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] obj, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); + } + + /** + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application + * data object. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Object to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Failure in the data conversion. + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. + **/ + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, + NullPointerException { + int status = -1; + boolean is1D = false; + + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dread: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + log.trace("H5Dread: cname={} is1D={} dname={}", cname, is1D, dname); + + if (is1D && (dname == 'B')) { + log.trace("H5Dread_dname_B"); + status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + log.trace("H5Dread_dname_S"); + status = H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + log.trace("H5Dread_dname_I"); + status = H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + log.trace("H5Dread_dname_J"); + status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj); + } + else if (is1D && (dname == 'F')) { + log.trace("H5Dread_dname_F"); + status = H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + log.trace("H5Dread_dname_D"); + status = H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (double[]) obj, isCriticalPinning); + } + else if (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); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dread_string type"); + if (H5.H5Tis_variable_str(mem_type_id)) { + status = H5Dread_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); + } + else { + status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (String[]) obj); + } + } + else { + // Create a data buffer to hold the data into a Java Array + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + log.trace("H5Dread_else"); + + // will raise exception if read fails + status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, + isCriticalPinning); + if (status >= 0) { + // convert the data into a Java Array */ + obj = theArray.arrayify(buf); + } + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; + } + + return status; + } + + public synchronized static native int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_string(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dset_extent sets the current dimensions of the chunked dataset dset_id to the sizes specified in size. + * + * @param dset_id + * IN: Chunked dataset identifier. + * @param size + * IN: Array containing the new magnitude of each dimension of the dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + **/ + public synchronized static native void H5Dset_extent(long dset_id, long size[]) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Dvlen_get_buf_size determines the number of bytes required to store the VL data from the dataset, using the + * space_id for the selection in the dataset on disk and the type_id for the memory representation of the VL data in + * memory. + * + * @param dset_id + * IN: Identifier of the dataset read from. + * @param type_id + * IN: Identifier of the datatype. + * @param space_id + * IN: Identifier of the dataspace. + * + * @return the size in bytes of the memory buffer required to store the VL data. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native long H5Dvlen_get_buf_size(long dset_id, long type_id, long space_id) + throws HDF5LibraryException; + + /** + * H5Dvlen_reclaim reclaims buffer used for VL data. + * + * @param type_id + * Identifier of the datatype. + * @param space_id + * Identifier of the dataspace. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @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 H5Dvlen_reclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer + * buf into the file. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param buf + * Buffer with data to be written to the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); + } + + /** + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory data + * object into the file. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Object with data to be written to the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Failure in the data conversion. + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. + **/ + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, + NullPointerException { + int status = -1; + boolean is1D = false; + + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dread: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + + if (is1D && (dname == 'B')) { + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + status = H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + status = H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + status = H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + status = H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + status = H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (double[]) obj, isCriticalPinning); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dwrite_string type"); + if (H5.H5Tis_variable_str(mem_type_id)) { + status = H5Dwrite_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); + } + else { + status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (String[]) obj); + } + } + else { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + // will raise exception on error + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, + isCriticalPinning); + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; + } + + return status; + } + + public synchronized static native int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from + * the application memory buffer buf into the file. + * + * ---- contributed by Rosetta Biosoftware + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param buf + * Buffer with data to be written to the file. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + + public synchronized static native int H5Dwrite_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + // H5_DLL herr_t H5Ddebug(hid_t dset_id); + // herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, + // size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); + // herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf); + + // //////////////////////////////////////////////////////////// + // // + // H5E: Error Stack // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Eauto_is_v2 determines whether the error auto reporting function for an error stack conforms to the H5E_auto2_t + * typedef or the H5E_auto1_t typedef. + * + * @param stack_id + * IN: Error stack identifier. + * + * @return boolean true if the error stack conforms to H5E_auto2_t and false if it conforms to H5E_auto1_t. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Eauto_is_v2(long stack_id) throws HDF5LibraryException; + + /** + * H5Eclear clears the error stack for the current thread. H5Eclear can fail if there are problems initializing the + * library. + *

+ * This may be used by exception handlers to assure that the error condition in the HDF-5 library has been reset. + * + * @return Returns a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Eclear() throws HDF5LibraryException { + H5Eclear2(HDF5Constants.H5E_DEFAULT); + return 0; + } + + /** + * H5Eclear clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack + * for the current thread. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static void H5Eclear(long stack_id) throws HDF5LibraryException { + H5Eclear2(stack_id); + } + + /** + * H5Eclear2 clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack + * for the current thread. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclear2(long stack_id) throws HDF5LibraryException; + + /** + * H5Eclose_msg closes an error message identifier, which can be either a major or minor message. + * + * @param err_id + * IN: Error message identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclose_msg(long err_id) throws HDF5LibraryException; + + /** + * H5Eclose_stack closes the object handle for an error stack and releases its resources. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclose_stack(long stack_id) throws HDF5LibraryException; + + /** + * H5Ecreate_msg adds an error message to an error class defined by client library or application program. + * + * @param cls_id + * IN: Error class identifier. + * @param msg_type + * IN: The type of the error message. + * @param msg + * IN: The error message. + * + * @return a message identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - msg is null. + **/ + public synchronized static native long H5Ecreate_msg(long cls_id, int msg_type, String msg) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ecreate_stack creates a new empty error stack and returns the new stack's identifier. + * + * @return an error stack identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Ecreate_stack() throws HDF5LibraryException; + + /** + * H5Eget_class_name retrieves the name of the error class specified by the class identifier. + * + * @param class_id + * IN: Error class identifier. + * + * @return the name of the error class + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Eget_class_name(long class_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Eget_current_stack copies the current error stack and returns an error stack identifier for the new copy. + * + * @return an error stack identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Eget_current_stack() throws HDF5LibraryException; + + /** + * H5Eset_current_stack replaces the content of the current error stack with a copy of the content of the error + * stack specified by estack_id. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eset_current_stack(long stack_id) throws HDF5LibraryException; + + /** + * H5Eget_msg retrieves the error message including its length and type. + * + * @param msg_id + * IN: Name of the error class. + * @param type_list + * OUT: The type of the error message. Valid values are H5E_MAJOR and H5E_MINOR. + * + * @return the error message + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Eget_msg(long msg_id, int[] type_list) throws HDF5LibraryException; + + /** + * H5Eget_num retrieves the number of error records in the error stack specified by estack_id (including major, + * minor messages and description). + * + * @param stack_id + * IN: Error stack identifier. + * + * @return the number of error messages + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Eget_num(long stack_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Eprint2 prints the error stack specified by estack_id on the specified stream, stream. + * + * @param stack_id + * IN: Error stack identifier.If the identifier is H5E_DEFAULT, the current error stack will be printed. + * @param stream + * IN: File pointer, or stderr if null. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eprint2(long stack_id, Object stream) throws HDF5LibraryException; + + /** + * H5Epop deletes the number of error records specified in count from the top of the error stack specified by + * estack_id (including major, minor messages and description). + * + * @param stack_id + * IN: Error stack identifier. + * @param count + * IN: Version of the client library or application to which the error class belongs. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Epop(long stack_id, long count) throws HDF5LibraryException; + + + /** + * H5Epush2 pushes a new error record onto the error stack specified by estack_id. + * + * @param stack_id + * IN: Error stack identifier. + * @param file + * IN: Name of the file in which the error was detected. + * @param func + * IN: Name of the function in which the error was detected. + * @param line + * IN: Line number within the file at which the error was detected. + * @param cls_id + * IN: Error class identifier. + * @param maj_id + * IN: Major error identifier. + * @param min_id + * IN: Minor error identifier. + * @param msg + * IN: Error description string. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - file, func, or msg is null. + **/ + public static void H5Epush(long stack_id, String file, String func, int line, + long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException + { + H5Epush2(stack_id, file, func, line, cls_id, maj_id, min_id, msg); + } + public synchronized static native void H5Epush2(long stack_id, String file, String func, int line, + long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException; + + /** + * H5Eregister_class registers a client library or application program to the HDF5 error API so that the client + * library or application program can report errors together with HDF5 library. + * + * @param cls_name + * IN: Name of the error class. + * @param lib_name + * IN: Name of the client library or application to which the error class belongs. + * @param version + * IN: Version of the client library or application to which the error class belongs. + * + * @return a class identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native long H5Eregister_class(String cls_name, String lib_name, String version) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Eunregister_class removes the error class specified by class_id. + * + * @param class_id + * IN: Error class identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eunregister_class(long class_id) throws HDF5LibraryException; + + /** + * H5Ewalk walks the error stack specified by estack_id for the current thread and calls the + * function specified in func for each error along the way. + * + * @param stack_id + * IN: Error stack identifier. + * @param direction + * IN: Direction in which the error stack is to be walked. + * @param func + * IN: Function to be called for each error encountered. + * @param client_data + * IN: Data to be passed with func. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - func is null. + **/ + public static void H5Ewalk(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) throws HDF5LibraryException, NullPointerException + { + H5Ewalk2(stack_id, direction, func, client_data); + } + public synchronized static native void H5Ewalk2(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) + throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + // public interface H5E_auto2_t extends Callback + // { + // int callback(int estack, Pointer client_data); + // } + + // int H5Eget_auto(long estack_id, H5E_auto2_t func, PointerByReference client_data); + // { + // return H5Eget_auto2(estack_id, func, client_data); + // } + // int H5Eget_auto2(long estack_id, H5E_auto2_t func, PointerByReference client_data); + + // int H5Eset_auto(long estack_id, H5E_auto2_t func, Pointer client_data); + // { + // return H5Eset_auto2(estack_id, func, client_data); + // } + // int H5Eset_auto2(long estack_id, H5E_auto2_t func, Pointer client_data); + + // public static void H5Epush(long err_stack, String file, String func, int line, + // long cls_id, long maj_id, long min_id, String msg, ...) + // { + // H5Epush2(err_stack, file, func, line, cls_id, maj_id, min_id, msg, ...); + // } + // public synchronized static native void H5Epush2(long err_stack, String file, String func, int line, + // long cls_id, long maj_id, long min_id, String msg, ...); + + // //////////////////////////////////////////////////////////// + // // + // H5F: File Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Fclose terminates access to an HDF5 file. + * + * @param file_id + * Identifier of a file to terminate access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Fclose(long file_id) throws HDF5LibraryException { + if (file_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Fclose remove {}", file_id); + OPEN_IDS.remove(file_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Fclose(file_id); + } + + private synchronized static native int _H5Fclose(long file_id) throws HDF5LibraryException; + + /** + * H5Fopen opens an existing file and is the primary function for accessing existing HDF5 files. + * + * @param name + * Name of the file to access. + * @param flags + * File access flags. + * @param access_id + * Identifier for the file access properties list. + * + * @return a file identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Fopen(String name, int flags, long access_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Fopen(name, flags, access_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fopen(String name, int flags, long access_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Freopen reopens an HDF5 file. + * + * @param file_id + * Identifier of a file to terminate and reopen access to. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @return a new file identifier if successful + **/ + public static long H5Freopen(long file_id) throws HDF5LibraryException { + long id = _H5Freopen(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Freopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Freopen(long file_id) throws HDF5LibraryException; + + /** + * H5Fcreate is the primary function for creating HDF5 files. + * + * @param name + * Name of the file to access. + * @param flags + * File access flags. Possible values include: + *

    + *
  • + * H5F_ACC_RDWR Allow read and write access to file.
  • + *
  • + * H5F_ACC_RDONLY Allow read-only access to file.
  • + *
  • + * H5F_ACC_TRUNC Truncate file, if it already exists, erasing all data previously stored in the file.
  • + *
  • + * H5F_ACC_EXCL Fail if file already exists.
  • + *
  • + * H5P_DEFAULT Apply default file access and creation properties.
  • + *
+ * + * @param create_id + * File creation property list identifier, used when modifying default file meta-data. Use H5P_DEFAULT + * for default access properties. + * @param access_id + * File access property list identifier. If parallel file access is desired, this is a collective call + * according to the communicator stored in the access_id (not supported in Java). Use H5P_DEFAULT for + * default access properties. + * + * @return a file identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Fcreate(String name, int flags, long create_id, long access_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Fcreate(name, flags, create_id, access_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fcreate(String name, int flags, long create_id, long access_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Fflush causes all buffers associated with a file or object to be immediately flushed (written) to disk without + * removing the data from the (memory) cache. + *

+ * After this call completes, the file (or object) is in a consistent state and all data written to date is assured + * to be permanent. + * + * @param object_id + * Identifier of object used to identify the file. object_id can be any object associated with the + * file, including the file itself, a dataset, a group, an attribute, or a named data type. + * @param scope + * specifies the scope of the flushing action, in the case that the HDF-5 file is not a single physical + * file. + *

+ * Valid values are: + *

    + *
  • + * H5F_SCOPE_GLOBAL Flushes the entire virtual file.
  • + *
  • + * H5F_SCOPE_LOCAL Flushes only the specified file.
  • + *
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Fflush(long object_id, int scope) throws HDF5LibraryException; + + /** + * H5Fget_access_plist returns the file access property list identifier of the specified file. + * + * @param file_id + * Identifier of file to get access property list of + * + * @return a file access property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Fget_access_plist(long file_id) throws HDF5LibraryException { + long id = _H5Fget_access_plist(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fget_access_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fget_access_plist(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_create_plist returns a file creation property list identifier identifying the creation properties used to + * create this file. + * + * @param file_id + * Identifier of the file to get creation property list + * + * @return a file creation property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Fget_create_plist(long file_id) throws HDF5LibraryException { + long id = _H5Fget_create_plist(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fget_create_plist(long file_id) throws HDF5LibraryException; + + public synchronized static native long H5Fget_filesize(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_freespace returns the amount of space that is unused by any objects in the file. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * + * @return the amount of free space in the file + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Fget_freespace(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_intent retrieves the intended access mode flag passed with H5Fopen when the file was opened. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * + * @return the intended access mode flag, as originally passed with H5Fopen. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache + * hits + cache misses)) since the last time hit rate statistics were reset. + * + * @param file_id + * IN: Identifier of the target file. + * + * @return the double in which the hit rate is returned. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native double H5Fget_mdc_hit_rate(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_mdc_size queries the metadata cache of the target file for the desired size information. + * + * @param file_id + * IN: Identifier of the target file. + * @param metadata_cache + * OUT: Current metadata cache information + *
    + *
  • metadata_cache[0] = max_size_ptr // current cache maximum size
  • + *
  • metadata_cache[1] = min_clean_size_ptr // current cache minimum clean size
  • + *
  • metadata_cache[2] = cur_size_ptr // current cache size
  • + *
+ * + * @return current number of entries in the cache + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - metadata_cache is null. + **/ + public synchronized static native int H5Fget_mdc_size(long file_id, long[] metadata_cache) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Fget_name retrieves the name of the file to which the object obj_id belongs. + * + * @param obj_id + * IN: Identifier of the object for which the associated filename is sought. + * + * @return the filename. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Fget_name(long obj_id) throws HDF5LibraryException; + + /** + * H5Fget_obj_count returns the number of open object identifiers for the file. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * @param types + * IN: Type of object for which identifiers are to be returned. + *
    + *
  • H5F_OBJ_FILE Files only
  • + *
  • H5F_OBJ_DATASET Datasets only
  • + *
  • H5F_OBJ_GROUP Groups only
  • + *
  • H5F_OBJ_DATATYPE Named datatypes only
  • + *
  • H5F_OBJ_ATTR Attributes only
  • + *
  • H5F_OBJ_ALL All of the above
  • + *
  • H5F_OBJ_LOCAL Restrict search to objects opened through current file identifier.
  • + *
+ * + * @return the number of open objects. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Fget_obj_count(long file_id, int types) throws HDF5LibraryException; + + /** + * H5Fget_obj_ids returns the list of identifiers for all open HDF5 objects fitting the specified criteria. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * @param types + * IN: Type of object for which identifiers are to be returned. + * @param max_objs + * IN: Maximum number of object identifiers to place into obj_id_list. + * @param obj_id_list + * OUT: Pointer to the returned list of open object identifiers. + * + * @return the number of objects placed into obj_id_list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_id_list is null. + **/ + public synchronized static native long H5Fget_obj_ids(long file_id, int types, long max_objs, long[] obj_id_list) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Fis_hdf5 determines whether a file is in the HDF5 format. + * + * @param name + * File name to check format. + * + * @return true if is HDF-5, false if not. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Fis_hdf5(String name) 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. + * + * @param loc_id + * The identifier for the group onto which the file specified by child_id is to be mounted. + * @param name + * The name of the group onto which the file specified by child_id is to be mounted. + * @param child_id + * The identifier of the file to be mounted. + * @param plist_id + * The identifier of the property list to be used. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Fmount(long loc_id, String name, long child_id, long plist_id) + throws HDF5LibraryException, NullPointerException; + + /** + * Given a mount point, H5Funmount dissassociates the mount point's file from the file mounted there. + * + * @param loc_id + * The identifier for the location at which the specified file is to be unmounted. + * @param name + * The name of the file to be unmounted. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Funmount(long loc_id, String name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Freset_mdc_hit_rate_stats resets the hit rate statistics counters in the metadata cache associated with the + * specified file. + * + * @param file_id + * IN: Identifier of the target file. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Freset_mdc_hit_rate_stats(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_info returns global information for the file associated with the + * object identifier obj_id. + * + * @param obj_id IN: Object identifier for any object in the file. + * + * @return A buffer(H5F_info2_t) for current "global" information about file + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native H5F_info2_t H5Fget_info(long obj_id) throws HDF5LibraryException; + + /** + * H5Fclear_elink_file_cache evicts all the cached child files in the specified file's external file + * cache, causing them to be closed if there is nothing else holding them open. + * + * @param file_id + * IN: Identifier of the target file. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Fclear_elink_file_cache(long file_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); + // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); + + // /** + // * H5Fget_vfd_handle returns a pointer to the file handle from the + // low-level file driver + // * currently being used by the HDF5 library for file I/O. + // * + // * @param file_id IN: Identifier of the file to be queried. + // * @param fapl IN: File access property list identifier. + // * + // * @return a pointer to the file handle being used by the low-level + // virtual file driver. + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // **/ + // public synchronized static native Pointer file_handle + // H5Fget_vfd_handle(int file_id, int fapl) + // throws HDF5LibraryException; + + // /** + // * H5Fget_mdc_config loads the current metadata cache configuration into + // * the instance of H5AC_cache_config_t pointed to by the config_ptr + // parameter. + // * + // * @param file_id IN: Identifier of the target file + // * @param config_ptr IN/OUT: Pointer to the instance of + // H5AC_cache_config_t in which the current metadata cache configuration is to be reported. + // * + // * @return none + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // * @exception NullPointerException - config_ptr is null. + // **/ + // public synchronized static native void H5Fget_mdc_config(int file_id, H5AC_cache_config_t config_ptr) + // throws HDF5LibraryException, NullPointerException; + + // /** + // * H5Fset_mdc_config attempts to configure the file's metadata cache + // according to the configuration supplied. + // * + // * @param file_id IN: Identifier of the target file + // * @param config_ptr IN: Pointer to the instance of H5AC_cache_config_t + // containing the desired configuration. + // * + // * @return none + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // * @exception NullPointerException - config_ptr is null. + // **/ + // public synchronized static native int H5Fset_mdc_config(int file_id, H5AC_cache_config_t config_ptr) + // throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5G: Group Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Gclose releases resources used by a group which was opened by a call to H5Gcreate() or H5Gopen(). + * + * @param group_id + * Group identifier to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Gclose(long group_id) throws HDF5LibraryException { + if (group_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Gclose remove {}", group_id); + OPEN_IDS.remove(group_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Gclose(group_id); + } + + private synchronized static native int _H5Gclose(long group_id) throws HDF5LibraryException; + + /** + * H5Gcreate creates a new group with the specified name at the specified location, loc_id. + * + * @param loc_id + * IN: The file or group identifier. + * @param name + * IN: The absolute or relative name of the new group. + * @param lcpl_id + * IN: Identifier of link creation property list. + * @param gcpl_id + * IN: Identifier of group creation property list. + * @param gapl_id + * IN: Identifier of group access property list. (No group access properties have been implemented at + * this time; use H5P_DEFAULT.) + * + * @return a valid group identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Gcreate(long loc_id, String name, long lcpl_id, long gcpl_id, long gapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Gcreate2(loc_id, name, lcpl_id, gcpl_id, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gcreate2(long loc_id, String name, long lcpl_id, long gcpl_id, + long gapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gcreate_anon creates a new empty group in the file specified by loc_id. + * + * @param loc_id + * IN: File or group identifier specifying the file in which the new group is to be created. + * @param gcpl_id + * IN: Identifier of group creation property list. + * @param gapl_id + * IN: Identifier of group access property list. (No group access properties have been implemented at + * this time; use H5P_DEFAULT.) + * + * @return a valid group identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) throws HDF5LibraryException { + long id = _H5Gcreate_anon(loc_id, gcpl_id, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gcreate_anon add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) + throws HDF5LibraryException; + + /** + * H5Gget_create_plist returns an identifier for the group creation property list associated with the group + * specified by group_id. + * + * @param group_id + * IN: Identifier of the group. + * + * @return an identifier for the group's creation property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Gget_create_plist(long group_id) throws HDF5LibraryException; + + /** + * H5Gget_info retrieves information about the group specified by group_id. The information is returned in the + * group_info struct. + * + * @param group_id + * IN: Identifier of the group. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5G_info_t H5Gget_info(long group_id) throws HDF5LibraryException; + + /** + * H5Gget_info_by_idx retrieves information about a group, according to the group's position within an index. + * + * @param group_id + * IN: File or group identifier. + * @param group_name + * IN: Name of group for which information is to be retrieved. + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5G_info_t H5Gget_info_by_idx(long group_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gget_info_by_name retrieves information about the group group_name located in the file or group specified by + * loc_id. + * + * @param group_id + * IN: File or group identifier. + * @param name + * IN: Name of group for which information is to be retrieved. + * @param lapl_id + * IN: Link access property list. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5G_info_t H5Gget_info_by_name(long group_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * + * @param loc_id + * IN: File or group identifier + * @param name + * IN: Name of group for which information is to be retrieved + * @param objNames + * OUT: Names of all objects under the group, name. + * @param objTypes + * OUT: Types of all objects under the group, name. + * @param objRef + * OUT: Reference number of all objects under the group, name. + * + * @return the number of items found + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, + long[] objRef) throws HDF5LibraryException, NullPointerException { + if (objNames == null) { + throw new NullPointerException("H5Gget_obj_info_all(): name array is null"); + } + + return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, objRef, HDF5Constants.H5_INDEX_NAME); + } + + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, ref, indx_type, -1); + } + + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, -1); + } + + public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int indx_type, int indx_order) throws HDF5LibraryException, + NullPointerException { + if (oname == null) { + throw new NullPointerException("H5Gget_obj_info_full(): name array is null"); + } + + if (otype == null) { + throw new NullPointerException("H5Gget_obj_info_full(): object type array is null"); + } + + if (oname.length == 0) { + throw new HDF5LibraryException("H5Gget_obj_info_full(): array size is zero"); + } + + if (oname.length != otype.length) { + throw new HDF5LibraryException("H5Gget_obj_info_full(): name and type array sizes are different"); + } + + if (ltype == null) + ltype = new int[otype.length]; + + if (fno == null) + fno = new long[ref.length]; + + if (indx_type < 0) + indx_type = HDF5Constants.H5_INDEX_NAME; + + if (indx_order < 0) + indx_order = HDF5Constants.H5_ITER_INC; + + log.trace("H5Gget_obj_info_full: oname_len={}", oname.length); + int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, + indx_order); + for (int indx = 0; indx < oname.length; indx++) + log.trace("H5Gget_obj_info_full: oname={}", oname[indx]); + return status; + } + + private synchronized static native int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int n, int indx_type, int indx_order) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Gget_obj_info_idx report the name and type of object with index 'idx' in a Group. The 'idx' corresponds to the + * index maintained by H5Giterate. Each link is returned, so objects with multiple links will be counted once for + * each link. + * + * @param loc_id + * IN: file or group ID. + * @param name + * IN: name of the group to iterate, relative to the loc_id + * @param idx + * IN: the index of the object to iterate. + * @param oname + * the name of the object [OUT] + * @param type + * the type of the object [OUT] + * + * @return non-negative if successful, -1 if not. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_idx(long loc_id, String name, int idx, String[] oname, int[] type) + throws HDF5LibraryException, NullPointerException { + String n[] = new String[1]; + n[0] = new String(""); + oname[0] = H5Lget_name_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, + HDF5Constants.H5P_DEFAULT); + H5L_info_t info = H5Lget_info_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, + HDF5Constants.H5P_DEFAULT); + type[0] = info.type; + return 0; + } + + /* + * Add these methods so that we don't need to call + * in a loop to get information for all the object in a group, which takes + * a lot of time to finish if the number of objects is more than 10,000 + */ + /** + * retrieves information of all objects (recurvisely) under the group (name) located in the file or group specified + * by loc_id upto maximum specified by objMax. + * + * @param loc_id + * IN: File or group identifier + * @param objNames + * OUT: Names of all objects under the group, name. + * @param objTypes + * OUT: Types of all objects under the group, name. + * @param lnkTypes + * OUT: Types of all links under the group, name. + * @param objRef + * OUT: Reference number of all objects under the group, name. + * @param objMax + * IN: Maximum number of all objects under the group, name. + * + * @return the number of items found + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes, + long[] objRef, long objMax) throws HDF5LibraryException, NullPointerException { + if (objNames == null) { + throw new NullPointerException("H5Gget_obj_info_max(): name array is null"); + } + + if (objTypes == null) { + throw new NullPointerException("H5Gget_obj_info_max(): object type array is null"); + } + + if (lnkTypes == null) { + throw new NullPointerException("H5Gget_obj_info_max(): link type array is null"); + } + + if (objNames.length <= 0) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): array size is zero"); + } + + if (objMax <= 0) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): maximum array size is zero"); + } + + if (objNames.length != objTypes.length) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): name and type array sizes are different"); + } + + return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objRef, objMax, objNames.length); + } + + private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, int[] ltype, + long[] ref, long amax, int n) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by + * H5Giterate. Each link is returned, so objects with multiple links will be counted once for each link. + * + * @param loc_id + * file or group ID. + * @param name + * name of the group to iterate, relative to the loc_id + * + * @return the number of members in the group or -1 if error. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static long H5Gn_members(long loc_id, String name) throws HDF5LibraryException, + NullPointerException { + long grp_id = H5Gopen(loc_id, name, HDF5Constants.H5P_DEFAULT); + long n = -1; + + try { + H5G_info_t info = H5.H5Gget_info(grp_id); + n = info.nlinks; + } + finally { + H5Gclose(grp_id); + } + + return n; + } + + /** + * H5Gopen opens an existing group, name, at the location specified by loc_id. + * + * @param loc_id + * IN: File or group identifier specifying the location of the group to be opened. + * @param name + * IN: Name of group to open. + * @param gapl_id + * IN: Identifier of group access property list. + * + * @return a valid group identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Gopen(long loc_id, String name, long gapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Gopen2(loc_id, name, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gopen2(long loc_id, String name, long gapl_id) + throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5I: HDF5 1.8 Identifier Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + public synchronized static native long H5Iget_file_id(long obj_id) throws HDF5LibraryException; + + public synchronized static native long H5Iget_name(long obj_id, String[] name, long size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Iget_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Idec_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Iinc_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Iget_type retrieves the type of the object identified by obj_id. + * + * @param obj_id + * IN: Object identifier whose type is to be determined. + * + * @return the object type if successful; otherwise H5I_BADID. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iget_type(long obj_id) throws HDF5LibraryException; + + /** + * H5Iget_type_ref retrieves the reference count on an ID type. The reference count is used by the library to + * indicate when an ID type can be destroyed. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be retrieved + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iget_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Idec_type_ref decrements the reference count on an identifier type. The reference count is used by the + * library to indicate when an identifier type can be destroyed. If the reference count reaches zero, + * this function will destroy it. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be decremented + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Idec_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Iinc_type_ref increments the reference count on an ID type. The reference count is used by the library + * to indicate when an ID type can be destroyed. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be incremented + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iinc_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Inmembers returns the number of identifiers of the identifier type specified in type. + * + * @param type_id + * IN: Identifier for the identifier type whose member count will be retrieved + * + * @return Number of identifiers of the specified identifier type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Inmembers(long type_id) throws HDF5LibraryException; + + /** + * H5Iis_valid indicates if the identifier type specified in obj_id is valid. + * + * @param obj_id + * IN: Identifier to be checked + * + * @return a boolean, true if the specified identifier id is valid + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Iis_valid(long obj_id) throws HDF5LibraryException; + + /** + * H5Itype_exists indicates if the identifier type specified in type exists. + * + * @param type_id + * IN: the identifier type to be checked + * + * @return a boolean, true if the specified identifier type exists + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Itype_exists(int type_id) throws HDF5LibraryException; + + + /** + * H5Iclear_type deletes all identifiers of the type identified by the argument type. + * + * @param type_id + * IN: Identifier of identifier type which is to be cleared of identifiers + * @param force + * IN: Whether or not to force deletion of all identifiers + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Iclear_type(int type_id, boolean force) throws HDF5LibraryException; + + /** + * H5Idestroy_type deletes an entire identifier type. All identifiers of this type are destroyed + * and no new identifiers of this type can be registered. + * + * @param type_id + * IN: Identifier of identifier type which is to be destroyed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Idestroy_type(int type_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + // void *H5Iobject_verify(hid_t id, H5I_type_t id_type); + + // hid_t H5Iregister(H5I_type_t type, const void *object); + + // H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); + + // void *H5Iremove_verify(hid_t id, H5I_type_t id_type); + + // void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); + + // ////////////////////////////////////////////////////////////////// + // H5L: Link Interface Functions // + // ////////////////////////////////////////////////////////////////// + + /** + * H5Lcopy copies a link from one location to another. + * + * @param src_loc + * IN: Location identifier of the source link + * @param src_name + * IN: Name of the link to be copied + * @param dst_loc + * IN: Location identifier specifying the destination of the copy + * @param dst_name + * IN: Name to be assigned to the new copy + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lcopy(long src_loc, String src_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_external creates a new soft link to an external object, which is an object in a different HDF5 file + * from the location of the link. + * + * @param file_name + * IN: Name of the target file containing the target object. + * @param obj_name + * IN: Path within the target file to the target object. + * @param link_loc_id + * IN: The file or group identifier for the new link. + * @param link_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lcreate_external(String file_name, String obj_name, long link_loc_id, + String link_name, long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_hard creates a new hard link to a pre-existing object in an HDF5 file. + * + * @param cur_loc + * IN: The file or group identifier for the target object. + * @param cur_name + * IN: Name of the target object, which must already exist. + * @param dst_loc + * IN: The file or group identifier for the new link. + * @param dst_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - cur_name or dst_name is null. + **/ + public synchronized static native void H5Lcreate_hard(long cur_loc, String cur_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_soft creates a new soft link to an object in an HDF5 file. + * + * @param link_target + * IN: Path to the target object, which is not required to exist. + * @param link_loc_id + * IN: The file or group identifier for the new link. + * @param link_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - link_name is null. + **/ + public synchronized static native void H5Lcreate_soft(String link_target, long link_loc_id, String link_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Ldelete removes the link specified from a group. + * + * @param loc_id + * IN: Identifier of the file or group containing the object. + * @param name + * IN: Name of the link to delete. + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Ldelete(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ldelete_by_idx removes the nth link in a group according to the specified order and in the specified index. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Index or field which determines the order + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native void H5Ldelete_by_idx(long loc_id, String group_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lexists checks if a link with a particular name exists in a group. + * + * @param loc_id + * IN: Identifier of the file or group to query. + * @param name + * IN: The name of the link to check. + * @param lapl_id + * IN: Link access property list identifier + * + * @return a boolean, true if the name exists, otherwise false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Lexists(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_info returns information about the specified link. + * + * @param loc_id + * IN: Identifier of the file or group. + * @param name + * IN: Name of the link for which information is being sought. + * @param lapl_id + * IN: Link access property list identifier + * + * @return a buffer(H5L_info_t) for the link information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5L_info_t H5Lget_info(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_info_by_idx opens a named datatype at the location specified by loc_id and return an identifier for the + * datatype. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @return a buffer(H5L_info_t) for the link information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native H5L_info_t H5Lget_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_name_by_idx retrieves name of the nth link in a group, according to the order within a specified field or + * index. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @return a String for the link name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native String H5Lget_name_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_value returns the link value of a symbolic link. Note that this function is a combination + * of H5Lget_info(), H5Lget_val() and for external links, H5Lunpack_elink_val. + * + * @param loc_id + * IN: Identifier of the file or group containing the object. + * @param name + * IN: Name of the symbolic link. + * @param link_value + * OUT: Path of the symbolic link, or the file_name and path of an external file. + * @param lapl_id + * IN: Link access property list identifier + * + * @return the link type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Lget_value(long loc_id, String name, String[] link_value, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_value_by_idx retrieves value of the nth link in a group, according to the order within an index. + * Note that this function is a combination of H5Lget_info(), H5Lget_val() and for external links, + * H5Lunpack_elink_val. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param link_value + * OUT: Path of the symbolic link, or the file_name and path of an external file. + * @param lapl_id + * IN: Link access property list identifier + * + * @return the link type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Lget_value_by_idx(long loc_id, String group_name, int idx_type, int order, + long n, String[] link_value, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Literate iterates through links in a group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param idx + * IN: Iteration position at which to start + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_cb op, + H5L_iterate_t op_data) throws HDF5LibraryException; + + /** + * H5Literate_by_name iterates through links in a group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param idx + * IN: Iteration position at which to start + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * @param lapl_id + * IN: Link access property list identifier + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, int order, + long idx, H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Lmove renames a link within an HDF5 file. + * + * @param src_loc + * IN: Original file or group identifier. + * @param src_name + * IN: Original link name. + * @param dst_loc + * IN: Destination file or group identifier. + * @param dst_name + * IN: New link name. + * @param lcpl_id + * IN: Link creation property list identifier to be associated with the new link. + * @param lapl_id + * IN: Link access property list identifier to be associated with the new link. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lmove(long src_loc, String src_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lvisit recursively visits all links starting from a specified group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_cb op, + H5L_iterate_t op_data) throws HDF5LibraryException; + + /** + * H5Lvisit_by_name recursively visits all links starting from a specified group. + * + * @param loc_id + * IN: Identifier specifying subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * @param lapl_id + * IN: link access property + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, int order, + H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Lis_registered tests whether a user-defined link class is currently registered, + * either by the HDF5 Library or by the user through the use of H5Lregister. + * + * @param link_cls_id + * IN: User-defined link class identifier + * + * @return Returns a positive value if the link class has been registered and zero if it is unregistered. + * Otherwise returns a negative value; this may mean that the identifier is not a valid user-defined class identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Lis_registered(int link_cls_id) throws HDF5LibraryException; + + /** + * H5Lunregister unregisters a class of user-defined links, preventing them from being traversed, queried, moved, etc. + * + * @param link_cls_id + * IN: User-defined link class identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Lunregister(int link_cls_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + // herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, + // H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, + // hid_t lapl_id); + + // herr_t H5Lregister(const H5L_class_t *cls); + + // herr_t H5Lunpack_elink_val(const void *ext_linkval/*in*/, size_t link_size, + // unsigned *flags, const char **filename/*out*/, const char **obj_path /*out*/); + // herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, + // size_t size, hid_t lapl_id); + // herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, + // H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + // void *buf/*out*/, size_t size, hid_t lapl_id); + + + // //////////////////////////////////////////////////////////// + // // + // H5O: HDF5 1.8 Object Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Oclose closes the group, dataset, or named datatype specified. + * + * @param object_id + * IN: Object identifier + * + * @return non-negative on success + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Oclose(long object_id) throws HDF5LibraryException { + if (object_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Oclose remove {}", object_id); + OPEN_IDS.remove(object_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Oclose(object_id); + } + + private synchronized static native int _H5Oclose(long object_id) throws HDF5LibraryException; + + /** + * H5Ocopy copies the group, dataset or named datatype specified from the file or group specified by source location + * to the destination location. + * + * @param src_loc_id + * IN: Object identifier indicating the location of the source object to be copied + * @param src_name + * IN: Name of the source object to be copied + * @param dst_loc_id + * IN: Location identifier specifying the destination + * @param dst_name + * IN: Name to be assigned to the new copy + * @param ocpypl_id + * IN: Object copy property list + * @param lcpl_id + * IN: Link creation property list for the new hard link + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Ocopy(long src_loc_id, String src_name, long dst_loc_id, String dst_name, + long ocpypl_id, long lcpl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_comment retrieves the comment for the specified object. + * + * @param obj_id + * IN: File or group identifier + * + * @return the comment + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Oget_comment(long obj_id) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Oset_comment sets the comment for the specified object. + * + * @param obj_id + * IN: Identifier of the target object + * @param comment + * IN: The new comment. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + * @deprecated As of HDF5 1.8 in favor of object attributes. + **/ + @Deprecated + public synchronized static native void H5Oset_comment(long obj_id, String comment) throws HDF5LibraryException; + + /** + * H5Oget_comment_by_name retrieves the comment for an object. + * + * @param loc_id + * IN: Identifier of a file, group, dataset, or named datatype. + * @param name + * IN: Relative name of the object whose comment is to be set or reset. + * @param lapl_id + * IN: Link access property list identifier. + * + * @return the comment + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native String H5Oget_comment_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, IllegalArgumentException, NullPointerException; + + // long H5Oget_comment_by_name(int loc_id, String name, String comment, long bufsize, int lapl_id); + + /** + * H5Oset_comment_by_name sets the comment for the specified object. + * + * @param loc_id + * IN: Identifier of a file, group, dataset, or named datatype. + * @param name + * IN: Relative name of the object whose comment is to be set or reset. + * @param comment + * IN: The new comment. + * @param lapl_id + * IN: Link access property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + * + * @deprecated As of HDF5 1.8 in favor of object attributes. + **/ + @Deprecated + public synchronized static native void H5Oset_comment_by_name(long loc_id, String name, String comment, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_info retrieves the metadata for an object specified by an identifier. + * + * @param loc_id + * IN: Identifier for target object + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position. + * + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * + * @param loc_id + * IN: File or group identifier specifying location of group in which object is located + * @param name + * IN: Relative name of group + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Olink creates a new hard link to an object in an HDF5 file. + * + * @param obj_id + * IN: Object to be linked. + * @param new_loc_id + * IN: File or group identifier specifying location at which object is to be linked. + * @param new_name + * IN: Relative name of link to be created. + * @param lcpl_id + * IN: Link creation property list identifier. + * @param lapl_id + * IN: Access property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Olink(long obj_id, long new_loc_id, String new_name, long lcpl_id, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oopen opens a group, dataset, or named datatype specified by a location and a path name. + * + * @param loc_id + * IN: File or group identifier + * @param name + * IN: Relative path to the object + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Oopen(long loc_id, String name, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Oopen(loc_id, name, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Oopen(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ovisit recursively visits all objects accessible from a specified object. + * + * @param obj_id + * IN: Identifier of the object at which the recursive iteration begins. + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, + H5O_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Ovisit_by_name recursively visits all objects starting from a specified object. + * + * @param loc_id + * IN: File or group identifier + * @param obj_name + * IN: Relative path to the object + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * @param lapl_id + * IN: Link access property list identifier + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, + H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Oexists_by_name is used by an application to check that an existing link resolves to an object. + * Primarily, it is designed to check for dangling soft, external, or user-defined links. + * + * @param loc_id + * IN: File or group identifier + * @param obj_name + * IN: Relative path to the object + * @param lapl_id + * IN: Link access property list identifier + * + * @return Returns TRUE or FALSE if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Oexists_by_name(long loc_id, String obj_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Odecr_refcount decrements the hard link reference count for an object. + * + * @param object_id IN: Object identifier + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Odecr_refcount(long object_id) throws HDF5LibraryException; + + /** + * H5Oincr_refcount increments the hard link reference count for an object. + * + * @param object_id IN: Object identifier + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException; + + /** + * H5Oopen_by_addr opens a group, dataset, or named datatype using its address within an HDF5 file. + * + * @param loc_id IN: File or group identifier + * @param addr IN: Object's address in the file + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public static long H5Oopen_by_addr(long loc_id, long addr) throws HDF5LibraryException { + long id = _H5Oopen_by_addr(loc_id, addr); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen_by_addr add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Oopen_by_addr(long loc_id, long addr) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Oopen_by_idx opens the nth object in the group specified. + * + * @param loc_id IN: File or group identifier + * @param group_name IN: Name of group, relative to loc_id, in which object is located + * @param idx_type IN: Type of index by which objects are ordered + * @param order IN: Order of iteration within index + * @param n IN: Object to open + * @param lapl_id IN: Access property list identifier for the link pointing to the object + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception NullPointerException - group_name is null. + **/ + public static long H5Oopen_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Oopen_by_idx(loc_id, group_name, idx_type, order, n, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen_by_idx add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + public synchronized static native long _H5Oopen_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + + // //////////////////////////////////////////////////////////// + // // + // H5P: Property List Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + // Generic property list routines + + /** + * H5Pget_class_name retrieves the name of a generic property list class + * + * @param plid + * IN: Identifier of property object to query + * @return name of a property list if successful; null if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native String H5Pget_class_name(long plid) throws HDF5LibraryException; + + /** + * H5Pcreate creates a new property as an instance of some property list class. + * + * @param type + * IN: The type of property list to create. + * + * @return a property list identifier (plist) if successful; otherwise Fail (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Pcreate(long type) throws HDF5LibraryException { + long id = _H5Pcreate(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcreate(long type) throws HDF5LibraryException; + + /** + * Sets a property list value (support integer only) + * + * @param plid + * IN: Property list identifier to modify + * @param name + * IN: Name of property to modify + * @param value + * IN: value to set the property to + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pset(long plid, String name, int value) throws HDF5LibraryException; + + /** + * H5Pexist determines whether a property exists within a property list or class + * + * @param plid + * IN: Identifier for the property to query + * @param name + * IN: Name of property to check for + * @return a positive value if the property exists in the property object; zero if the property does not exist; a + * negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pexist(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pget_size retrieves the size of a property's value in bytes + * + * @param plid + * IN: Identifier of property object to query + * @param name + * IN: Name of property to query + * @return size of a property's value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_size(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pget_nprops retrieves the number of properties in a property list or class + * + * @param plid + * IN: Identifier of property object to query + * @return number of properties if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_nprops(long plid) throws HDF5LibraryException; + + /** + * H5Pget_class returns the property list class for the property list identified by the plist parameter. + * + * @param plist + * IN: Identifier of property list to query. + * @return a property list class if successful. Otherwise returns H5P_ROOT (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Pget_class(long plist) throws HDF5LibraryException; + + /** + * H5Pget_class_parent retrieves an identifier for the parent class of a property class + * + * @param plid + * IN: Identifier of the property class to query + * @return a valid parent class object identifier if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_class_parent(long plid) throws HDF5LibraryException; + + /** + * H5Pget retrieves a copy of the value for a property in a property list (support integer only) + * + * @param plid + * IN: Identifier of property object to query + * @param name + * IN: Name of property to query + * @return value for a property if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pget(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pequal determines if two property lists or classes are equal + * + * @param plid1 + * IN: First property object to be compared + * @param plid2 + * IN: Second property object to be compared + * @return positive value if equal; zero if unequal, a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pequal(long plid1, long plid2) throws HDF5LibraryException; + + public static boolean H5P_equal(long plid1, long plid2) throws HDF5LibraryException { + if (H5Pequal(plid1, plid2) == 1) + return true; + return false; + } + + /** + * H5Pisa_class checks to determine whether a property list is a member of the specified class + * + * @param plist + * IN: Identifier of the property list + * @param pclass + * IN: Identifier of the property class + * @return a positive value if equal; zero if unequal; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pisa_class(long plist, long pclass) throws HDF5LibraryException; + + /** + * H5Pcopy_prop copies a property from one property list or class to another + * + * @param dst_id + * IN: Identifier of the destination property list or class + * @param src_id + * IN: Identifier of the source property list or class + * @param name + * IN: Name of the property to copy + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pcopy_prop(long dst_id, long src_id, String name) + throws HDF5LibraryException; + + /** + * H5Premove removes a property from a property list + * + * @param plid + * IN: Identifier of the property list to modify + * @param name + * IN: Name of property to remove + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Premove(long plid, String name) throws HDF5LibraryException; + + /** + * H5Punregister removes a property from a property list class + * + * @param plid + * IN: Property list class from which to remove permanent property + * @param name + * IN: Name of property to remove + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Punregister(long plid, String name) throws HDF5LibraryException; + + /** + * Closes an existing property list class + * + * @param plid + * IN: Property list class to close + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public static int H5Pclose_class(long plid) throws HDF5LibraryException { + if (plid < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Pclose_class remove {}", plid); + OPEN_IDS.remove(plid); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Pclose_class(plid); + } + + public synchronized static native int _H5Pclose_class(long plid) throws HDF5LibraryException; + + /** + * H5Pclose terminates access to a property list. + * + * @param plist + * IN: Identifier of the property list to terminate access to. + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Pclose(long plist) throws HDF5LibraryException { + if (plist < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Pclose remove {}", plist); + OPEN_IDS.remove(plist); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Pclose(plist); + } + + private synchronized static native int _H5Pclose(long plist) throws HDF5LibraryException; + + /** + * H5Pcopy copies an existing property list to create a new property list. + * + * @param plist + * IN: Identifier of property list to duplicate. + * + * @return a property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Pcopy(long plist) throws HDF5LibraryException { + long id = _H5Pcopy(plist); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException; + + public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException { + long id = _H5Pcreate_class_nocb(parent_class, name); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcreate_class_nocb add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException; + +// public static long H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, +// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException { +// long id = _H5Pcreate_class(parent_class, name, create_op, create_data, copy_op, copy_data, close_op, close_data); +// if (id > 0) { +// log.trace("OPEN_IDS: H5Pcreate_class add {}", id); +// OPEN_IDS.add(id); +// log.trace("OPEN_IDS: {}", OPEN_IDS.size()); +// } +// return id; +// } +// +// private synchronized static native long _H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, +// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException; + + public synchronized static native void H5Pregister2_nocb(long plist_class, String name, long size, byte[] def_value) throws HDF5LibraryException; + +// public synchronized static native void H5Pregister2(long plist_class, String name, long size, byte[] def_value, H5P_prp_create_func_cb prp_create, H5P_prp_set_func_cb prp_set, +// H5P_prp_get_func_cb prp_get, H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + + public synchronized static native void H5Pinsert2_nocb(long plist, String name, long size, byte[] value) throws HDF5LibraryException; + + + // public synchronized static native void H5Pinsert2(long plist, String name, long size, byte[] value, H5P_prp_set_func_cb prp_set, H5P_prp_get_func_cb prp_get, + // H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + + 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 + + /** + * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. + * + * @param ocpl_id + * IN: : Object (dataset or group) creation property list identifier + * @param attributes + * The maximun and minimum no. of attributes to be stored. + * + *
+     *      attributes[0] =  The maximum number of attributes to be stored in compact storage
+     *      attributes[1] =  The minimum number of attributes to be stored in dense storage
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_attr_phase_change(long ocpl_id, int[] attributes) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_attr_phase_change sets threshold values for attribute storage on an object. These + * thresholds determine the point at which attribute storage changes + * from compact storage (i.e., storage in the object header) + * to dense storage (i.e., storage in a heap and indexed with a B-tree). + * + * @param ocpl_id + * IN: : Object (dataset or group) creation property list identifier + * @param max_compact + * IN: Maximum number of attributes to be stored in compact storage (Default: 8) + * @param min_dense + * IN: Minimum number of attributes to be stored in dense storage (Default: 6) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_attr_phase_change(long ocpl_id, int max_compact, int min_dense) + throws HDF5LibraryException; + + /** + * H5Pget_attr_creation_order retrieves the settings for tracking and indexing attribute creation order on an object + * + * @param ocpl_id + * IN: Object (group or dataset) creation property list identifier + * + * @return Flags specifying whether to track and index attribute creation order + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_attr_creation_order(long ocpl_id) throws HDF5LibraryException; + + /** + * H5Pset_attr_creation_order sets flags specifying whether to track and index attribute creation order on an + * object. + * + * @param ocpl_id + * IN: Object creation property list identifier + * @param crt_order_flags + * IN: Flags specifying whether to track and index attribute creation order + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_attr_creation_order(long ocpl_id, int crt_order_flags) + throws HDF5LibraryException; + + /** + * H5Pget_obj_track_times queries the object creation property list, ocpl_id, to determine whether object times are + * being recorded. + * + * @param ocpl_id + * IN: Object creation property list identifier + * + * @return TRUE or FALSE, specifying whether object times are being recorded + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_obj_track_times(long ocpl_id) throws HDF5LibraryException; + + /** + * H5Pset_obj_track_times sets a property in the object creation property list, ocpl_id, that governs the recording + * of times associated with an object. + * + * @param ocpl_id + * IN: Object creation property list identifier + * + * @param track_times + * IN: TRUE or FALSE, specifying whether object times are to be tracked + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_obj_track_times(long ocpl_id, boolean track_times) + throws HDF5LibraryException; + + public synchronized static native int H5Pmodify_filter(long plist, long filter, int flags, long cd_nelmts, + int[] cd_values) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_filter adds the specified filter and corresponding properties to the end of an output filter pipeline. + * + * @param plist + * IN: Property list identifier. + * @param filter + * IN: Filter to be added to the pipeline. + * @param flags + * IN: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * IN: Number of elements in cd_values + * @param cd_values + * IN: Auxiliary data for the filter. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_filter(long plist, int filter, int flags, long cd_nelmts, + int[] cd_values) throws HDF5LibraryException; + + /** + * H5Pget_nfilters returns the number of filters defined in the filter pipeline associated with the property list + * plist. + * + * @param plist + * IN: Property list identifier. + * + * @return the number of filters in the pipeline if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_nfilters(long plist) throws HDF5LibraryException; + + /** + * H5Pget_filter returns information about a filter, specified by its filter number, in a filter pipeline, specified + * by the property list with which it is associated. + * + * @param plist + * IN: Property list identifier. + * @param filter_number + * IN: Sequence number within the filter pipeline of the filter for which information is sought. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * IN/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT:A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or an array is null. + * + **/ + public static int H5Pget_filter(long plist, int filter_number, int[] flags, long[] cd_nelmts, int[] cd_values, + long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException { + return H5Pget_filter2(plist, filter_number, flags, cd_nelmts, cd_values, namelen, name, filter_config); + } + + /** + * H5Pget_filter2 returns information about a filter, specified by its filter number, in a filter pipeline, + * specified by the property list with which it is associated. + * + * @see public static int H5Pget_filter(int plist, int filter_number, int[] flags, int[] cd_nelmts, int[] cd_values, + * int namelen, String[] name, int[] filter_config) + * + **/ + private synchronized static native int H5Pget_filter2(long plist, int filter_number, int[] flags, long[] cd_nelmts, + int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException; + + /** + * H5Pget_filter_by_id returns information about the filter specified in filter_id, a filter identifier. plist_id + * must be a dataset or group creation property list and filter_id must be in the associated filter pipeline. The + * filter_id and flags parameters are used in the same manner as described in the discussion of H5Pset_filter. Aside + * from the fact that they are used for output, the parameters cd_nelmts and cd_values[] are used in the same manner + * as described in the discussion of H5Pset_filter. On input, the cd_nelmts parameter indicates the number of + * entries in the cd_values[] array allocated by the calling program; on exit it contains the number of values + * defined by the filter. On input, the namelen parameter indicates the number of characters allocated for the + * filter name by the calling program in the array name[]. On exit name[] contains the name of the filter with one + * character of the name in each element of the array. If the filter specified in filter_id is not set for the + * property list, an error will be returned and H5Pget_filter_by_id1 will fail. + * + * @param plist_id + * IN: Property list identifier. + * @param filter_id + * IN: Filter identifier. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * N/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT: A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception NullPointerException + * - name or an array is null. + * + **/ + public static int H5Pget_filter_by_id(long plist_id, long filter_id, int[] flags, long[] cd_nelmts, + int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException { + return H5Pget_filter_by_id2(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, filter_config); + } + + /** + * H5Pget_filter_by_id2 returns information about a filter, specified by its filter id, in a filter pipeline, + * specified by the property list with which it is associated. + * + * @param plist_id + * IN: Property list identifier. + * @param filter_id + * IN: Filter identifier. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * N/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT: A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or an array is null. + * + **/ + public synchronized static native int H5Pget_filter_by_id2(long plist_id, long filter_id, int[] flags, + long[] cd_nelmts, int[] cd_values, long namelen, String[] name, int[] filter_config) + throws HDF5LibraryException, NullPointerException; + + + public synchronized static native boolean H5Pall_filters_avail(long dcpl_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Premove_filter(long obj_id, long filter) throws HDF5LibraryException; + + /** + * H5Pset_deflate sets the compression method for a dataset. + * + * @param plist + * IN: Identifier for the dataset creation property list. + * @param level + * IN: Compression level. + * + * @return non-negative if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_deflate(long plist, int level) throws HDF5LibraryException; + + public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, + NullPointerException; + + // File creation property list (FCPL) routines + + /** + * H5Pget_userblock retrieves the size of a user block in a file creation property list. + * + * @param plist + * IN: Identifier for property list to query. + * @param size + * OUT: Pointer to location to return user-block size. + * + * @return a non-negative value and the size of the user block; if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + **/ + public synchronized static native int H5Pget_userblock(long plist, long[] size) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_userblock sets the user block size of a file creation property list. + * + * @param plist + * IN: Identifier of property list to modify. + * @param size + * IN: Size of the user-block in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_userblock(long plist, long size) throws HDF5LibraryException; + + /** + * H5Pget_sizes retrieves the size of the offsets and lengths used in an HDF5 file. This function is only valid for + * file creation property lists. + * + * @param plist + * IN: Identifier of property list to query. + * @param size + * OUT: the size of the offsets and length. + * + *
+     *      size[0] = sizeof_addr // offset size in bytes
+     *      size[1] = sizeof_size // length size in bytes
+     * 
+ * @return a non-negative value with the sizes initialized; if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - size is invalid. + **/ + public synchronized static native int H5Pget_sizes(long plist, long[] size) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_sizes sets the byte size of the offsets and lengths used to address objects in an HDF5 file. + * + * @param plist + * IN: Identifier of property list to modify. + * @param sizeof_addr + * IN: Size of an object offset in bytes. + * @param sizeof_size + * IN: Size of an object length in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_sizes(long plist, int sizeof_addr, int sizeof_size) + throws HDF5LibraryException; + + /** + * H5Pget_sym_k retrieves the size of the symbol table B-tree 1/2 rank and the symbol table leaf node 1/2 size. + * + * @param plist + * IN: Property list to query. + * @param size + * OUT: the symbol table's B-tree 1/2 rank and leaf node 1/2size. + * + *
+     *      size[0] = ik // the symbol table's B-tree 1/2 rank
+     *      size[1] = lk // leaf node 1/2 size
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - size is invalid. + **/ + public synchronized static native int H5Pget_sym_k(long plist, int[] size) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_sym_k sets the size of parameters used to control the symbol table nodes. + * + * @param plist + * IN: Identifier for property list to query. + * @param ik + * IN: Symbol table tree rank. + * @param lk + * IN: Symbol table node size. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_sym_k(long plist, int ik, int lk) throws HDF5LibraryException; + + /** + * H5Pget_istore_k queries the 1/2 rank of an indexed storage B-tree. + * + * @param plist + * IN: Identifier of property list to query. + * @param ik + * OUT: Pointer to location to return the chunked storage B-tree 1/2 rank. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - ik array is null. + **/ + public synchronized static native int H5Pget_istore_k(long plist, int[] ik) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_istore_k sets the size of the parameter used to control the B-trees for indexing chunked datasets. + * + * @param plist + * IN: Identifier of property list to query. + * @param ik + * IN: 1/2 rank of chunked storage B-tree. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_istore_k(long plist, int ik) throws HDF5LibraryException; + + /** + * H5Pget_shared_mesg_nindexes retrieves number of shared object header message indexes in file creation property + * list. + * + * @param fcpl_id + * IN: : File creation property list identifier + * + * @return nindexes, the number of shared object header message indexes available in files created with this + * property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_shared_mesg_nindexes(long fcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_shared_mesg_nindexes sets the number of shared object header message indexes in the specified file + * creation property list. + * + * @param plist_id + * IN: File creation property list + * @param nindexes + * IN: Number of shared object header message indexes to be available in files created with this property + * list + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pset_shared_mesg_nindexes(long plist_id, int nindexes) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_shared_mesg_index Retrieves the configuration settings for a shared message index. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param index_num + * IN: Index being configured. + * @param mesg_info + * The message type and minimum message size + * + *
+     *      mesg_info[0] =  Types of messages that may be stored in this index.
+     *      mesg_info[1] =  Minimum message size.
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - mesg_info is null. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pget_shared_mesg_index(long fcpl_id, int index_num, int[] mesg_info) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Pset_shared_mesg_index Configures the specified shared object header message index + * + * @param fcpl_id + * IN: File creation property list identifier. + * @param index_num + * IN: Index being configured. + * @param mesg_type_flags + * IN: Types of messages that should be stored in this index. + * @param min_mesg_size + * IN: Minimum message size. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pset_shared_mesg_index(long fcpl_id, int index_num, int mesg_type_flags, + int min_mesg_size) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_shared_mesg_phase_change retrieves shared object header message phase change information. + * + * @param fcpl_id + * IN: : File creation property list identifier + * @param size + * The threshold values for storage of shared object header message indexes in a file. + * + *
+     *      size[0] =  Threshold above which storage of a shared object header message index shifts from list to B-tree
+     *      size[1] =  Threshold below which storage of a shared object header message index reverts to list format
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_shared_mesg_phase_change(long fcpl_id, int[] size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_shared_mesg_phase_change sets shared object header message storage phase change thresholds. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param max_list + * IN: Threshold above which storage of a shared object header message index shifts from list to B-tree + * @param min_btree + * IN: Threshold below which storage of a shared object header message index reverts to list format + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native int H5Pset_shared_mesg_phase_change(long fcpl_id, int max_list, int min_btree) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_file_space sets the file space management strategy for the file associated with fcpl_id to strategy. + * There are four strategies that applications can select and they are described in the Parameters section. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param strategy + * IN: The strategy for file space management. + * Passing a value of zero (0) indicates that the value of strategy is not to be modified. + * H5F_FILE_SPACE_ALL_PERSIST + * With this strategy, the free-space managers track the free space that results from the + * manipulation of HDF5 objects in the HDF5 file. The free space information is saved when the + * file is closed, and reloaded when the file is reopened. When space is needed for file metadata + * or raw data, the HDF5 library first requests space from the library's free-space managers. + * If the request is not satisfied, the library requests space from the aggregators. If the request + * is still not satisfied, the library requests space from the virtual file driver. That is, the + * library will use all of the mechanisms for allocating space. + * H5F_FILE_SPACE_ALL (Default file space management strategy) + * With this strategy, the free-space managers track the free space that results from the manipulation + * of HDF5 objects in the HDF5 file. The free space information is NOT saved when the file is closed + * and the free space that exists upon file closing becomes unaccounted space in the file. + * Like the previous strategy, the library will try all of the mechanisms for allocating space. When + * space is needed for file metadata or raw data, the library first requests space from the free-space + * managers. If the request is not satisfied, the library requests space from the aggregators. If the + * request is still not satisfied, the library requests space from the virtual file driver. + * H5F_FILE_SPACE_AGGR_VFD + * With this strategy, the library does not track free space that results from the manipulation of HDF5 + * obejcts in the HDF5 file and the free space becomes unaccounted space in the file. + * When space is needed for file metadata or raw data, the library first requests space from the + * aggregators. If the request is not satisfied, the library requests space from the virtual file driver. + * H5F_FILE_SPACE_VFD + * With this strategy, the library does not track free space that results from the manipulation of HDF5 + * obejcts in the HDF5 file and the free space becomes unaccounted space in the file. + * When space is needed for file metadata or raw data, the library requests space from the virtual file driver. + * @param threshold + * IN: The free-space section threshold. The library default is 1, which is to track all free-space sections. + * Passing a value of zero (0) indicates that the value of threshold is not to be modified. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native void H5Pset_file_space(long fcpl_id, int strategy, long threshold) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_file_space provides the means for applications to manage the HDF5 file's file space for their specific needs. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param strategy + * IN/OUT: The current file space management strategy in use for the file. NULL, strategy not queried. + * @param threshold + * IN/OUT: The current free-space section threshold. NULL, threshold not queried. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native void H5Pget_file_space(long fcpl_id, int[] strategy, long[] threshold) + throws HDF5LibraryException, IllegalArgumentException; + + // File access property list (FAPL) routines + + /** + * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. + * + * @param plist + * IN: Identifier of a file access property list. + * @param alignment + * OUT: threshold value and alignment value. + * + *
+     *      alignment[0] = threshold // threshold value
+     *      alignment[1] = alignment // alignment value
+     * 
+ * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - aligment array is null. + * @exception IllegalArgumentException + * - aligment array is invalid. + **/ + public synchronized static native int H5Pget_alignment(long plist, long[] alignment) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_alignment sets the alignment properties of a file access property list so that any file object >= + * THRESHOLD bytes will be aligned on an address which is a multiple of ALIGNMENT. + * + * @param plist + * IN: Identifier for a file access property list. + * @param threshold + * IN: Threshold value. + * @param alignment + * IN: Alignment value. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_alignment(long plist, long threshold, long alignment) + throws HDF5LibraryException; + + /** + * H5Pget_driver returns the identifier of the low-level file driver associated with the file access property list + * or data transfer property list plid. + * + * @param plid + * IN: File access or data transfer property list identifier. + * @return a valid low-level driver identifier if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_driver(long plid) throws HDF5LibraryException; + + public synchronized static native long H5Pget_family_offset(long fapl_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_family_offset(long fapl_id, long offset) throws HDF5LibraryException, + NullPointerException; + + /** + * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes + * and the RDCC_W0 value in the raw data chunk cache. + * + * @param plist + * IN: Identifier of the file access property list. + * @param mdc_nelmts + * IN/OUT: No longer used, will be ignored. + * @param rdcc_nelmts + * IN/OUT: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN/OUT: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN/OUT: Preemption policy. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + **/ + public synchronized static native int H5Pget_cache(long plist, int[] mdc_nelmts, long[] rdcc_nelmts, + long[] rdcc_nbytes, double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in the + * raw data chunk cache. + * + * @param plist + * IN: Identifier of the file access property list. + * @param mdc_nelmts + * IN: No longer used, will be ignored. + * @param rdcc_nelmts + * IN: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN: Preemption policy. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_cache(long plist, int mdc_nelmts, long rdcc_nelmts, long rdcc_nbytes, + double rdcc_w0) throws HDF5LibraryException; + + /** + * H5Pget_mdc_config gets the initial metadata cache configuration contained in a file access property list and + * loads it into the instance of H5AC_cache_config_t pointed to by the config_ptr parameter. This configuration is + * used when the file is opened. + * + * @param plist_id + * IN: Identifier of the file access property list. + * + * @return A buffer(H5AC_cache_config_t) for the current metadata cache configuration information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5AC_cache_config_t H5Pget_mdc_config(long plist_id) throws HDF5LibraryException; + + public synchronized static native void H5Pset_mdc_config(long plist_id, H5AC_cache_config_t config_ptr) + throws HDF5LibraryException; + + /** + * H5Pget_gc_references Returns the current setting for the garbage collection refernces property from a file access + * property list. + * + * @param fapl_id + * IN File access property list + * + * @return GC is on (true) or off (false) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Pget_gc_references(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_gc_references Sets the flag for garbage collecting references for the file. Default value for garbage + * collecting references is off. + * + * @param fapl_id + * IN File access property list + * @param gc_ref + * IN set GC on (true) or off (false) + * + * @return non-negative if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_gc_references(long fapl_id, boolean gc_ref) + throws HDF5LibraryException; + + public synchronized static native int H5Pget_fclose_degree(long plist_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_fclose_degree(long plist, int degree) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_meta_block_size the current metadata block size setting. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return the minimum size, in bytes, of metadata block allocations. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_meta_block_size(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_meta_block_size sets the minimum metadata block size. + * + * @param fapl_id + * IN: File access property list identifier + * @param size + * IN: Minimum size, in bytes, of metadata block allocations. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_meta_block_size(long fapl_id, long size) throws HDF5LibraryException; + + public synchronized static native long H5Pget_sieve_buf_size(long fapl_id) throws HDF5LibraryException; + + public synchronized static native void H5Pset_sieve_buf_size(long fapl_id, long size) throws HDF5LibraryException; + + /** + * H5Pget_small_data_block_size retrieves the size of a block of small data in a file creation property list. + * + * @param plist + * IN: Identifier for property list to query. + * + * @return a non-negative value and the size of the user block; if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Pget_small_data_block_size(long plist) throws HDF5LibraryException; + + /** + * H5Pset_small_data_block_size reserves blocks of size bytes for the contiguous storage of the raw data portion of + * small datasets. + * + * @param plist + * IN: Identifier of property list to modify. + * @param size + * IN: Size of the blocks in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_small_data_block_size(long plist, long size) + throws HDF5LibraryException; + + /** + * H5Pget_libver_bounds retrieves the lower and upper bounds on the HDF5 Library versions that indirectly determine + * the object formats versions used when creating objects in the file. + * + * @param fapl_id + * IN: File access property list identifier + * @param libver + * The earliest/latest version of the library that will be used for writing objects. + * + *
+     *      libver[0] =  The earliest version of the library that will be used for writing objects
+     *      libver[1] =  The latest version of the library that will be used for writing objects.
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_libver_bounds(long fapl_id, int[] libver) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_libver_bounds Sets bounds on library versions, and indirectly format versions, to be used when creating + * objects + * + * @param fapl_id + * IN: File access property list identifier + * @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. + * + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Argument is Illegal + * + **/ + public synchronized static native int H5Pset_libver_bounds(long fapl_id, int low, int high) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_elink_file_cache_size retrieves the size of the external link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return External link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_elink_file_cache_size(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_file_cache_size sets the number of files that can be held open in an external link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * @param efc_size + * IN: External link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_elink_file_cache_size(long fapl_id, int efc_size) + throws HDF5LibraryException; + + // Dataset creation property list (DCPL) routines // + + /** + * H5Pget_layout returns the layout of the raw data for a dataset. + * + * @param plist + * IN: Identifier for property list to query. + * + * @return the layout type of a dataset creation property list if successful. Otherwise returns H5D_LAYOUT_ERROR + * (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_layout(long plist) throws HDF5LibraryException; + + /** + * H5Pset_layout sets the type of storage used store the raw data for a dataset. + * + * @param plist + * IN: Identifier of property list to query. + * @param layout + * IN: Type of storage layout for raw data. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_layout(long plist, int layout) throws HDF5LibraryException; + + /** + * H5Pget_chunk retrieves the size of chunks for the raw data of a chunked layout dataset. + * + * @param plist + * IN: Identifier of property list to query. + * @param max_ndims + * IN: Size of the dims array. + * @param dims + * OUT: Array to store the chunk dimensions. + * + * @return chunk dimensionality successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims array is null. + * @exception IllegalArgumentException + * - max_ndims <=0 + **/ + public synchronized static native int H5Pget_chunk(long plist, int max_ndims, long[] dims) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Pset_chunk sets the size of the chunks used to store a chunked layout dataset. + * + * @param plist + * IN: Identifier for property list to query. + * @param ndims + * IN: The number of dimensions of each chunk. + * @param dim + * IN: An array containing the size of each chunk. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims array is null. + * @exception IllegalArgumentException + * - dims <=0 + **/ + public synchronized static native int H5Pset_chunk(long plist, int ndims, byte[] dim) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + public synchronized static int H5Pset_chunk(long plist, int ndims, long[] dim) throws HDF5Exception, + NullPointerException, IllegalArgumentException { + if (dim == null) { + return -1; + } + + HDFArray theArray = new HDFArray(dim); + byte[] thedims = theArray.byteify(); + + int retVal = H5Pset_chunk(plist, ndims, thedims); + + thedims = null; + theArray = null; + return retVal; + } + + /** + * H5Pset_virtual maps elements of the virtual dataset (VDS) described by the + * virtual dataspace identifier vspace_id to the elements of the source dataset + * described by the source dataset dataspace identifier src_space_id. The source + * dataset is identified by the name of the file where it is located, src_file_name, + * and the name of the dataset, src_dset_name. + * + * @param dcpl_id + * IN: The identifier of the dataset creation property list that will be used when creating the virtual dataset. + * @param vspace_id + * IN: The dataspace identifier with the selection within the virtual dataset applied, possibly an unlimited selection. + * @param src_file_name + * IN: The name of the HDF5 file where the source dataset is located. The file might not exist yet. The name can be specified using a C-style printf statement. + * @param src_dset_name + * IN: The path to the HDF5 dataset in the file specified by src_file_name. The dataset might not exist yet. The dataset name can be specified using a C-style printf statement. + * @param src_space_id + * IN: The source dataset dataspace identifier with a selection applied, possibly an unlimited selection. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an name string is null. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native void H5Pset_virtual(long dcpl_id, long vspace_id, String src_file_name, String src_dset_name, long src_space_id) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pget_virtual_count gets the number of mappings for a virtual dataset that has the creation property list specified by dcpl_id. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * + * @return a non-negative number of mappings if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_count(long dcpl_id) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_vspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, + * and returns a dataspace identifier for the selection within the virtual dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return a valid dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_vspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_srcspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, + * and returns a dataspace identifier for the selection within the source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return a valid dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_srcspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_filename takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, + * the size of the filename for a source dataset, size, and retrieves the name of the file for a source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return the name of the file containing the source dataset if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native String H5Pget_virtual_filename(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_dsetname takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, the + * size of the dataset name for a source dataset, size, and retrieves the name of the source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return the name of the source dataset if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_external returns information about an external file. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * @param idx + * IN: External file index. + * @param name_size + * IN: Maximum length of name array. + * @param name + * OUT: Name of the external file. + * @param size + * OUT: the offset value and the size of the external file data. + * + *
+     *      size[0] = offset // a location to return an offset value
+     *      size[1] = size // a location to return the size of
+     *                // the external file data.
+     * 
+ * + * @return a non-negative value if successful + * + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or size is null. + * @exception IllegalArgumentException + * - name_size <= 0 . + * + **/ + public synchronized static native int H5Pget_external(long plist, int idx, long name_size, String[] name, + long[] size) throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_external adds an external file to the list of external files. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * @param name + * IN: Name of an external file. + * @param offset + * IN: Offset, in bytes, from the beginning of the file to the location in the file where the data + * starts. + * @param size + * IN: Number of bytes reserved in the file for the data. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Pset_external(long plist, String name, long offset, long size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_external_count returns the number of external files for the specified dataset. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * + * @return the number of external files if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_external_count(long plist) throws HDF5LibraryException; + + public synchronized static native int H5Pset_szip(long plist, int options_mask, int pixels_per_block) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_shuffle(long plist_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_nbit Sets up the use of the N-Bit filter. + * + * @param plist_id + * IN: Dataset creation property list identifier. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_nbit(long plist_id) throws HDF5LibraryException; + + /** + * H5Pset_scaleoffset sets the Scale-Offset filter for a dataset. + * + * @param plist_id + * IN: Dataset creation property list identifier. + * @param scale_type + * IN: Flag indicating compression method. + * @param scale_factor + * IN: Parameter related to scale. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid arguments + * + **/ + public synchronized static native int H5Pset_scaleoffset(long plist_id, int scale_type, int scale_factor) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_fill_value queries the fill value property of a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param value + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array. + **/ + public synchronized static native int H5Pget_fill_value(long plist_id, long type_id, byte[] value) + throws HDF5Exception; + + /** + * H5Pget_fill_value queries the fill value property of a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param obj + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array. + **/ + public synchronized static int H5Pget_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + + int status = H5Pget_fill_value(plist_id, type_id, buf); + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + return status; + } + + /** + * H5Pset_fill_value sets the fill value for a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param value + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array + **/ + public synchronized static native int H5Pset_fill_value(long plist_id, long type_id, byte[] value) + throws HDF5Exception; + + /** + * H5Pset_fill_value sets the fill value for a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param obj + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array + **/ + public synchronized static int H5Pset_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + int retVal = H5Pset_fill_value(plist_id, type_id, buf); + + buf = null; + theArray = null; + return retVal; + } + + public synchronized static native int H5Pfill_value_defined(long plist_id, int[] status) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pget_alloc_time(long plist_id, int[] alloc_time) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_alloc_time(long plist_id, int alloc_time) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pget_fill_time(long plist_id, int[] fill_time) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, + NullPointerException; + + // 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 + * and the RDCC_W0 value in the raw data chunk cache on a per-datset basis. + * + * @param dapl_id + * IN: Identifier of the dataset access property list. + * @param rdcc_nslots + * IN/OUT: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN/OUT: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN/OUT: Preemption policy. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + **/ + public synchronized static native void H5Pget_chunk_cache(long dapl_id, long[] rdcc_nslots, long[] rdcc_nbytes, + double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_chunk_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in + * the raw data chunk cache on a per-datset basis. + * + * @param dapl_id + * IN: Identifier of the datset access property list. + * @param rdcc_nslots + * IN: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN: Preemption policy. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Pset_chunk_cache(long dapl_id, long rdcc_nslots, long rdcc_nbytes, + double rdcc_w0) throws HDF5LibraryException; + + /** + * H5Pset_virtual_view takes the access property list for the virtual dataset, dapl_id, and the flag, + * view, and sets the VDS view according to the flag value. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + * @param view + * IN: Flag specifying the extent of the data to be included in the view. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_virtual_view(long dapl_id, int view) throws HDF5LibraryException; + + /** + * H5Pget_virtual_view takes the virtual dataset access property list, dapl_id, and retrieves the flag, + * view, set by the H5Pset_virtual_view call. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + + * @return The flag specifying the view of the virtual dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native int H5Pget_virtual_view(long dapl_id) throws HDF5LibraryException; + + /** + * H5Pset_virtual_printf_gap sets the access property list for the virtual dataset, dapl_id, to instruct the + * library to stop looking for the mapped data stored in the files and/or datasets with the printf-style names + * after not finding gap_size files and/or datasets. The found source files and datasets will determine the + * extent of the unlimited virtual dataset with the printf-style mappings. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + * @param gap_size + * IN: Maximum number of files and/or datasets allowed to be missing for determining + * the extent of an unlimited virtual dataset with printf-style mappings. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_virtual_printf_gap(long dapl_id, long gap_size) throws HDF5LibraryException; + + /** + * H5Pget_virtual_printf_gap returns the maximum number of missing printf-style files and/or datasets for + * determining the extent of an unlimited virtual dataaset, gap_size, using the access property list for + * the virtual dataset, dapl_id. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + + * @return Maximum number of files and/or datasets allowed to be missing for determining + * the extent of an unlimited virtual dataset with printf-style mappings. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; + + // Dataset xfer property list (DXPL) routines // + + /** + * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property + * list plist_id by H5Pset_data_transform. + * + * @param plist_id + * IN: Identifier of the property list or class + * @param size + * IN: Number of bytes of the transform expression to copy to + * @param expression + * OUT: A data transform expression + * + * @return The size of the transform expression if successful; 0(zero) if no transform expression exists. Otherwise + * returns a negative value. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Size is <= 0. + * + **/ + public synchronized static native long H5Pget_data_transform(long plist_id, String[] expression, long size) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_data_transform sets a data transform expression + * + * @param plist_id + * IN: Identifier of the property list or class + * @param expression + * IN: Pointer to the null-terminated data transform expression + * + * @return a non-negative valule if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - expression is null. + * + **/ + public synchronized static native int H5Pset_data_transform(long plist_id, String expression) + throws HDF5LibraryException, NullPointerException; + + /** + * HH5Pget_buffer gets type conversion and background buffers. Returns buffer size, in bytes, if successful; + * otherwise 0 on failure. + * + * @param plist + * Identifier for the dataset transfer property list. + * @param tconv + * byte array of application-allocated type conversion buffer. + * @param bkg + * byte array of application-allocated background buffer. + * + * @return buffer size, in bytes, if successful; otherwise 0 on failure + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - plist is invalid. + **/ + public synchronized static native int H5Pget_buffer(long plist, byte[] tconv, byte[] bkg) + throws HDF5LibraryException, IllegalArgumentException; + + public synchronized static native long H5Pget_buffer_size(long plist) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_buffer sets type conversion and background buffers. status to TRUE or FALSE. + * + * Given a dataset transfer property list, H5Pset_buffer sets the maximum size for the type conversion buffer and + * background buffer and optionally supplies pointers to application-allocated buffers. If the buffer size is + * smaller than the entire amount of data being transferred between the application and the file, and a type + * conversion buffer or background buffer is required, then strip mining will be used. + * + * Note that there are minimum size requirements for the buffer. Strip mining can only break the data up along the + * first dimension, so the buffer must be large enough to accommodate a complete slice that encompasses all of the + * remaining dimensions. For example, when strip mining a 100x200x300 hyperslab of a simple data space, the buffer + * must be large enough to hold 1x200x300 data elements. When strip mining a 100x200x300x150 hyperslab of a simple + * data space, the buffer must be large enough to hold 1x200x300x150 data elements. + * + * @param plist + * Identifier for the dataset transfer property list. + * @param size + * Size, in bytes, of the type conversion and background buffers. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - plist is invalid. + **/ + public synchronized static native void H5Pset_buffer_size(long plist, long size) throws HDF5LibraryException, + IllegalArgumentException; + + public synchronized static native int H5Pget_edc_check(long plist) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_edc_check(long plist, int check) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_btree_ratio Get the B-tree split ratios for a dataset transfer property list. + * + * @param plist_id + * IN Dataset transfer property list + * @param left + * OUT split ratio for leftmost nodes + * @param right + * OUT split ratio for righttmost nodes + * @param middle + * OUT split ratio for all other nodes + * + * @return non-negative if succeed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an input array is null. + **/ + public synchronized static native int H5Pget_btree_ratios(long plist_id, double[] left, double[] middle, + double[] right) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_btree_ratio Sets B-tree split ratios for a dataset transfer property list. The split ratios determine what + * percent of children go in the first node when a node splits. + * + * @param plist_id + * IN Dataset transfer property list + * @param left + * IN split ratio for leftmost nodes + * @param right + * IN split ratio for righttmost nodes + * @param middle + * IN split ratio for all other nodes + * + * @return non-negative if succeed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_btree_ratios(long plist_id, double left, double middle, double right) + throws HDF5LibraryException; + + public synchronized static native int H5Pget_hyper_vector_size(long dxpl_id, long[] vector_size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) + throws HDF5LibraryException, NullPointerException; + + // Link creation property list (LCPL) routines // + + /** + * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate + * groups. + * + * @param lcpl_id + * IN: Link creation property list identifier + * + * @return Boolean true or false + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_create_intermediate_group(long lcpl_id) + throws HDF5LibraryException; + + /** + * H5Pset_create_intermediate_group specifies in property list whether to create missing intermediate groups + * + * @param lcpl_id + * IN: Link creation property list identifier + * @param crt_intermed_group + * IN: Flag specifying whether to create intermediate groups upon the creation of an object + * + * @return a non-negative valule if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) + throws HDF5LibraryException; + + // Group creation property list (GCPL) routines // + + /** + * H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * + * @return size_hint, the anticipated size of local heap + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_local_heap_size_hint(long gcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_local_heap_size_hint Specifies the anticipated maximum size of a local heap. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param size_hint + * IN: Anticipated maximum size in bytes of local heap + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_local_heap_size_hint(long gcpl_id, long size_hint) + throws HDF5LibraryException; + + /** + * H5Pget_link_phase_change Queries the settings for conversion between compact and dense groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param links + * The max. no. of compact links & the min. no. of dense links, which are used for storing groups + * + *
+     *      links[0] =  The maximum number of links for compact storage
+     *      links[1] =  The minimum number of links for dense storage
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_link_phase_change(long gcpl_id, int[] links) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_link_phase_change Sets the parameters for conversion between compact and dense groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param max_compact + * IN: Maximum number of links for compact storage(Default: 8) + * @param min_dense + * IN: Minimum number of links for dense storage(Default: 6) + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_compact and min_dense. + * + **/ + public synchronized static native int H5Pset_link_phase_change(long gcpl_id, int max_compact, int min_dense) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_est_link_info Queries data required to estimate required local heap or object header size. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param link_info + * Estimated number of links to be inserted into group And the estimated average length of link names + * + *
+     *      link_info[0] =  Estimated number of links to be inserted into group
+     *      link_info[1] =  Estimated average length of link names
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - link_info is null. + * + **/ + public synchronized static native int H5Pget_est_link_info(long gcpl_id, int[] link_info) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_est_link_info Sets estimated number of links and length of link names in a group. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param est_num_entries + * IN: Estimated number of links to be inserted into group + * @param est_name_len + * IN: Estimated average length of link names + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values to est_num_entries and est_name_len. + * + **/ + public synchronized static native int H5Pset_est_link_info(long gcpl_id, int est_num_entries, int est_name_len) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_link_creation_order queries the group creation property list, gcpl_id, and returns a flag indicating + * whether link creation order is tracked and/or indexed in a group. + * + * @param gcpl_id + * IN: Group creation property list identifier + * + * @return crt_order_flags -Creation order flag(s) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_link_creation_order(long gcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_link_creation_order Sets flags in a group creation property list, gcpl_id, for tracking and/or indexing + * links on creation order. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param crt_order_flags + * IN: Creation order flag(s) + * + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) + throws HDF5LibraryException; + + // 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 // + + /** + * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the + * library assumes it has found a cycle and aborts the traversal. This value is retrieved from the link access + * property list lapl_id. + * + * @param lapl_id + * IN: File access property list identifier + * + * @return Returns a Maximum number of links to traverse. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_nlinks(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_nlinks sets the maximum number of soft or user-defined link traversals allowed, nlinks, before the library + * assumes it has found a cycle and aborts the traversal. This value is set in the link access property list + * lapl_id. + * + * @param lapl_id + * IN: File access property list identifier + * @param nlinks + * IN: Maximum number of links to traverse + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Argument is Illegal + * + **/ + public synchronized static native int H5Pset_nlinks(long lapl_id, long nlinks) throws HDF5LibraryException, + IllegalArgumentException; + + /** + * H5Pget_elink_prefix Retrieves prefix applied to external link paths. + * + * @param lapl_id + * IN: Link access property list identifier + * @param prefix + * OUT: Prefix applied to external link paths + * + * @return If successful, returns a non-negative value specifying the size in bytes of the prefix without the NULL + * terminator; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native long H5Pget_elink_prefix(long lapl_id, String[] prefix) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_elink_prefix Sets prefix to be applied to external link paths. + * + * @param lapl_id + * IN: Link access property list identifier + * @param prefix + * IN: Prefix to be applied to external link paths + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native int H5Pset_elink_prefix(long lapl_id, String prefix) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_elink_fapl Retrieves the file access property list identifier associated with the link access property + * list. + * + * @param lapl_id + * IN: Link access property list identifier + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public static long H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException { + long id = _H5Pget_elink_fapl(lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Pget_elink_fapl add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_fapl sets a file access property list for use in accessing a file pointed to by an external link. + * + * @param lapl_id + * IN: Link access property list identifier + * @param fapl_id + * IN: File access property list identifier + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_elink_fapl(long lapl_id, long fapl_id) throws HDF5LibraryException; + + /** + * H5Pget_elink_acc_flags retrieves the external link traversal file access flag from the specified link access + * property list. + * + * @param lapl_id + * IN: Link access property list identifier + * + * @return File access flag for link traversal. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_elink_acc_flags(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_acc_flags Sets the external link traversal file access flag in a link access property list. + * + * @param lapl_id + * IN: Link access property list identifier + * @param flags + * IN: The access flag for external link traversal. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid Flag values. + * + **/ + public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, + IllegalArgumentException; + + // Object copy property list (OCPYPL) routines // + + /** + * H5Pget_copy_object retrieves the properties to be used when an object is copied. + * + * @param ocp_plist_id + * IN: Object copy property list identifier + * + * @return Copy option(s) set in the object copy property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_copy_object(long ocp_plist_id) throws HDF5LibraryException; + + /** + * H5Pset_copy_object Sets properties to be used when an object is copied. + * + * @param ocp_plist_id + * IN: Object copy property list identifier + * @param copy_options + * IN: Copy option(s) to be set + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) + throws HDF5LibraryException; + + // Other/Older property list routines // + + /** + * H5Pget_version retrieves the version information of various objects for a file creation property list. + * + * @param plist + * IN: Identifier of the file creation property list. + * @param version_info + * OUT: version information. + * + *
+     *      version_info[0] = boot  // boot block version number
+     *      version_info[1] = freelist  // global freelist version
+     *      version_info[2] = stab  // symbol tabl version number
+     *      version_info[3] = shhdr  // shared object header version
+     * 
+ * @return a non-negative value, with the values of version_info initialized, if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - version_info is null. + * @exception IllegalArgumentException + * - version_info is illegal. + **/ + public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + // file drivers property list routines // + + public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_core(long fapl_id, long increment, boolean backing_store) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_fapl_direct Retrieve direct I/O settings. + * + * @param fapl_id + * IN: File access property list identifier + * @param info + * OUT: Returned property list information info[0] = alignment Required memory alignment boundary info[1] + * = block_size File system block size info[2] = cbuf_size Copy buffer size + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_fapl_direct(long fapl_id, long[] info) throws HDF5LibraryException; + + /** + * H5Pset_fapl_direct Sets up use of the direct I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param alignment + * IN: Required memory alignment boundary + * @param block_size + * IN: File system block size + * @param cbuf_size + * IN: Copy buffer size + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_fapl_direct(long fapl_id, long alignment, long block_size, + long cbuf_size) throws HDF5LibraryException; + + public synchronized static native int H5Pget_fapl_family(long fapl_id, long[] memb_size, long[] memb_fapl_id) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_family(long fapl_id, long memb_size, long memb_fapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_fapl_multi Sets up use of the multi I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param memb_map + * IN: Maps memory usage types to other memory usage types. + * @param memb_fapl + * IN: Property list for each memory usage type. + * @param memb_name + * IN: Name generator for names of member files. + * @param memb_addr + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of + * data storage begins. + * + * @return a boolean value; Allows read-only access to incomplete file sets when TRUE. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + * + **/ + public synchronized static native boolean H5Pget_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, + String[] memb_name, long[] memb_addr) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_fapl_multi Sets up use of the multi I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param memb_map + * IN: Maps memory usage types to other memory usage types. + * @param memb_fapl + * IN: Property list for each memory usage type. + * @param memb_name + * IN: Name generator for names of member files. + * @param memb_addr + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of + * data storage begins. + * @param relax + * IN: Allows read-only access to incomplete file sets when TRUE. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + * + **/ + public synchronized static native void H5Pset_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, + String[] memb_name, long[] memb_addr, boolean relax) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Pset_fapl_log Sets up the logging virtual file driver (H5FD_LOG) for use. H5Pset_fapl_log modifies the file + * access property list to use the logging driver, H5FD_LOG. The logging virtual file driver (VFD) is a clone of the + * standard SEC2 (H5FD_SEC2) driver with additional facilities for logging VFD metrics and activity to a file. + * + * @param fapl_id + * IN: File access property list identifier. + * @param logfile + * IN: logfile is the name of the file in which the logging entries are to be recorded. + * @param flags + * IN: Flags specifying the types of logging activity. + * @param buf_size + * IN: The size of the logging buffers, in bytes. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - logfile is null. + **/ + public synchronized static native void H5Pset_fapl_log(long fapl_id, String logfile, long flags, long buf_size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_sec2(long fapl_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native void H5Pset_fapl_split(long fapl_id, String meta_ext, long meta_plist_id, + String raw_ext, long raw_plist_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_stdio(long fapl_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_windows(long fapl_id) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + + // Generic property list routines // + // herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc); + // hid_t H5Pdecode(const void *buf); + + // Object creation property list (OCPL) routines // + + // 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 ) + // 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); + + // Dataset creation property list (DCPL) routines // + + // Dataset access property list (DAPL) routines // + + // Dataset xfer property list (DXPL) routines // + // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); + // herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); + // int H5Pget_preserve(hid_t plist_id); + // herr_t H5Pset_filter_callback(hid_t plist, H5Z_filter_func_t func, void *op_data) + // herr_t H5Pget_vlen_mem_manager(hid_t plist, H5MM_allocate_t *alloc, void **alloc_info, H5MM_free_t *free, void + // **free_info ) + // herr_t H5Pset_vlen_mem_manager(hid_t plist, H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void + // *free_info ) + // herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) + // herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data) + + // Link creation property list (LCPL) routines // + + // Group creation property list (GCPL) routines // + + // String creation property list (STRCPL) routines // + + // Link access property list (LAPL) routines // + // herr_t H5Pget_elink_cb( hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data ) + // herr_t H5Pset_elink_cb( hid_t lapl_id, H5L_elink_traverse_t func, void *op_data ) + + // Object copy property list (OCPYPL) routines // + // herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path); + // herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id); + // herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data); + // herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data); + + + // Other/Older property list routines // + // herr_t H5Pget_fapl_mpio( int fapl_id, MPI_Comm *comm, MPI_Info *info ) + // herr_t H5Pset_fapl_mpio( int fapl_id, MPI_Comm comm, MPI_Info info ) + + // herr_t H5Pget_fapl_mpiposix( int fapl_id, MPI_Comm *comm, hbool_t *use_gpfs_hints ) + // herr_t H5Pset_fapl_mpiposix( int fapl_id, MPI_Comm comm, hbool_t use_gpfs_hints ) + + // herr_t H5Pget_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode ) + // herr_t H5Pset_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode ) + // herr_t H5Pset_dxpl_mpio_chunk_opt (hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) + // herr_t H5Pset_dxpl_mpio_chunk_opt_num (hid_t dxpl_id, unsigned num_chunk_per_proc) + // herr_t H5Pset_dxpl_mpio_chunk_opt_ratio (hid_t dxpl_id, unsigned percent_proc_per_chunk) + // herr_t H5Pset_dxpl_mpio_collective_opt (hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode) + + // //////////////////////////////////////////////////////////// + // // + // H5PL: HDF5 1.8 Plugin API Functions // + // // + // //////////////////////////////////////////////////////////// + /** + * H5PLset_loading_state uses one argument to enable or disable individual plugins. + * The plugin_flags parameter is an encoded integer in which each bit controls a specific + * plugin or class of plugins. + * A plugin bit set to 0 (zero) prevents the use of the dynamic plugin corresponding + * to that bit position. A plugin bit set to 1 (one) allows the use of that dynamic plugin. + * All dynamic plugins can be enabled by setting plugin_flags to a negative value. + * A value of 0 (zero) will disable all dynamic plugins. + * + * H5PLset_loading_state inspects the HDF5_PLUGIN_PRELOAD environment variable every + * time it is called. If the environment variable is set to the special :: string, + * all dynamic plugins will be disabled. + * + * @param plugin_flags + * IN: The list of dynamic plugin types to enable or disable. + * A plugin bit set to 0 (zero) prevents use of that dynamic plugin. + * A plugin bit set to 1 (one) enables use of that dynamic plugin. + * Setting plugin_flags to a negative value enables all dynamic plugins. + * Setting plugin_flags to 0 (zero) disables all dynamic plugins. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5PLset_loading_state(int plugin_flags) throws HDF5LibraryException; + + /** + * H5PLget_loading_state retrieves the state of the dynamic plugins flag, plugin_flags.. + * + * @return the list of dynamic plugin types that are enabled or disabled. + * A plugin bit set to 0 (zero) indicates that that dynamic plugin is disabled. + * A plugin bit set to 1 (one) indicates that that dynamic plugin is enabled. + * If the value of plugin_flags is negative, all dynamic plugins are enabled. + * If the value of plugin_flags is 0 (zero), all dynamic plugins are disabled. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5PLget_loading_state() throws HDF5LibraryException; + + // //////////////////////////////////////////////////////////// + // // + // H5R: HDF5 1.8 Reference API Functions // + // // + // //////////////////////////////////////////////////////////// + + private synchronized static native int H5Rcreate(byte[] ref, long loc_id, String name, int ref_type, long space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rcreate creates the reference, ref, of the type specified in ref_type, pointing to the object 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 ref_type + * IN: Type of reference. + * @param space_id + * IN: Dataspace identifier with selection. + * + * @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 byte[] H5Rcreate(long loc_id, String name, int ref_type, long space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + /* These sizes are correct for HDF5.1.2 */ + int ref_size = 8; + if (ref_type == HDF5Constants.H5R_DATASET_REGION) { + ref_size = 12; + } + byte rbuf[] = new byte[ref_size]; + + /* will raise an exception if fails */ + H5Rcreate(rbuf, loc_id, name, ref_type, space_id); + + return rbuf; + } + + /** + * Given a reference to some object, H5Rdereference opens that object and return an identifier. + * + * @param dataset + * IN: Dataset containing reference object. + * @param access_list + * IN: Property list of the object being referenced. + * @param ref_type + * IN: The reference type of ref. + * @param ref + * IN: reference to an object + * + * @return valid identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - output array is null. + * @exception IllegalArgumentException + * - output array is invalid. + **/ + public static long H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + long id = _H5Rdereference(dataset, access_list, ref_type, ref); + if (id > 0) { + log.trace("OPEN_IDS: H5Rdereference add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_name retrieves a name for the object identified by ref. + * + * @param loc_id + * IN: Identifier for the dataset containing the reference or for the group that dataset is in. + * @param ref_type + * IN: Type of reference. + * @param ref + * IN: An object or dataset region reference. + * @param name + * OUT: A name associated with the referenced object or dataset region. + * @param size + * IN: The size of the name buffer. + * + * @return Returns the length of the name if successful, returning 0 (zero) if no name is associated with the + * identifier. Otherwise returns a negative value. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - Argument is illegal. + * + **/ + public synchronized static native long H5Rget_name(long loc_id, int ref_type, byte[] ref, String[] name, long size) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_obj_type Given a reference to an object ref, H5Rget_obj_type returns the type of the object pointed to. + * + * @param loc_id + * IN: loc_id of the reference object. + * @param ref_type + * IN: Type of reference to query. + * @param ref + * IN: the reference + * + * @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_type(long loc_id, int ref_type, byte ref[]) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_obj_type2 Retrieves the type of object that an object reference points to. + * + * @see public static int H5Rget_obj_type(int loc_id, int ref_type, byte ref[]) + **/ + private synchronized static native int H5Rget_obj_type2(long loc_id, int ref_type, byte ref[], int[] obj_type) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * Given a reference to an object ref, H5Rget_region creates a copy of the dataspace of the dataset pointed to and + * defines a selection in the copy which is the region pointed to. + * + * @param loc_id + * IN: loc_id of the reference object. + * @param ref_type + * IN: The reference type of ref. + * @param ref + * OUT: the reference to the object and region + * + * @return a valid identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - output array is null. + * @exception IllegalArgumentException + * - output array is invalid. + **/ + public static long H5Rget_region(long loc_id, int ref_type, byte[] ref) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException { + long id = _H5Rget_region(loc_id, ref_type, ref); + if (id > 0) { + log.trace("OPEN_IDS: H5Rget_region add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Rget_region(long loc_id, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + // //////////////////////////////////////////////////////////// + // // + // H5S: Dataspace Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Sclose releases a dataspace. + * + * @param space_id + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Sclose(long space_id) throws HDF5LibraryException { + if (space_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Sclose remove {}", space_id); + OPEN_IDS.remove(space_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Sclose(space_id); + } + + private synchronized static native int _H5Sclose(long space_id) throws HDF5LibraryException; + + /** + * H5Scopy creates a new dataspace which is an exact copy of the dataspace identified by space_id. + * + * @param space_id + * Identifier of dataspace to copy. + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Scopy(long space_id) throws HDF5LibraryException { + long id = _H5Scopy(space_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Scopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Scopy(long space_id) throws HDF5LibraryException; + + /** + * H5Screate creates a new dataspace of a particular type. + * + * @param type + * IN: The type of dataspace to be created. + * + * @return a dataspace identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Screate(int type) throws HDF5LibraryException { + long id = _H5Screate(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Screate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Screate(int type) throws HDF5LibraryException; + + /** + * H5Screate_simple creates a new simple data space and opens it for access. + * + * @param rank + * IN: Number of dimensions of dataspace. + * @param dims + * IN: An array of the size of each dimension. + * @param maxdims + * IN: An array of the maximum size of each dimension. + * + * @return a dataspace identifier + * + * @exception HDF5Exception + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims or maxdims is null. + **/ + public static long H5Screate_simple(int rank, long[] dims, long[] maxdims) throws HDF5Exception, + NullPointerException { + long id = _H5Screate_simple(rank, dims, maxdims); + if (id > 0) { + log.trace("OPEN_IDS: H5Screate_simple add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Screate_simple(int rank, long[] dims, long[] maxdims) + throws HDF5Exception, NullPointerException; + + /** + * H5Sdecode reconstructs the HDF5 data space object and returns a new object handle for it. + * + * @param buf + * IN: Buffer for the data space object to be decoded. + * + * @return a new object handle + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native long H5Sdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sencode converts a data space description into binary form in a buffer. + * + * @param obj_id + * IN: Identifier of the object to be encoded. + * + * @return the buffer for the object to be encoded into. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native byte[] H5Sencode(long obj_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sextent_copy copies the extent from source_space_id to dest_space_id. This action may change the type of the + * dataspace. + * + * @param dest_space_id + * IN: The identifier for the dataspace from which the extent is copied. + * @param source_space_id + * IN: The identifier for the dataspace to which the extent is copied. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sextent_copy(long dest_space_id, long source_space_id) + throws HDF5LibraryException; + + /** + * H5Sextent_equal determines whether the dataspace extents of two dataspaces, space1_id and space2_id, are equal. + * + * @param first_space_id + * IN: The identifier for the first dataspace. + * @param second_space_id + * IN: The identifier for the seconddataspace. + * + * @return true if successful, else false + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sextent_equal(long first_space_id, long second_space_id) + throws HDF5LibraryException; + + /** + * H5Sget_select_bounds retrieves the coordinates of the bounding box containing the current selection and places + * them into user-supplied buffers. + *

+ * The start and end buffers must be large enough to hold the dataspace rank number of coordinates. + * + * @param spaceid + * Identifier of dataspace to release. + * @param start + * coordinates of lowest corner of bounding box. + * @param end + * coordinates of highest corner of bounding box. + * + * @return a non-negative value if successful,with start and end initialized. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - start or end is null. + **/ + public synchronized static native int H5Sget_select_bounds(long spaceid, long[] start, long[] end) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_elem_npoints returns the number of element points in the current dataspace selection. + * + * @param spaceid + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_elem_npoints(long spaceid) throws HDF5LibraryException; + + /** + * H5Sget_select_elem_pointlist returns an array of of element points in the current dataspace selection. The point + * coordinates have the same dimensionality (rank) as the dataspace they are located within, one coordinate per + * point. + * + * @param spaceid + * Identifier of dataspace to release. + * @param startpoint + * first point to retrieve + * @param numpoints + * number of points to retrieve + * @param buf + * returns points startblock to startblock+num-1, each points is rank longs. + * + * @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 H5Sget_select_elem_pointlist(long spaceid, long startpoint, long numpoints, + long[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_hyper_blocklist returns an array of hyperslab blocks. The block coordinates have the same + * dimensionality (rank) as the dataspace they are located within. The list of blocks is formatted as follows: + * + *

+     *    <"start" coordinate>, immediately followed by
+     *    <"opposite" corner coordinate>, followed by
+     *   the next "start" and "opposite" coordinates,
+     *   etc.
+     *   until all of the selected blocks have been listed.
+     * 
+ * + * @param spaceid + * Identifier of dataspace to release. + * @param startblock + * first block to retrieve + * @param numblocks + * number of blocks to retrieve + * @param buf + * returns blocks startblock to startblock+num-1, each block is rank * 2 (corners) longs. + * + * @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 H5Sget_select_hyper_blocklist(long spaceid, long startblock, long numblocks, + long[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_hyper_nblocks returns the number of hyperslab blocks in the current dataspace selection. + * + * @param spaceid + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_hyper_nblocks(long spaceid) throws HDF5LibraryException; + + /** + * H5Sget_select_npoints determines the number of elements in the current selection of a dataspace. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * + * @return the number of elements in the selection if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_npoints(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_select_type retrieves the type of selection currently defined for the dataspace space_id. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * + * @return the dataspace selection type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_select_type(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_dims returns the size and maximum sizes of each dimension of a dataspace through the dims + * and maxdims parameters. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * @param dims + * OUT: Pointer to array to store the size of each dimension. + * @param maxdims + * OUT: Pointer to array to store the maximum size of each dimension. + * + * @return the number of dimensions in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims or maxdims is null. + **/ + public synchronized static native int H5Sget_simple_extent_dims(long space_id, long[] dims, long[] maxdims) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_simple_extent_ndims determines the dimensionality (or rank) of a dataspace. + * + * @param space_id + * IN: Identifier of the dataspace + * + * @return the number of dimensions in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_simple_extent_ndims(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_npoints determines the number of elements in a dataspace. + * + * @param space_id + * ID of the dataspace object to query + * @return the number of elements in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_simple_extent_npoints(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_type queries a dataspace to determine the current class of a dataspace. + * + * @param space_id + * Dataspace identifier. + * + * @return a dataspace class name if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_simple_extent_type(long space_id) throws HDF5LibraryException; + + /** + * H5Sis_simple determines whether a dataspace is a simple dataspace. + * + * @param space_id + * Identifier of the dataspace to query + * + * @return true if is a simple dataspace + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sis_simple(long space_id) throws HDF5LibraryException; + + /** + * H5Soffset_simple sets the offset of a simple dataspace space_id. + * + * @param space_id + * IN: The identifier for the dataspace object to reset. + * @param offset + * IN: The offset at which to position the selection. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - offset array is null. + **/ + public synchronized static native int H5Soffset_simple(long space_id, byte[] offset) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Soffset_simple(long space_id, long[] offset) throws HDF5Exception, + NullPointerException { + if (offset == null) { + return -1; + } + + HDFArray theArray = new HDFArray(offset); + byte[] theArr = theArray.byteify(); + + int retVal = H5Soffset_simple(space_id, theArr); + + theArr = null; + theArray = null; + return retVal; + } + + /** + * H5Sselect_all selects the entire extent of the dataspace space_id. + * + * @param space_id + * IN: The identifier of the dataspace to be selected. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sselect_all(long space_id) throws HDF5LibraryException; + + /** + * H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. + * + * @param space_id + * Identifier of the dataspace. + * @param op + * operator specifying how the new selection is combined. + * @param num_elements + * Number of elements to be selected. + * @param coord + * A 2-dimensional array specifying the coordinates of the elements. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + private synchronized static native int H5Sselect_elements(long space_id, int op, int num_elements, byte[] coord) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. + * + * @param space_id + * Identifier of the dataspace. + * @param op + * operator specifying how the new selection is combined. + * @param num_elements + * Number of elements to be selected. + * @param coord2D + * A 2-dimensional array specifying the coordinates of the elements. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error in the data conversion + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - cord array is + **/ + public synchronized static int H5Sselect_elements(long space_id, int op, int num_elements, long[][] coord2D) + throws HDF5Exception, HDF5LibraryException, NullPointerException { + if (coord2D == null) { + return -1; + } + + HDFArray theArray = new HDFArray(coord2D); + byte[] coord = theArray.byteify(); + + int retVal = H5Sselect_elements(space_id, op, num_elements, coord); + + coord = null; + theArray = null; + return retVal; + } + + /** + * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace specified + * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * + * @param space_id + * IN: Identifier of dataspace selection to modify + * @param op + * IN: Operation to perform on current selection. + * @param start + * IN: Offset of start of hyperslab + * @param stride + * IN: Hyperslab stride. + * @param count + * IN: Number of blocks included in hyperslab. + * @param block + * IN: Size of block in hyperslab. + * + * @return a non-negative value 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 int H5Sselect_hyperslab(long space_id, int op, byte[] start, byte[] stride, + byte[] count, byte[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + ByteBuffer startbb = ByteBuffer.wrap(start); + long[] lastart = (startbb.asLongBuffer()).array(); + ByteBuffer stridebb = ByteBuffer.wrap(stride); + long[] lastride = (stridebb.asLongBuffer()).array(); + ByteBuffer countbb = ByteBuffer.wrap(count); + long[] lacount = (countbb.asLongBuffer()).array(); + ByteBuffer blockbb = ByteBuffer.wrap(block); + long[] lablock = (blockbb.asLongBuffer()).array(); + + return H5Sselect_hyperslab(space_id, op, lastart, lastride, lacount, lablock); + } + + public synchronized static native int H5Sselect_hyperslab(long space_id, int op, long[] start, long[] stride, + long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Sselect_none resets the selection region for the dataspace space_id to include no elements. + * + * @param space_id + * IN: The identifier of the dataspace to be reset. + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sselect_none(long space_id) throws HDF5LibraryException; + + /** + * H5Sselect_valid verifies that the selection for the dataspace. + * + * @param space_id + * The identifier for the dataspace in which the selection is being reset. + * + * @return true if the selection is contained within the extent and FALSE if it is not or is an error. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sselect_valid(long space_id) throws HDF5LibraryException; + + /** + * H5Sset_extent_none removes the extent from a dataspace and sets the type to H5S_NONE. + * + * @param space_id + * The identifier for the dataspace from which the extent is to be removed. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sset_extent_none(long space_id) throws HDF5LibraryException; + + /** + * H5Sset_extent_simple sets or resets the size of an existing dataspace. + * + * @param space_id + * Dataspace identifier. + * @param rank + * Rank, or dimensionality, of the dataspace. + * @param current_size + * Array containing current size of dataspace. + * @param maximum_size + * Array containing maximum size of dataspace. + * + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sset_extent_simple(long space_id, int rank, long[] current_size, + long[] maximum_size) throws HDF5LibraryException, NullPointerException; + + public synchronized static long H5Sset_extent_simple(long space_id, int rank, byte[] current_size, + byte[] maximum_size) throws HDF5LibraryException, NullPointerException { + ByteBuffer csbb = ByteBuffer.wrap(current_size); + long[] lacs = (csbb.asLongBuffer()).array(); + ByteBuffer maxsbb = ByteBuffer.wrap(maximum_size); + long[] lamaxs = (maxsbb.asLongBuffer()).array(); + + return H5Sset_extent_simple(space_id, rank, lacs, lamaxs); + } + + /** + * H5Sget_regular_hyperslab determines if a hyperslab selection is regular for the dataspace specified + * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * + * @param space_id + * IN: Identifier of dataspace selection to modify + * @param start + * OUT: Offset of start of hyperslab + * @param stride + * OUT: Hyperslab stride. + * @param count + * OUT: Number of blocks included in hyperslab. + * @param block + * OUT: Size of block in hyperslab. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an output array is null. + * @exception IllegalArgumentException + * - an output array is invalid. + **/ + public synchronized static native void H5Sget_regular_hyperslab(long space_id, long[] start, long[] stride, long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Sis_regular_hyperslab retrieves a regular hyperslab selection for the dataspace specified + * by space_id. + * + * @param space_id + * IN: Identifier of dataspace selection to query + * + * @return a TRUE/FALSE for hyperslab selection if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sis_regular_hyperslab(long space_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + + + // //////////////////////////////////////////////////////////// + // // + // H5T: Datatype Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Tarray_create creates a new array datatype object. + * + * @param base_id + * IN: Datatype identifier for the array base datatype. + * @param ndims + * IN: Rank of the array. + * @param dim + * IN: Size of each array dimension. + * + * @return a valid datatype identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dim is null. + **/ + public static long H5Tarray_create(long base_id, int ndims, long[] dim) throws HDF5LibraryException, + NullPointerException { + long id = _H5Tarray_create2(base_id, ndims, dim); + if (id > 0) { + log.trace("OPEN_IDS: H5Tarray_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tarray_create2(long base_id, int ndims, long[] dim) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tclose releases a datatype. + * + * @param type_id + * IN: Identifier of datatype to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tclose(long type_id) throws HDF5LibraryException { + if (type_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Tclose remove {}", type_id); + OPEN_IDS.remove(type_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Tclose(type_id); + } + + private synchronized static native int _H5Tclose(long type_id) throws HDF5LibraryException; + + /** + * H5Tcommit saves a transient datatype as an immutable named datatype in a file. + * + * @param loc_id + * IN: Location identifier. + * @param name + * IN: Name given to committed datatype. + * @param type_id + * IN: Identifier of datatype to be committed. + * @param lcpl_id + * IN: Link creation property list. + * @param tcpl_id + * IN: Datatype creation property list. + * @param tapl_id + * IN: Datatype access property list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Tcommit(long loc_id, String name, long type_id, long lcpl_id, + long tcpl_id, long tapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Tcommit_anon commits a transient datatype (not immutable) to a file, turning it into a named datatype with the + * specified creation and property lists. + * + * @param loc_id + * IN: Location identifier. + * @param type_id + * IN: Identifier of datatype to be committed. + * @param tcpl_id + * IN: Datatype creation property list. + * @param tapl_id + * IN: Datatype access property list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tcommit_anon(long loc_id, long type_id, long tcpl_id, long tapl_id) + throws HDF5LibraryException; + + /** + * H5Tcommitted queries a type to determine whether the type specified by the type identifier is a named type or a + * transient type. + * + * @param type_id + * IN: Identifier of datatype. + * + * @return true the datatype has been committed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tcommitted(long type_id) throws HDF5LibraryException; + + /** + * H5Tcompiler_conv finds out whether the library's conversion function from type src_id to type dst_id is a + * compiler (hard) conversion. + * + * @param src_id + * IN: Identifier of source datatype. + * @param dst_id + * IN: Identifier of destination datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tcompiler_conv(long src_id, long dst_id) throws HDF5LibraryException; + + /** + ** H5Tconvert converts nelmts elements from the type specified by the src_id identifier to type dst_id. + * + * @param src_id + * IN: Identifier of source datatype. + * @param dst_id + * IN: Identifier of destination datatype. + * @param nelmts + * IN: Size of array buf. + * @param buf + * IN: Array containing pre- and post-conversion values. + * @param background + * IN: Optional background buffer. + * @param plist_id + * IN: Dataset transfer property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native void H5Tconvert(long src_id, long dst_id, long nelmts, byte[] buf, + byte[] background, long plist_id) throws HDF5LibraryException, NullPointerException; + + // int H5Tconvert(int src_id, int dst_id, long nelmts, Pointer buf, Pointer background, int plist_id); + + /** + * H5Tcopy copies an existing datatype. The returned type is always transient and unlocked. + * + * @param type_id + * IN: Identifier of datatype to copy. Can be a datatype identifier, a predefined datatype (defined in + * H5Tpublic.h), or a dataset Identifier. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tcopy(long type_id) throws HDF5LibraryException { + long id = _H5Tcopy(type_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tcopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tcopy(long type_id) throws HDF5LibraryException; + + /** + * H5Tcreate creates a new dataype of the specified class with the specified number of bytes. + * + * @param tclass + * IN: Class of datatype to create. + * @param size + * IN: The number of bytes in the datatype to create. + * + * @return datatype identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tcreate(int tclass, long size) throws HDF5LibraryException { + long id = _H5Tcreate(tclass, size); + if (id > 0) { + log.trace("OPEN_IDS: H5Tcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tcreate(int type, long size) throws HDF5LibraryException; + + /** + * H5Tdecode reconstructs the HDF5 data type object and returns a new object handle for it. + * + * @param buf + * IN: Buffer for the data type object to be decoded. + * + * @return a new object handle + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public static long H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException { + long id = _H5Tdecode(buf); + if (id > 0) { + log.trace("OPEN_IDS: H5Tdecode add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Tdetect_class determines whether the datatype specified in dtype_id contains any datatypes of the datatype + * class specified in dtype_class. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param cls + * IN: Identifier of datatype cls. + * + * @return true if the datatype specified in dtype_id contains any datatypes of the datatype class + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tdetect_class(long type_id, int cls) throws HDF5LibraryException; + + /** + * H5Tencode converts a data type description into binary form in a buffer. + * + * @param obj_id + * IN: Identifier of the object to be encoded. + * @param buf + * OUT: Buffer for the object to be encoded into. If the provided buffer is NULL, only the size of buffer + * needed is returned. + * @param nalloc + * IN: The size of the allocated buffer. + * + * @return the size needed for the allocated buffer. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Tencode(long obj_id, byte[] buf, long nalloc) throws HDF5LibraryException, + NullPointerException; + + // /** + // * H5Tencode converts a data type description into binary form in a buffer. + // * + // * @param obj_id IN: Identifier of the object to be encoded. + // * + // * @return the buffer for the object to be encoded into. + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // **/ + // public synchronized static native byte[] H5Tencode(int obj_id) + // throws HDF5LibraryException; + + /** + * H5Tenum_create creates a new enumeration datatype based on the specified base datatype, parent_id, which must be + * an integer type. + * + * @param base_id + * IN: Identifier of the parent datatype to release. + * + * @return the datatype identifier for the new enumeration datatype + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tenum_create(long base_id) throws HDF5LibraryException { + long id = _H5Tenum_create(base_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tenum_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tenum_create(long base_id) throws HDF5LibraryException; + + /** + * H5Tenum_insert inserts a new enumeration datatype member into an enumeration datatype. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * IN: The value of the member, data of the correct type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Tenum_insert(long type, String name, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_insert inserts a new enumeration datatype member into an enumeration datatype. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * IN: The value of the member, data of the correct type + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_insert(long type, String name, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_insert_int(type, name, value); + } + + public static int H5Tenum_insert(long type, String name, int value) throws HDF5LibraryException, + NullPointerException { + int[] val = { value }; + return H5Tenum_insert_int(type, name, val); + } + + private synchronized static native int H5Tenum_insert_int(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param value + * IN: The value of the member, data of the correct + * @param size + * IN: The probable length of the name + * + * @return the symbol name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public synchronized static native String H5Tenum_nameof(long type, byte[] value, long size) + throws HDF5LibraryException, NullPointerException; + + // int H5Tenum_nameof(int type, Pointer value, Buffer name/* out */, long size); + + /** + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param value + * IN: The value of the member, data of the correct + * @param name + * OUT: The name of the member + * @param size + * IN: The max length of the name + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_nameof(long type, int[] value, String[] name, int size) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_nameof_int(type, value, name, size); + } + + private synchronized static native int H5Tenum_nameof_int(long type, int[] value, String[] name, int size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tenum_valueof(long type, String name, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_valueof(long type, String name, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_valueof_int(type, name, value); + } + + private synchronized static native int H5Tenum_valueof_int(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tequal determines whether two datatype identifiers refer to the same datatype. + * + * @param type_id1 + * IN: Identifier of datatype to compare. + * @param type_id2 + * IN: Identifier of datatype to compare. + * + * @return true if the datatype identifiers refer to the same datatype, else false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tequal(long type_id1, long type_id2) throws HDF5LibraryException; + + /** + * H5Tget_array_dims returns the sizes of the dimensions of the specified array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * @param dims + * OUT: Sizes of array dimensions. + * + * @return the non-negative number of dimensions of the array type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims is null. + **/ + public static int H5Tget_array_dims(long type_id, long[] dims) throws HDF5LibraryException, NullPointerException { + return H5Tget_array_dims2(type_id, dims); + } + + /** + * H5Tget_array_dims2 returns the sizes of the dimensions of the specified array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * @param dims + * OUT: Sizes of array dimensions. + * + * @return the non-negative number of dimensions of the array type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims is null. + **/ + public synchronized static native int H5Tget_array_dims2(long type_id, long[] dims) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Tget_array_ndims returns the rank, the number of dimensions, of an array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * + * @return the rank of the array + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_array_ndims(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_class returns the datatype class identifier. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return datatype class identifier if successful; otherwise H5T_NO_CLASS(-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_class(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_class_name returns the datatype class identifier. + * + * @param class_id + * IN: Identifier of class from H5Tget_class. + * + * @return class name if successful; otherwise H5T_NO_CLASS. + * + **/ + public static String H5Tget_class_name(long class_id) { + String retValue = null; + if (HDF5Constants.H5T_INTEGER == class_id) /* integer types */ + retValue = "H5T_INTEGER"; + else if (HDF5Constants.H5T_FLOAT == class_id) /* floating-point types */ + retValue = "H5T_FLOAT"; + else if (HDF5Constants.H5T_TIME == class_id) /* date and time types */ + retValue = "H5T_TIME"; + else if (HDF5Constants.H5T_STRING == class_id) /* character string types */ + retValue = "H5T_STRING"; + else if (HDF5Constants.H5T_BITFIELD == class_id) /* bit field types */ + retValue = "H5T_BITFIELD"; + else if (HDF5Constants.H5T_OPAQUE == class_id) /* opaque types */ + retValue = "H5T_OPAQUE"; + else if (HDF5Constants.H5T_COMPOUND == class_id) /* compound types */ + retValue = "H5T_COMPOUND"; + else if (HDF5Constants.H5T_REFERENCE == class_id)/* reference types */ + retValue = "H5T_REFERENCE"; + else if (HDF5Constants.H5T_ENUM == class_id) /* enumeration types */ + retValue = "H5T_ENUM"; + else if (HDF5Constants.H5T_VLEN == class_id) /* Variable-Length types */ + retValue = "H5T_VLEN"; + else if (HDF5Constants.H5T_ARRAY == class_id) /* Array types */ + retValue = "H5T_ARRAY"; + else + retValue = "H5T_NO_CLASS"; + + return retValue; + } + + /** + * H5Tget_create_plist returns a property list identifier for the datatype creation property list associated with + * the datatype specified by type_id. + * + * @param type_id + * IN: Identifier of datatype. + * + * @return a datatype property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_create_plist(long type_id) throws HDF5LibraryException { + long id = _H5Tget_create_plist(type_id); + if (id > 0) { + log.trace("OPEN_IDS: _H5Tget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_create_plist(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_cset retrieves the character set type of a string datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid character set type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_cset(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_cset the character set to be used. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param cset + * IN: Character set type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_cset(long type_id, int cset) throws HDF5LibraryException; + + /** + * H5Tget_ebias retrieves the exponent bias of a floating-point type. + * + * @param type_id + * Identifier of datatype to query. + * + * @return the bias if successful; otherwise 0. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_ebias(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_ebias sets the exponent bias of a floating-point type. + * + * @param type_id + * Identifier of datatype to set. + * @param ebias + * Exponent bias value. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_ebias(long type_id, int ebias) throws HDF5LibraryException { + H5Tset_ebias(type_id, (long) ebias); + return 0; + } + + /** + * H5Tget_ebias retrieves the exponent bias of a floating-point type. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the bias + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_ebias_long(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_ebias sets the exponent bias of a floating-point type. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param ebias + * IN: Exponent bias value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_ebias(long type_id, long ebias) throws HDF5LibraryException; + + /** + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param fields + * OUT: location of size and bit-position. + *
    + *
  • fields[0] = spos OUT: location to return size of in bits.
  • + *
  • fields[1] = epos OUT: location to return exponent bit-position.
  • + *
  • fields[2] = esize OUT: location to return size of exponent in bits.
  • + *
  • fields[3] = mpos OUT: location to return mantissa bit-position.
  • + *
  • fields[4] = msize OUT: location to return size of mantissa in bits.
  • + *
+ * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - fields is null. + * @exception IllegalArgumentException + * - fields array is invalid. + **/ + public synchronized static native void H5Tget_fields(long type_id, long[] fields) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param fields + * OUT: location of size and bit-position. + * + *
+     *      fields[0] = spos  OUT: location to return size of in bits.
+     *      fields[1] = epos  OUT: location to return exponent bit-position.
+     *      fields[2] = esize OUT: location to return size of exponent in bits.
+     *      fields[3] = mpos  OUT: location to return mantissa bit-position.
+     *      fields[4] = msize OUT: location to return size of mantissa in bits.
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - fields is null. + * @exception IllegalArgumentException + * - fields array is invalid. + **/ + public static int H5Tget_fields(long type_id, int[] fields) throws HDF5LibraryException, NullPointerException, + IllegalArgumentException { + return H5Tget_fields_int(type_id, fields); + } + + private synchronized static native int H5Tget_fields_int(long type_id, int[] fields) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Tset_fields sets the locations and sizes of the various floating point bit fields. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param spos + * IN: Size position. + * @param epos + * IN: Exponent bit position. + * @param esize + * IN: Size of exponent in bits. + * @param mpos + * IN: Mantissa bit position. + * @param msize + * IN: Size of mantissa in bits. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_fields(long type_id, long spos, long epos, long esize, long mpos, + long msize) throws HDF5LibraryException; + + /** + * H5Tset_fields sets the locations and sizes of the various floating point bit fields. + * + * @param type_id + * Identifier of datatype to set. + * @param spos + * Size position. + * @param epos + * Exponent bit position. + * @param esize + * Size of exponent in bits. + * @param mpos + * Mantissa bit position. + * @param msize + * Size of mantissa in bits. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_fields(long type_id, int spos, int epos, int esize, int mpos, int msize) + throws HDF5LibraryException { + H5Tset_fields(type_id, (long) spos, (long) epos, (long) esize, (long) mpos, (long) msize); + return 0; + } + + /** + * H5Tget_inpad retrieves the internal padding type for unused bits in floating-point datatypes. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid padding type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_inpad(long type_id) throws HDF5LibraryException; + + /** + * If any internal bits of a floating point type are unused (that is, those significant bits which are not part of + * the sign, exponent, or mantissa), then H5Tset_inpad will be filled according to the value of the padding value + * property inpad. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param inpad + * IN: Padding type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_inpad(long type_id, int inpad) throws HDF5LibraryException; + + /** + * H5Tget_member_class returns the class of datatype of the specified member. + * + * @param type_id + * IN: Datatype identifier of compound object. + * @param membno + * IN: Compound object member number. + * + * @return the class of the datatype of the field if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_member_class(long type_id, int membno) throws HDF5LibraryException; + + /** + * H5Tget_member_index retrieves the index of a field of a compound datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_name + * IN: Field name of the field index to retrieve. + * + * @return if field is defined, the index; else negative. + **/ + public synchronized static native int H5Tget_member_index(long type_id, String field_name); + + /** + * H5Tget_member_name retrieves the name of a field of a compound datatype or an element of an enumeration datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_idx + * IN: Field index (0-based) of the field name to retrieve. + * + * @return a valid pointer to the name if successful; otherwise null. + **/ + public synchronized static native String H5Tget_member_name(long type_id, int field_idx); + + /** + * H5Tget_member_offset returns the byte offset of the specified member of the compound datatype. This is the byte + * offset in the HDF-5 file/library, NOT the offset of any Java object which might be mapped to this data item. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param membno + * IN: Field index (0-based) of the field type to retrieve. + * + * @return the offset of the member. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_member_offset(long type_id, int membno) throws HDF5LibraryException; + + /** + * H5Tget_member_type returns the datatype of the specified member. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_idx + * IN: Field index (0-based) of the field type to retrieve. + * + * @return the identifier of a copy of the datatype of the field if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_member_type(long type_id, int field_idx) throws HDF5LibraryException { + long id = _H5Tget_member_type(type_id, field_idx); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_member_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_member_type(long type_id, int field_idx) + throws HDF5LibraryException; + + /** + * H5Tget_member_value returns the value of the enumeration datatype member memb_no. + * + * @param type_id + * IN: Datatype identifier for the enumeration datatype. + * @param membno + * IN: Number of the enumeration datatype member. + * @param value + * OUT: The value of the member + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public synchronized static native void H5Tget_member_value(long type_id, int membno, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tget_member_value returns the value of the enumeration datatype member memb_no. + * + * @param type_id + * IN: Identifier of datatype. + * @param membno + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public static int H5Tget_member_value(long type_id, int membno, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tget_member_value_int(type_id, membno, value); + } + + private synchronized static native int H5Tget_member_value_int(long type_id, int membno, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tget_native_type returns the equivalent native datatype for the datatype specified in type_id. + * + * @param type_id + * IN: Identifier of datatype to query. Direction of search is assumed to be in ascending order. + * + * @return the native datatype identifier for the specified dataset datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static long H5Tget_native_type(long type_id) throws HDF5LibraryException { + return H5Tget_native_type(type_id, HDF5Constants.H5T_DIR_ASCEND); + } + + /** + * H5Tget_native_type returns the equivalent native datatype for the datatype specified in type_id. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param direction + * IN: Direction of search. + * + * @return the native datatype identifier for the specified dataset datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_native_type(long type_id, int direction) throws HDF5LibraryException { + long id = _H5Tget_native_type(type_id, direction); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_native_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_native_type(long tid, int direction) throws HDF5LibraryException; + + /** + * H5Tget_nmembers retrieves the number of fields a compound datatype has. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return number of members datatype has if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_nmembers(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_norm retrieves the mantissa normalization of a floating-point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid normalization type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_norm(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_norm sets the mantissa normalization of a floating-point datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param norm + * IN: Mantissa normalization type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_norm(long type_id, int norm) throws HDF5LibraryException; + + /** + * H5Tget_offset retrieves the bit offset of the first significant bit. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a positive offset value if successful; otherwise 0. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_offset(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_offset sets the bit offset of the first significant bit. + * + * @param type_id + * Identifier of datatype to set. + * @param offset + * Offset of first significant bit. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_offset(long type_id, int offset) throws HDF5LibraryException { + H5Tset_offset(type_id, (long) offset); + return 0; + } + + /** + * H5Tset_offset sets the bit offset of the first significant bit. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param offset + * IN: Offset of first significant bit. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_offset(long type_id, long offset) throws HDF5LibraryException; + + /** + * H5Tget_order returns the byte order of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a byte order constant if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_order(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_order sets the byte ordering of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param order + * IN: Byte ordering constant. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_order(long type_id, int order) throws HDF5LibraryException; + + /** + * H5Tget_pad retrieves the padding type of the least and most-significant bit padding. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param pad + * OUT: locations to return least-significant and most-significant bit padding type. + * + *
+     *      pad[0] = lsb // least-significant bit padding type
+     *      pad[1] = msb // most-significant bit padding type
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - pad is null. + **/ + public synchronized static native int H5Tget_pad(long type_id, int[] pad) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Tset_pad sets the least and most-significant bits padding types. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param lsb + * IN: Padding type for least-significant bits. + * @param msb + * IN: Padding type for most-significant bits. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_pad(long type_id, int lsb, int msb) throws HDF5LibraryException; + + /** + * H5Tget_precision returns the precision of an atomic datatype. + * + * @param type_id + * Identifier of datatype to query. + * + * @return the number of significant bits if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_precision(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_precision sets the precision of an atomic datatype. + * + * @param type_id + * Identifier of datatype to set. + * @param precision + * Number of bits of precision for datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_precision(long type_id, int precision) throws HDF5LibraryException { + H5Tset_precision(type_id, (long) precision); + return 0; + } + + /** + * H5Tget_precision returns the precision of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the number of significant bits if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_precision_long(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_precision sets the precision of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param precision + * IN: Number of bits of precision for datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_precision(long type_id, long precision) throws HDF5LibraryException; + + /** + * H5Tget_sign retrieves the sign type for an integer type. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid sign type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_sign(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_sign sets the sign proprety for an integer type. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param sign + * IN: Sign type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_sign(long type_id, int sign) throws HDF5LibraryException; + + /** + * H5Tget_size returns the size of a datatype in bytes. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the size of the datatype in bytes + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_size(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_size sets the total size in bytes, size, for an atomic datatype (this operation is not permitted on + * compound datatypes). + * + * @param type_id + * IN: Identifier of datatype to change size. + * @param size + * IN: Size in bytes to modify datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_size(long type_id, long size) throws HDF5LibraryException; + + /** + * H5Tget_strpad retrieves the string padding method for a string datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid string padding type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_strpad(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_strpad defines the storage mechanism for the string. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param strpad + * IN: String padding type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_strpad(long type_id, int strpad) throws HDF5LibraryException; + + /** + * H5Tget_super returns the type from which TYPE is derived. + * + * @param type + * IN: Identifier of datatype. + * + * @return the parent type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_super(long type) throws HDF5LibraryException { + long id = _H5Tget_super(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_super add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_super(long type) throws HDF5LibraryException; + + /** + * H5Tget_tag returns the tag associated with datatype type_id. + * + * @param type + * IN: Identifier of datatype. + * + * @return the tag + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Tget_tag(long type) throws HDF5LibraryException; + + /** + * H5Tset_tag tags an opaque datatype type_id with a unique ASCII identifier tag. + * + * @param type + * IN: Datatype identifier for the opaque datatype to be tagged. + * @param tag + * IN: Descriptive ASCII string with which the opaque datatype is to be tagged. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_tag(long type, String tag) throws HDF5LibraryException; + + /** + * H5Tinsert adds another member to the compound datatype type_id. + * + * @param type_id + * IN: Identifier of compound datatype to modify. + * @param name + * IN: Name of the field to insert. + * @param offset + * IN: Offset in memory structure of the field to insert. + * @param field_id + * IN: Datatype identifier of the field to insert. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Tinsert(long type_id, String name, long offset, long field_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tis_variable_str determines whether the datatype identified in type_id is a variable-length string. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return true if type_id is a variable-length string. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tis_variable_str(long type_id) throws HDF5LibraryException; + + /** + * H5Tlock locks the datatype specified by the type_id identifier, making it read-only and non-destrucible. + * + * @param type_id + * IN: Identifier of datatype to lock. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tlock(long type_id) throws HDF5LibraryException; + + /** + * H5Topen opens a named datatype at the location specified by loc_id and return an identifier for the datatype. + * + * @param loc_id + * IN: A file, group, or datatype identifier. + * @param name + * IN: A datatype name, defined within the file or group identified by loc_id. + * @param tapl_id + * IN: Datatype access property list. + * + * @return a named datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Topen(long loc_id, String name, long tapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Topen2(loc_id, name, tapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Topen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Topen2(long loc_id, String name, long tapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tpack recursively removes padding from within a compound datatype to make it more efficient (space-wise) to + * store that data. + *

+ * WARNING: This call only affects the C-data, even if it succeeds, there may be no visible effect on Java + * objects. + * + * @param type_id + * IN: Identifier of datatype to modify. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tpack(long type_id) throws HDF5LibraryException; + + /** + * H5Tvlen_create creates a new variable-length (VL) dataype. + * + * @param base_id + * IN: Identifier of parent datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tvlen_create(long base_id) throws HDF5LibraryException { + long id = _H5Tvlen_create(base_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tvlen_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tvlen_create(long base_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + // H5T_conv_t H5Tfind(int src_id, int dst_id, H5T_cdata_t *pcdata); + + // public synchronized static native int H5Tregister(H5T_pers_t pers, String name, int src_id, int dst_id, + // H5T_conv_t func) + // throws HDF5LibraryException, NullPointerException; + + // public synchronized static native int H5Tunregister(H5T_pers_t pers, String name, int src_id, int dst_id, + // H5T_conv_t func) + // throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5Z: Filter Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + public synchronized static native int H5Zfilter_avail(int filter) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Zget_filter_info(int filter) throws HDF5LibraryException; + + public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException; + +} + +// /////// unimplemented //////// + +// herr_t H5Zregister(const void *cls); + diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java new file mode 100644 index 00000000000..80895440df9 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -0,0 +1,1877 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +/** + * /** This class contains C constants and enumerated types of HDF5 library. The + * values of these constants are obtained from the library by calling J2C(int + * jconstant), where jconstant is any of the private constants which start their + * name with "JH5" need to be converted. + *

+ * Do not edit this file! + * + * See also: hdf.hdf5lib.HDF5Library + */ +public class HDF5Constants { + static { + H5.loadH5Lib(); + } + + // ///////////////////////////////////////////////////////////////////////// + // Get the HDF5 constants from the library // + // ///////////////////////////////////////////////////////////////////////// + + public static final long H5_QUARTER_HADDR_MAX = H5_QUARTER_HADDR_MAX(); + + public static final int H5_SZIP_MAX_PIXELS_PER_BLOCK = H5_SZIP_MAX_PIXELS_PER_BLOCK(); + public static final int H5_SZIP_NN_OPTION_MASK = H5_SZIP_NN_OPTION_MASK(); + public static final int H5_SZIP_EC_OPTION_MASK = H5_SZIP_EC_OPTION_MASK(); + public static final int H5_SZIP_ALLOW_K13_OPTION_MASK = H5_SZIP_ALLOW_K13_OPTION_MASK(); + public static final int H5_SZIP_CHIP_OPTION_MASK = H5_SZIP_CHIP_OPTION_MASK(); + public static final int H5_INDEX_UNKNOWN = H5_INDEX_UNKNOWN(); + public static final int H5_INDEX_NAME = H5_INDEX_NAME(); + public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER(); + public static final int H5_INDEX_N = H5_INDEX_N(); + public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN(); + public static final int H5_ITER_INC = H5_ITER_INC(); + public static final int H5_ITER_DEC = H5_ITER_DEC(); + public static final int H5_ITER_NATIVE = H5_ITER_NATIVE(); + public static final int H5_ITER_N = H5_ITER_N(); + public static final int H5AC_CURR_CACHE_CONFIG_VERSION = H5AC_CURR_CACHE_CONFIG_VERSION(); + public static final int H5AC_MAX_TRACE_FILE_NAME_LEN = H5AC_MAX_TRACE_FILE_NAME_LEN(); + public static final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY = H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + public static final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED = H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + public static final int H5C_incr_off = H5C_incr_off(); + public static final int H5C_incr_threshold = H5C_incr_threshold(); + public static final int H5C_flash_incr_off = H5C_flash_incr_off(); + public static final int H5C_flash_incr_add_space = H5C_flash_incr_add_space(); + public static final int H5C_decr_off = H5C_decr_off(); + public static final int H5C_decr_threshold = H5C_decr_threshold(); + public static final int H5C_decr_age_out = H5C_decr_age_out(); + public static final int H5C_decr_age_out_with_threshold = H5C_decr_age_out_with_threshold(); + public static final int H5D_CHUNK_IDX_BTREE = H5D_CHUNK_IDX_BTREE(); + public static final int H5D_ALLOC_TIME_DEFAULT = H5D_ALLOC_TIME_DEFAULT(); + public static final int H5D_ALLOC_TIME_EARLY = H5D_ALLOC_TIME_EARLY(); + public static final int H5D_ALLOC_TIME_ERROR = H5D_ALLOC_TIME_ERROR(); + public static final int H5D_ALLOC_TIME_INCR = H5D_ALLOC_TIME_INCR(); + public static final int H5D_ALLOC_TIME_LATE = H5D_ALLOC_TIME_LATE(); + public static final int H5D_FILL_TIME_ERROR = H5D_FILL_TIME_ERROR(); + public static final int H5D_FILL_TIME_ALLOC = H5D_FILL_TIME_ALLOC(); + public static final int H5D_FILL_TIME_NEVER = H5D_FILL_TIME_NEVER(); + public static final int H5D_FILL_TIME_IFSET = H5D_FILL_TIME_IFSET(); + public static final int H5D_FILL_VALUE_DEFAULT = H5D_FILL_VALUE_DEFAULT(); + public static final int H5D_FILL_VALUE_ERROR = H5D_FILL_VALUE_ERROR(); + public static final int H5D_FILL_VALUE_UNDEFINED = H5D_FILL_VALUE_UNDEFINED(); + public static final int H5D_FILL_VALUE_USER_DEFINED = H5D_FILL_VALUE_USER_DEFINED(); + public static final int H5D_LAYOUT_ERROR = H5D_LAYOUT_ERROR(); + public static final int H5D_CHUNKED = H5D_CHUNKED(); + public static final int H5D_COMPACT = H5D_COMPACT(); + public static final int H5D_CONTIGUOUS = H5D_CONTIGUOUS(); + public static final int H5D_VIRTUAL = H5D_VIRTUAL(); + public static final int H5D_NLAYOUTS = H5D_NLAYOUTS(); + public static final int H5D_SPACE_STATUS_ALLOCATED = H5D_SPACE_STATUS_ALLOCATED(); + public static final int H5D_SPACE_STATUS_ERROR = H5D_SPACE_STATUS_ERROR(); + public static final int H5D_SPACE_STATUS_NOT_ALLOCATED = H5D_SPACE_STATUS_NOT_ALLOCATED(); + public static final int H5D_SPACE_STATUS_PART_ALLOCATED = H5D_SPACE_STATUS_PART_ALLOCATED(); + 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 H5E_MAJOR = H5E_MAJOR(); + public static final int H5E_MINOR = H5E_MINOR(); + public static final long H5E_ALIGNMENT = H5E_ALIGNMENT(); + public static final long H5E_ALREADYEXISTS = H5E_ALREADYEXISTS(); + public static final long H5E_ALREADYINIT = H5E_ALREADYINIT(); + public static final long H5E_ARGS = H5E_ARGS(); + public static final long H5E_ATOM = H5E_ATOM(); + public static final long H5E_ATTR = H5E_ATTR(); + public static final long H5E_BADATOM = H5E_BADATOM(); + public static final long H5E_BADFILE = H5E_BADFILE(); + public static final long H5E_BADGROUP = H5E_BADGROUP(); + public static final long H5E_BADMESG = H5E_BADMESG(); + public static final long H5E_BADRANGE = H5E_BADRANGE(); + public static final long H5E_BADSELECT = H5E_BADSELECT(); + public static final long H5E_BADSIZE = H5E_BADSIZE(); + public static final long H5E_BADTYPE = H5E_BADTYPE(); + public static final long H5E_BADVALUE = H5E_BADVALUE(); + public static final long H5E_BTREE = H5E_BTREE(); + public static final long H5E_CACHE = H5E_CACHE(); + public static final long H5E_CALLBACK = H5E_CALLBACK(); + public static final long H5E_CANAPPLY = H5E_CANAPPLY(); + // public static final long H5E_CANTALLOC = H5E_CANTALLOC(); + public static final long H5E_CANTCLIP = H5E_CANTCLIP(); + public static final long H5E_CANTCLOSEFILE = H5E_CANTCLOSEFILE(); + public static final long H5E_CANTCONVERT = H5E_CANTCONVERT(); + public static final long H5E_CANTCOPY = H5E_CANTCOPY(); + public static final long H5E_CANTCOUNT = H5E_CANTCOUNT(); + public static final long H5E_CANTCREATE = H5E_CANTCREATE(); + public static final long H5E_CANTDEC = H5E_CANTDEC(); + public static final long H5E_CANTDECODE = H5E_CANTDECODE(); + public static final long H5E_CANTDELETE = H5E_CANTDELETE(); + public static final long H5E_CANTENCODE = H5E_CANTENCODE(); + public static final long H5E_CANTFLUSH = H5E_CANTFLUSH(); + public static final long H5E_CANTFREE = H5E_CANTFREE(); + public static final long H5E_CANTGET = H5E_CANTGET(); + public static final long H5E_CANTINC = H5E_CANTINC(); + public static final long H5E_CANTINIT = H5E_CANTINIT(); + public static final long H5E_CANTINSERT = H5E_CANTINSERT(); + public static final long H5E_CANTLIST = H5E_CANTLIST(); + public static final long H5E_CANTLOAD = H5E_CANTLOAD(); + public static final long H5E_CANTLOCK = H5E_CANTLOCK(); + public static final long H5E_CANTNEXT = H5E_CANTNEXT(); + public static final long H5E_CANTOPENFILE = H5E_CANTOPENFILE(); + public static final long H5E_CANTOPENOBJ = H5E_CANTOPENOBJ(); + // public static final long H5E_CANTRECV = H5E_CANTRECV(); + public static final long H5E_CANTREGISTER = H5E_CANTREGISTER(); + public static final long H5E_CANTRELEASE = H5E_CANTRELEASE(); + public static final long H5E_CANTSELECT = H5E_CANTSELECT(); + public static final long H5E_CANTSET = H5E_CANTSET(); + public static final long H5E_CANTSPLIT = H5E_CANTSPLIT(); + public static final long H5E_CANTUNLOCK = H5E_CANTUNLOCK(); + public static final long H5E_CLOSEERROR = H5E_CLOSEERROR(); + public static final long H5E_COMPLEN = H5E_COMPLEN(); + public static final long H5E_DATASET = H5E_DATASET(); + public static final long H5E_DATASPACE = H5E_DATASPACE(); + public static final long H5E_DATATYPE = H5E_DATATYPE(); + public static final long H5E_DEFAULT = H5E_DEFAULT(); + public static final long H5E_DUPCLASS = H5E_DUPCLASS(); + public static final long H5E_EFL = H5E_EFL(); + public static final long H5E_EXISTS = H5E_EXISTS(); + public static final long H5E_FCNTL = H5E_FCNTL(); + public static final long H5E_FILE = H5E_FILE(); + public static final long H5E_FILEEXISTS = H5E_FILEEXISTS(); + public static final long H5E_FILEOPEN = H5E_FILEOPEN(); + public static final long H5E_FUNC = H5E_FUNC(); + public static final long H5E_HEAP = H5E_HEAP(); + public static final long H5E_INTERNAL = H5E_INTERNAL(); + public static final long H5E_IO = H5E_IO(); + public static final long H5E_LINK = H5E_LINK(); + public static final long H5E_LINKCOUNT = H5E_LINKCOUNT(); + public static final long H5E_MOUNT = H5E_MOUNT(); + public static final long H5E_MPI = H5E_MPI(); + public static final long H5E_MPIERRSTR = H5E_MPIERRSTR(); + public static final long H5E_NOFILTER = H5E_NOFILTER(); + public static final long H5E_NOIDS = H5E_NOIDS(); + public static final long H5E_NONE_MAJOR = H5E_NONE_MAJOR(); + public static final long H5E_NONE_MINOR = H5E_NONE_MINOR(); + public static final long H5E_NOSPACE = H5E_NOSPACE(); + public static final long H5E_NOTCACHED = H5E_NOTCACHED(); + public static final long H5E_NOTFOUND = H5E_NOTFOUND(); + public static final long H5E_NOTHDF5 = H5E_NOTHDF5(); + public static final long H5E_OHDR = H5E_OHDR(); + public static final long H5E_OVERFLOW = H5E_OVERFLOW(); + public static final long H5E_PLINE = H5E_PLINE(); + public static final long H5E_PLIST = H5E_PLIST(); + public static final long H5E_PROTECT = H5E_PROTECT(); + public static final long H5E_READERROR = H5E_READERROR(); + public static final long H5E_REFERENCE = H5E_REFERENCE(); + public static final long H5E_RESOURCE = H5E_RESOURCE(); + public static final long H5E_RS = H5E_RS(); + public static final long H5E_SEEKERROR = H5E_SEEKERROR(); + public static final long H5E_SETLOCAL = H5E_SETLOCAL(); + public static final long H5E_STORAGE = H5E_STORAGE(); + public static final long H5E_SYM = H5E_SYM(); + public static final long H5E_TRUNCATED = H5E_TRUNCATED(); + public static final long H5E_TST = H5E_TST(); + public static final long H5E_UNINITIALIZED = H5E_UNINITIALIZED(); + public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED(); + public static final long H5E_VERSION = H5E_VERSION(); + public static final long H5E_VFL = H5E_VFL(); + public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD(); + public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); + public static final long H5E_WRITEERROR = H5E_WRITEERROR(); + + public static final int H5F_ACC_CREAT = H5F_ACC_CREAT(); + public static final int H5F_ACC_EXCL = H5F_ACC_EXCL(); + public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY(); + public static final int H5F_ACC_RDWR = H5F_ACC_RDWR(); + public static final int H5F_ACC_TRUNC = H5F_ACC_TRUNC(); + public static final int H5F_ACC_DEFAULT = H5F_ACC_DEFAULT(); + public static final int H5F_CLOSE_DEFAULT = H5F_CLOSE_DEFAULT(); + public static final int H5F_CLOSE_SEMI = H5F_CLOSE_SEMI(); + public static final int H5F_CLOSE_STRONG = H5F_CLOSE_STRONG(); + public static final int H5F_CLOSE_WEAK = H5F_CLOSE_WEAK(); + public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST(); + public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); + public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); + public static final int H5F_OBJ_ATTR = H5F_OBJ_ATTR(); + public static final int H5F_OBJ_DATASET = H5F_OBJ_DATASET(); + public static final int H5F_OBJ_DATATYPE = H5F_OBJ_DATATYPE(); + public static final int H5F_OBJ_FILE = H5F_OBJ_FILE(); + public static final int H5F_OBJ_GROUP = H5F_OBJ_GROUP(); + public static final int H5F_OBJ_LOCAL = H5F_OBJ_LOCAL(); + public static final int H5F_SCOPE_GLOBAL = H5F_SCOPE_GLOBAL(); + public static final int H5F_SCOPE_LOCAL = H5F_SCOPE_LOCAL(); + public static final int H5F_UNLIMITED = H5F_UNLIMITED(); + public static final int H5F_FILE_SPACE_DEFAULT = H5F_FILE_SPACE_DEFAULT(); + public static final int H5F_FILE_SPACE_ALL_PERSIST = H5F_FILE_SPACE_ALL_PERSIST(); + public static final int H5F_FILE_SPACE_ALL = H5F_FILE_SPACE_ALL(); + public static final int H5F_FILE_SPACE_AGGR_VFD = H5F_FILE_SPACE_AGGR_VFD(); + public static final int H5F_FILE_SPACE_VFD = H5F_FILE_SPACE_VFD(); + public static final int H5F_FILE_SPACE_NTYPES = H5F_FILE_SPACE_NTYPES(); + + public static final long H5FD_CORE = H5FD_CORE(); + public static final long H5FD_DIRECT = H5FD_DIRECT(); + public static final long H5FD_FAMILY = H5FD_FAMILY(); + public static final long H5FD_LOG = H5FD_LOG(); + public static final long H5FD_MPIO = H5FD_MPIO(); + public static final long H5FD_MULTI = H5FD_MULTI(); + public static final long H5FD_SEC2 = H5FD_SEC2(); + public static final long H5FD_STDIO = H5FD_STDIO(); + public static final long H5FD_WINDOWS = H5FD_WINDOWS(); + public static final int H5FD_LOG_LOC_READ = H5FD_LOG_LOC_READ(); + public static final int H5FD_LOG_LOC_WRITE = H5FD_LOG_LOC_WRITE(); + public static final int H5FD_LOG_LOC_SEEK = H5FD_LOG_LOC_SEEK(); + public static final int H5FD_LOG_LOC_IO = H5FD_LOG_LOC_IO(); + public static final int H5FD_LOG_FILE_READ = H5FD_LOG_FILE_READ(); + public static final int H5FD_LOG_FILE_WRITE = H5FD_LOG_FILE_WRITE(); + public static final int H5FD_LOG_FILE_IO = H5FD_LOG_FILE_IO(); + public static final int H5FD_LOG_FLAVOR = H5FD_LOG_FLAVOR(); + public static final int H5FD_LOG_NUM_READ = H5FD_LOG_NUM_READ(); + public static final int H5FD_LOG_NUM_WRITE = H5FD_LOG_NUM_WRITE(); + public static final int H5FD_LOG_NUM_SEEK = H5FD_LOG_NUM_SEEK(); + public static final int H5FD_LOG_NUM_TRUNCATE = H5FD_LOG_NUM_TRUNCATE(); + public static final int H5FD_LOG_NUM_IO = H5FD_LOG_NUM_IO(); + public static final int H5FD_LOG_TIME_OPEN = H5FD_LOG_TIME_OPEN(); + public static final int H5FD_LOG_TIME_STAT = H5FD_LOG_TIME_STAT(); + public static final int H5FD_LOG_TIME_READ = H5FD_LOG_TIME_READ(); + public static final int H5FD_LOG_TIME_WRITE = H5FD_LOG_TIME_WRITE(); + public static final int H5FD_LOG_TIME_SEEK = H5FD_LOG_TIME_SEEK(); + public static final int H5FD_LOG_TIME_CLOSE = H5FD_LOG_TIME_CLOSE(); + public static final int H5FD_LOG_TIME_IO = H5FD_LOG_TIME_IO(); + public static final int H5FD_LOG_ALLOC = H5FD_LOG_ALLOC(); + public static final int H5FD_LOG_ALL = H5FD_LOG_ALL(); + public static final int H5FD_MEM_NOLIST = H5FD_MEM_NOLIST(); + public static final int H5FD_MEM_DEFAULT = H5FD_MEM_DEFAULT(); + public static final int H5FD_MEM_SUPER = H5FD_MEM_SUPER(); + public static final int H5FD_MEM_BTREE = H5FD_MEM_BTREE(); + public static final int H5FD_MEM_DRAW = H5FD_MEM_DRAW(); + public static final int H5FD_MEM_GHEAP = H5FD_MEM_GHEAP(); + public static final int H5FD_MEM_LHEAP = H5FD_MEM_LHEAP(); + public static final int H5FD_MEM_OHDR = H5FD_MEM_OHDR(); + public static final int H5FD_MEM_NTYPES = H5FD_MEM_NTYPES(); + public static final long H5FD_DEFAULT_HADDR_SIZE = H5FD_DEFAULT_HADDR_SIZE(); + public static final long H5FD_MEM_DEFAULT_SIZE = H5FD_MEM_DEFAULT_SIZE(); + public static final long H5FD_MEM_DEFAULT_SUPER_SIZE = H5FD_MEM_DEFAULT_SUPER_SIZE(); + public static final long H5FD_MEM_DEFAULT_BTREE_SIZE = H5FD_MEM_DEFAULT_BTREE_SIZE(); + public static final long H5FD_MEM_DEFAULT_DRAW_SIZE = H5FD_MEM_DEFAULT_DRAW_SIZE(); + public static final long H5FD_MEM_DEFAULT_GHEAP_SIZE = H5FD_MEM_DEFAULT_GHEAP_SIZE(); + public static final long H5FD_MEM_DEFAULT_LHEAP_SIZE = H5FD_MEM_DEFAULT_LHEAP_SIZE(); + public static final long H5FD_MEM_DEFAULT_OHDR_SIZE = H5FD_MEM_DEFAULT_OHDR_SIZE(); + +// public static final int H5G_DATASET = H5G_DATASET(); +// public static final int H5G_GROUP = H5G_GROUP(); +// public static final int H5G_LINK = H5G_LINK(); +// public static final int H5G_UDLINK = H5G_UDLINK(); +// public static final int H5G_LINK_ERROR = H5G_LINK_ERROR(); +// public static final int H5G_LINK_HARD = H5G_LINK_HARD(); +// public static final int H5G_LINK_SOFT = H5G_LINK_SOFT(); +// public static final int H5G_NLIBTYPES = H5G_NLIBTYPES(); +// public static final int H5G_NTYPES = H5G_NTYPES(); +// public static final int H5G_NUSERTYPES = H5G_NUSERTYPES(); +// public static final int H5G_RESERVED_5 = H5G_RESERVED_5(); +// public static final int H5G_RESERVED_6 = H5G_RESERVED_6(); +// public static final int H5G_RESERVED_7 = H5G_RESERVED_7(); +// public static final int H5G_SAME_LOC = H5G_SAME_LOC(); +// public static final int H5G_TYPE = H5G_TYPE(); +// public static final int H5G_UNKNOWN = H5G_UNKNOWN(); + + public static final int H5G_STORAGE_TYPE_UNKNOWN = H5G_STORAGE_TYPE_UNKNOWN(); + public static final int H5G_STORAGE_TYPE_SYMBOL_TABLE = H5G_STORAGE_TYPE_SYMBOL_TABLE(); + public static final int H5G_STORAGE_TYPE_COMPACT = H5G_STORAGE_TYPE_COMPACT(); + public static final int H5G_STORAGE_TYPE_DENSE = H5G_STORAGE_TYPE_DENSE(); + + public static final int H5I_ATTR = H5I_ATTR(); + public static final int H5I_BADID = H5I_BADID(); + public static final int H5I_DATASET = H5I_DATASET(); + public static final int H5I_DATASPACE = H5I_DATASPACE(); + public static final int H5I_DATATYPE = H5I_DATATYPE(); + public static final int H5I_ERROR_CLASS = H5I_ERROR_CLASS(); + public static final int H5I_ERROR_MSG = H5I_ERROR_MSG(); + public static final int H5I_ERROR_STACK = H5I_ERROR_STACK(); + public static final int H5I_FILE = H5I_FILE(); + public static final int H5I_GENPROP_CLS = H5I_GENPROP_CLS(); + public static final int H5I_GENPROP_LST = H5I_GENPROP_LST(); + public static final int H5I_GROUP = H5I_GROUP(); + public static final int H5I_INVALID_HID = H5I_INVALID_HID(); + public static final int H5I_NTYPES = H5I_NTYPES(); + public static final int H5I_REFERENCE = H5I_REFERENCE(); + public static final int H5I_UNINIT = H5I_UNINIT(); + public static final int H5I_VFL = H5I_VFL(); + + public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); + public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); + public static final int H5L_TYPE_SOFT = H5L_TYPE_SOFT(); + public static final int H5L_TYPE_EXTERNAL = H5L_TYPE_EXTERNAL(); + public static final int H5L_TYPE_MAX = H5L_TYPE_MAX(); + + public static final int H5O_COPY_SHALLOW_HIERARCHY_FLAG = H5O_COPY_SHALLOW_HIERARCHY_FLAG(); + public static final int H5O_COPY_EXPAND_SOFT_LINK_FLAG = H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + public static final int H5O_COPY_EXPAND_EXT_LINK_FLAG = H5O_COPY_EXPAND_EXT_LINK_FLAG(); + public static final int H5O_COPY_EXPAND_REFERENCE_FLAG = H5O_COPY_EXPAND_REFERENCE_FLAG(); + public static final int H5O_COPY_WITHOUT_ATTR_FLAG = H5O_COPY_WITHOUT_ATTR_FLAG(); + public static final int H5O_COPY_PRESERVE_NULL_FLAG = H5O_COPY_PRESERVE_NULL_FLAG(); + public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG(); + public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG(); + public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG(); + public static final int H5O_SHMESG_FILL_FLAG = H5O_SHMESG_FILL_FLAG(); + public static final int H5O_SHMESG_PLINE_FLAG = H5O_SHMESG_PLINE_FLAG(); + public static final int H5O_SHMESG_ATTR_FLAG = H5O_SHMESG_ATTR_FLAG(); + public static final int H5O_SHMESG_ALL_FLAG = H5O_SHMESG_ALL_FLAG(); + public static final int H5O_TYPE_UNKNOWN = H5O_TYPE_UNKNOWN(); + public static final int H5O_TYPE_GROUP = H5O_TYPE_GROUP(); + public static final int H5O_TYPE_DATASET = H5O_TYPE_DATASET(); + public static final int H5O_TYPE_NAMED_DATATYPE = H5O_TYPE_NAMED_DATATYPE(); + public static final int H5O_TYPE_NTYPES = H5O_TYPE_NTYPES(); + + public static final long H5P_ROOT = H5P_ROOT(); + public static final long H5P_OBJECT_CREATE = H5P_OBJECT_CREATE(); + public static final long H5P_FILE_CREATE = H5P_FILE_CREATE(); + public static final long H5P_FILE_ACCESS = H5P_FILE_ACCESS(); + public static final long H5P_DATASET_CREATE = H5P_DATASET_CREATE(); + public static final long H5P_DATASET_ACCESS = H5P_DATASET_ACCESS(); + public static final long H5P_DATASET_XFER = H5P_DATASET_XFER(); + public static final long H5P_FILE_MOUNT = H5P_FILE_MOUNT(); + public static final long H5P_GROUP_CREATE = H5P_GROUP_CREATE(); + public static final long H5P_GROUP_ACCESS = H5P_GROUP_ACCESS(); + public static final long H5P_DATATYPE_CREATE = H5P_DATATYPE_CREATE(); + public static final long H5P_DATATYPE_ACCESS = H5P_DATATYPE_ACCESS(); + public static final long H5P_STRING_CREATE = H5P_STRING_CREATE(); + public static final long H5P_ATTRIBUTE_CREATE = H5P_ATTRIBUTE_CREATE(); + public static final long H5P_ATTRIBUTE_ACCESS = H5P_ATTRIBUTE_ACCESS(); + public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY(); + public static final long H5P_LINK_CREATE = H5P_LINK_CREATE(); + public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS(); + public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT(); + public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT(); + public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT(); + public static final long H5P_DATASET_ACCESS_DEFAULT = H5P_DATASET_ACCESS_DEFAULT(); + public static final long H5P_DATASET_XFER_DEFAULT = H5P_DATASET_XFER_DEFAULT(); + public static final long H5P_FILE_MOUNT_DEFAULT = H5P_FILE_MOUNT_DEFAULT(); + public static final long H5P_GROUP_CREATE_DEFAULT = H5P_GROUP_CREATE_DEFAULT(); + public static final long H5P_GROUP_ACCESS_DEFAULT = H5P_GROUP_ACCESS_DEFAULT(); + public static final long H5P_DATATYPE_CREATE_DEFAULT = H5P_DATATYPE_CREATE_DEFAULT(); + public static final long H5P_DATATYPE_ACCESS_DEFAULT = H5P_DATATYPE_ACCESS_DEFAULT(); + public static final long H5P_ATTRIBUTE_CREATE_DEFAULT = H5P_ATTRIBUTE_CREATE_DEFAULT(); + public static final long H5P_ATTRIBUTE_ACCESS_DEFAULT = H5P_ATTRIBUTE_ACCESS_DEFAULT(); + public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT(); + public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT(); + public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT(); + public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED(); + public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED(); + public static final long H5P_DEFAULT = H5P_DEFAULT(); + + public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR(); + public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER(); + public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN(); + public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN(); + + public static final int H5R_BADTYPE = H5R_BADTYPE(); + public static final int H5R_DATASET_REGION = H5R_DATASET_REGION(); + public static final int H5R_MAXTYPE = H5R_MAXTYPE(); + 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 H5S_ALL = H5S_ALL(); + public static final int H5S_MAX_RANK = H5S_MAX_RANK(); + public static final int H5S_NO_CLASS = H5S_NO_CLASS(); + public static final int H5S_NULL = H5S_NULL(); + public static final int H5S_SCALAR = H5S_SCALAR(); + public static final int H5S_SEL_ALL = H5S_SEL_ALL(); + public static final int H5S_SEL_ERROR = H5S_SEL_ERROR(); + public static final int H5S_SEL_HYPERSLABS = H5S_SEL_HYPERSLABS(); + public static final int H5S_SEL_N = H5S_SEL_N(); + public static final int H5S_SEL_NONE = H5S_SEL_NONE(); + public static final int H5S_SEL_POINTS = H5S_SEL_POINTS(); + public static final int H5S_SELECT_AND = H5S_SELECT_AND(); + public static final int H5S_SELECT_APPEND = H5S_SELECT_APPEND(); + public static final int H5S_SELECT_INVALID = H5S_SELECT_INVALID(); + public static final int H5S_SELECT_NOOP = H5S_SELECT_NOOP(); + public static final int H5S_SELECT_NOTA = H5S_SELECT_NOTA(); + public static final int H5S_SELECT_NOTB = H5S_SELECT_NOTB(); + public static final int H5S_SELECT_OR = H5S_SELECT_OR(); + public static final int H5S_SELECT_PREPEND = H5S_SELECT_PREPEND(); + public static final int H5S_SELECT_SET = H5S_SELECT_SET(); + public static final int H5S_SELECT_XOR = H5S_SELECT_XOR(); + public static final int H5S_SIMPLE = H5S_SIMPLE(); + public static final int H5S_UNLIMITED = H5S_UNLIMITED(); + public static final long H5T_ALPHA_B16 = H5T_ALPHA_B16(); + public static final long H5T_ALPHA_B32 = H5T_ALPHA_B32(); + public static final long H5T_ALPHA_B64 = H5T_ALPHA_B64(); + public static final long H5T_ALPHA_B8 = H5T_ALPHA_B8(); + public static final long H5T_ALPHA_F32 = H5T_ALPHA_F32(); + public static final long H5T_ALPHA_F64 = H5T_ALPHA_F64(); + public static final long H5T_ALPHA_I16 = H5T_ALPHA_I16(); + public static final long H5T_ALPHA_I32 = H5T_ALPHA_I32(); + public static final long H5T_ALPHA_I64 = H5T_ALPHA_I64(); + public static final long H5T_ALPHA_I8 = H5T_ALPHA_I8(); + public static final long H5T_ALPHA_U16 = H5T_ALPHA_U16(); + public static final long H5T_ALPHA_U32 = H5T_ALPHA_U32(); + public static final long H5T_ALPHA_U64 = H5T_ALPHA_U64(); + public static final long H5T_ALPHA_U8 = H5T_ALPHA_U8(); + public static final int H5T_ARRAY = H5T_ARRAY(); + public static final int H5T_BITFIELD = H5T_BITFIELD(); + public static final int H5T_BKG_NO = H5T_BKG_NO(); + public static final int H5T_BKG_YES = H5T_BKG_YES(); + public static final long H5T_C_S1 = H5T_C_S1(); + public static final int H5T_COMPOUND = H5T_COMPOUND(); + public static final int H5T_CONV_CONV = H5T_CONV_CONV(); + public static final int H5T_CONV_FREE = H5T_CONV_FREE(); + public static final int H5T_CONV_INIT = H5T_CONV_INIT(); + public static final int H5T_CSET_ERROR = H5T_CSET_ERROR(); + public static final int H5T_CSET_ASCII = H5T_CSET_ASCII(); + public static final int H5T_CSET_UTF8 = H5T_CSET_UTF8(); + public static final int H5T_CSET_RESERVED_10 = H5T_CSET_RESERVED_10(); + public static final int H5T_CSET_RESERVED_11 = H5T_CSET_RESERVED_11(); + public static final int H5T_CSET_RESERVED_12 = H5T_CSET_RESERVED_12(); + public static final int H5T_CSET_RESERVED_13 = H5T_CSET_RESERVED_13(); + public static final int H5T_CSET_RESERVED_14 = H5T_CSET_RESERVED_14(); + public static final int H5T_CSET_RESERVED_15 = H5T_CSET_RESERVED_15(); + public static final int H5T_CSET_RESERVED_2 = H5T_CSET_RESERVED_2(); + public static final int H5T_CSET_RESERVED_3 = H5T_CSET_RESERVED_3(); + public static final int H5T_CSET_RESERVED_4 = H5T_CSET_RESERVED_4(); + public static final int H5T_CSET_RESERVED_5 = H5T_CSET_RESERVED_5(); + public static final int H5T_CSET_RESERVED_6 = H5T_CSET_RESERVED_6(); + public static final int H5T_CSET_RESERVED_7 = H5T_CSET_RESERVED_7(); + public static final int H5T_CSET_RESERVED_8 = H5T_CSET_RESERVED_8(); + public static final int H5T_CSET_RESERVED_9 = H5T_CSET_RESERVED_9(); + public static final int H5T_DIR_ASCEND = H5T_DIR_ASCEND(); + public static final int H5T_DIR_DEFAULT = H5T_DIR_DEFAULT(); + public static final int H5T_DIR_DESCEND = H5T_DIR_DESCEND(); + public static final int H5T_ENUM = H5T_ENUM(); + public static final int H5T_FLOAT = H5T_FLOAT(); + public static final long H5T_FORTRAN_S1 = H5T_FORTRAN_S1(); + public static final long H5T_IEEE_F32BE = H5T_IEEE_F32BE(); + public static final long H5T_IEEE_F32LE = H5T_IEEE_F32LE(); + public static final long H5T_IEEE_F64BE = H5T_IEEE_F64BE(); + public static final long H5T_IEEE_F64LE = H5T_IEEE_F64LE(); + public static final int H5T_INTEGER = H5T_INTEGER(); + public static final long H5T_INTEL_B16 = H5T_INTEL_B16(); + public static final long H5T_INTEL_B32 = H5T_INTEL_B32(); + public static final long H5T_INTEL_B64 = H5T_INTEL_B64(); + public static final long H5T_INTEL_B8 = H5T_INTEL_B8(); + public static final long H5T_INTEL_F32 = H5T_INTEL_F32(); + public static final long H5T_INTEL_F64 = H5T_INTEL_F64(); + public static final long H5T_INTEL_I16 = H5T_INTEL_I16(); + public static final long H5T_INTEL_I32 = H5T_INTEL_I32(); + public static final long H5T_INTEL_I64 = H5T_INTEL_I64(); + public static final long H5T_INTEL_I8 = H5T_INTEL_I8(); + public static final long H5T_INTEL_U16 = H5T_INTEL_U16(); + public static final long H5T_INTEL_U32 = H5T_INTEL_U32(); + public static final long H5T_INTEL_U64 = H5T_INTEL_U64(); + public static final long H5T_INTEL_U8 = H5T_INTEL_U8(); + public static final long H5T_MIPS_B16 = H5T_MIPS_B16(); + public static final long H5T_MIPS_B32 = H5T_MIPS_B32(); + public static final long H5T_MIPS_B64 = H5T_MIPS_B64(); + public static final long H5T_MIPS_B8 = H5T_MIPS_B8(); + public static final long H5T_MIPS_F32 = H5T_MIPS_F32(); + public static final long H5T_MIPS_F64 = H5T_MIPS_F64(); + public static final long H5T_MIPS_I16 = H5T_MIPS_I16(); + public static final long H5T_MIPS_I32 = H5T_MIPS_I32(); + public static final long H5T_MIPS_I64 = H5T_MIPS_I64(); + public static final long H5T_MIPS_I8 = H5T_MIPS_I8(); + public static final long H5T_MIPS_U16 = H5T_MIPS_U16(); + public static final long H5T_MIPS_U32 = H5T_MIPS_U32(); + public static final long H5T_MIPS_U64 = H5T_MIPS_U64(); + public static final long H5T_MIPS_U8 = H5T_MIPS_U8(); + public static final long H5T_NATIVE_B16 = H5T_NATIVE_B16(); + public static final long H5T_NATIVE_B32 = H5T_NATIVE_B32(); + public static final long H5T_NATIVE_B64 = H5T_NATIVE_B64(); + public static final long H5T_NATIVE_B8 = H5T_NATIVE_B8(); + public static final long H5T_NATIVE_CHAR = H5T_NATIVE_CHAR(); + public static final long H5T_NATIVE_DOUBLE = H5T_NATIVE_DOUBLE(); + public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT(); + public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR(); + public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL(); + public static final long H5T_NATIVE_HERR = H5T_NATIVE_HERR(); + public static final long H5T_NATIVE_HSIZE = H5T_NATIVE_HSIZE(); + public static final long H5T_NATIVE_HSSIZE = H5T_NATIVE_HSSIZE(); + public static final long H5T_NATIVE_INT = H5T_NATIVE_INT(); + public static final long H5T_NATIVE_INT_FAST16 = H5T_NATIVE_INT_FAST16(); + public static final long H5T_NATIVE_INT_FAST32 = H5T_NATIVE_INT_FAST32(); + public static final long H5T_NATIVE_INT_FAST64 = H5T_NATIVE_INT_FAST64(); + public static final long H5T_NATIVE_INT_FAST8 = H5T_NATIVE_INT_FAST8(); + public static final long H5T_NATIVE_INT_LEAST16 = H5T_NATIVE_INT_LEAST16(); + public static final long H5T_NATIVE_INT_LEAST32 = H5T_NATIVE_INT_LEAST32(); + public static final long H5T_NATIVE_INT_LEAST64 = H5T_NATIVE_INT_LEAST64(); + public static final long H5T_NATIVE_INT_LEAST8 = H5T_NATIVE_INT_LEAST8(); + public static final long H5T_NATIVE_INT16 = H5T_NATIVE_INT16(); + public static final long H5T_NATIVE_INT32 = H5T_NATIVE_INT32(); + public static final long H5T_NATIVE_INT64 = H5T_NATIVE_INT64(); + public static final long H5T_NATIVE_INT8 = H5T_NATIVE_INT8(); + public static final long H5T_NATIVE_LDOUBLE = H5T_NATIVE_LDOUBLE(); + public static final long H5T_NATIVE_LLONG = H5T_NATIVE_LLONG(); + public static final long H5T_NATIVE_LONG = H5T_NATIVE_LONG(); + public static final long H5T_NATIVE_OPAQUE = H5T_NATIVE_OPAQUE(); + public static final long H5T_NATIVE_SCHAR = H5T_NATIVE_SCHAR(); + public static final long H5T_NATIVE_SHORT = H5T_NATIVE_SHORT(); + public static final long H5T_NATIVE_UCHAR = H5T_NATIVE_UCHAR(); + public static final long H5T_NATIVE_UINT = H5T_NATIVE_UINT(); + public static final long H5T_NATIVE_UINT_FAST16 = H5T_NATIVE_UINT_FAST16(); + public static final long H5T_NATIVE_UINT_FAST32 = H5T_NATIVE_UINT_FAST32(); + public static final long H5T_NATIVE_UINT_FAST64 = H5T_NATIVE_UINT_FAST64(); + public static final long H5T_NATIVE_UINT_FAST8 = H5T_NATIVE_UINT_FAST8(); + public static final long H5T_NATIVE_UINT_LEAST16 = H5T_NATIVE_UINT_LEAST16(); + public static final long H5T_NATIVE_UINT_LEAST32 = H5T_NATIVE_UINT_LEAST32(); + public static final long H5T_NATIVE_UINT_LEAST64 = H5T_NATIVE_UINT_LEAST64(); + public static final long H5T_NATIVE_UINT_LEAST8 = H5T_NATIVE_UINT_LEAST8(); + public static final long H5T_NATIVE_UINT16 = H5T_NATIVE_UINT16(); + public static final long H5T_NATIVE_UINT32 = H5T_NATIVE_UINT32(); + public static final long H5T_NATIVE_UINT64 = H5T_NATIVE_UINT64(); + public static final long H5T_NATIVE_UINT8 = H5T_NATIVE_UINT8(); + public static final long H5T_NATIVE_ULLONG = H5T_NATIVE_ULLONG(); + public static final long H5T_NATIVE_ULONG = H5T_NATIVE_ULONG(); + public static final long H5T_NATIVE_USHORT = H5T_NATIVE_USHORT(); + public static final int H5T_NCLASSES = H5T_NCLASSES(); + public static final int H5T_NO_CLASS = H5T_NO_CLASS(); + public static final int H5T_NORM_ERROR = H5T_NORM_ERROR(); + public static final int H5T_NORM_IMPLIED = H5T_NORM_IMPLIED(); + public static final int H5T_NORM_MSBSET = H5T_NORM_MSBSET(); + public static final int H5T_NORM_NONE = H5T_NORM_NONE(); + public static final int H5T_NPAD = H5T_NPAD(); + public static final int H5T_NSGN = H5T_NSGN(); + public static final int H5T_OPAQUE = H5T_OPAQUE(); + public static final int H5T_OPAQUE_TAG_MAX = H5T_OPAQUE_TAG_MAX(); /* 1.6.5 */ + public static final int H5T_ORDER_BE = H5T_ORDER_BE(); + public static final int H5T_ORDER_ERROR = H5T_ORDER_ERROR(); + public static final int H5T_ORDER_LE = H5T_ORDER_LE(); + public static final int H5T_ORDER_NONE = H5T_ORDER_NONE(); + public static final int H5T_ORDER_VAX = H5T_ORDER_VAX(); + public static final int H5T_PAD_BACKGROUND = H5T_PAD_BACKGROUND(); + public static final int H5T_PAD_ERROR = H5T_PAD_ERROR(); + public static final int H5T_PAD_ONE = H5T_PAD_ONE(); + public static final int H5T_PAD_ZERO = H5T_PAD_ZERO(); + public static final int H5T_PERS_DONTCARE = H5T_PERS_DONTCARE(); + public static final int H5T_PERS_HARD = H5T_PERS_HARD(); + public static final int H5T_PERS_SOFT = H5T_PERS_SOFT(); + public static final int H5T_REFERENCE = H5T_REFERENCE(); + public static final int H5T_SGN_2 = H5T_SGN_2(); + public static final int H5T_SGN_ERROR = H5T_SGN_ERROR(); + public static final int H5T_SGN_NONE = H5T_SGN_NONE(); + public static final long H5T_STD_B16BE = H5T_STD_B16BE(); + public static final long H5T_STD_B16LE = H5T_STD_B16LE(); + public static final long H5T_STD_B32BE = H5T_STD_B32BE(); + public static final long H5T_STD_B32LE = H5T_STD_B32LE(); + public static final long H5T_STD_B64BE = H5T_STD_B64BE(); + public static final long H5T_STD_B64LE = H5T_STD_B64LE(); + public static final long H5T_STD_B8BE = H5T_STD_B8BE(); + public static final long H5T_STD_B8LE = H5T_STD_B8LE(); + public static final long H5T_STD_I16BE = H5T_STD_I16BE(); + public static final long H5T_STD_I16LE = H5T_STD_I16LE(); + public static final long H5T_STD_I32BE = H5T_STD_I32BE(); + public static final long H5T_STD_I32LE = H5T_STD_I32LE(); + public static final long H5T_STD_I64BE = H5T_STD_I64BE(); + public static final long H5T_STD_I64LE = H5T_STD_I64LE(); + public static final long H5T_STD_I8BE = H5T_STD_I8BE(); + 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_U16BE = H5T_STD_U16BE(); + public static final long H5T_STD_U16LE = H5T_STD_U16LE(); + public static final long H5T_STD_U32BE = H5T_STD_U32BE(); + public static final long H5T_STD_U32LE = H5T_STD_U32LE(); + public static final long H5T_STD_U64BE = H5T_STD_U64BE(); + public static final long H5T_STD_U64LE = H5T_STD_U64LE(); + public static final long H5T_STD_U8BE = H5T_STD_U8BE(); + public static final long H5T_STD_U8LE = H5T_STD_U8LE(); + public static final int H5T_STR_ERROR = H5T_STR_ERROR(); + public static final int H5T_STR_NULLPAD = H5T_STR_NULLPAD(); + public static final int H5T_STR_NULLTERM = H5T_STR_NULLTERM(); + public static final int H5T_STR_RESERVED_10 = H5T_STR_RESERVED_10(); + public static final int H5T_STR_RESERVED_11 = H5T_STR_RESERVED_11(); + public static final int H5T_STR_RESERVED_12 = H5T_STR_RESERVED_12(); + public static final int H5T_STR_RESERVED_13 = H5T_STR_RESERVED_13(); + public static final int H5T_STR_RESERVED_14 = H5T_STR_RESERVED_14(); + public static final int H5T_STR_RESERVED_15 = H5T_STR_RESERVED_15(); + public static final int H5T_STR_RESERVED_3 = H5T_STR_RESERVED_3(); + public static final int H5T_STR_RESERVED_4 = H5T_STR_RESERVED_4(); + public static final int H5T_STR_RESERVED_5 = H5T_STR_RESERVED_5(); + public static final int H5T_STR_RESERVED_6 = H5T_STR_RESERVED_6(); + public static final int H5T_STR_RESERVED_7 = H5T_STR_RESERVED_7(); + public static final int H5T_STR_RESERVED_8 = H5T_STR_RESERVED_8(); + public static final int H5T_STR_RESERVED_9 = H5T_STR_RESERVED_9(); + public static final int H5T_STR_SPACEPAD = H5T_STR_SPACEPAD(); + public static final int H5T_STRING = H5T_STRING(); + public static final int H5T_TIME = H5T_TIME(); + public static final long H5T_UNIX_D32BE = H5T_UNIX_D32BE(); + public static final long H5T_UNIX_D32LE = H5T_UNIX_D32LE(); + public static final long H5T_UNIX_D64BE = H5T_UNIX_D64BE(); + public static final long H5T_UNIX_D64LE = H5T_UNIX_D64LE(); + public static final long H5T_VARIABLE = H5T_VARIABLE(); + public static final int H5T_VLEN = H5T_VLEN(); + public static final int H5Z_CB_CONT = H5Z_CB_CONT(); + public static final int H5Z_CB_ERROR = H5Z_CB_ERROR(); + public static final int H5Z_CB_FAIL = H5Z_CB_FAIL(); + public static final int H5Z_CB_NO = H5Z_CB_NO(); + public static final int H5Z_DISABLE_EDC = H5Z_DISABLE_EDC(); + public static final int H5Z_ENABLE_EDC = H5Z_ENABLE_EDC(); + public static final int H5Z_ERROR_EDC = H5Z_ERROR_EDC(); + public static final int H5Z_FILTER_DEFLATE = H5Z_FILTER_DEFLATE(); + public static final int H5Z_FILTER_ERROR = H5Z_FILTER_ERROR(); + public static final int H5Z_FILTER_FLETCHER32 = H5Z_FILTER_FLETCHER32(); + public static final int H5Z_FILTER_MAX = H5Z_FILTER_MAX(); + public static final int H5Z_FILTER_NBIT = H5Z_FILTER_NBIT(); + public static final int H5Z_FILTER_NONE = H5Z_FILTER_NONE(); + public static final int H5Z_FILTER_RESERVED = H5Z_FILTER_RESERVED(); + public static final int H5Z_FILTER_SCALEOFFSET = H5Z_FILTER_SCALEOFFSET(); + public static final int H5Z_FILTER_SHUFFLE = H5Z_FILTER_SHUFFLE(); + public static final int H5Z_FILTER_SZIP = H5Z_FILTER_SZIP(); + public static final int H5Z_FLAG_DEFMASK = H5Z_FLAG_DEFMASK(); + public static final int H5Z_FLAG_INVMASK = H5Z_FLAG_INVMASK(); + public static final int H5Z_FLAG_MANDATORY = H5Z_FLAG_MANDATORY(); + public static final int H5Z_FLAG_OPTIONAL = H5Z_FLAG_OPTIONAL(); + public static final int H5Z_FLAG_REVERSE = H5Z_FLAG_REVERSE(); + public static final int H5Z_FLAG_SKIP_EDC = H5Z_FLAG_SKIP_EDC(); + public static final int H5Z_MAX_NFILTERS = H5Z_MAX_NFILTERS(); + public static final int H5Z_NO_EDC = H5Z_NO_EDC(); + public static final int H5Z_FILTER_CONFIG_ENCODE_ENABLED = H5Z_FILTER_CONFIG_ENCODE_ENABLED(); + public static final int H5Z_FILTER_CONFIG_DECODE_ENABLED = H5Z_FILTER_CONFIG_DECODE_ENABLED(); + public static final int H5Z_SO_INT_MINBITS_DEFAULT = H5Z_SO_INT_MINBITS_DEFAULT(); + public static final int H5Z_SO_FLOAT_DSCALE = H5Z_SO_FLOAT_DSCALE(); + public static final int H5Z_SO_FLOAT_ESCALE = H5Z_SO_FLOAT_ESCALE(); + public static final int H5Z_SO_INT = H5Z_SO_INT(); + public static final int H5Z_SHUFFLE_USER_NPARMS = H5Z_SHUFFLE_USER_NPARMS(); + public static final int H5Z_SHUFFLE_TOTAL_NPARMS = H5Z_SHUFFLE_TOTAL_NPARMS(); + public static final int H5Z_SZIP_USER_NPARMS = H5Z_SZIP_USER_NPARMS(); + public static final int H5Z_SZIP_TOTAL_NPARMS = H5Z_SZIP_TOTAL_NPARMS(); + public static final int H5Z_SZIP_PARM_MASK = H5Z_SZIP_PARM_MASK(); + public static final int H5Z_SZIP_PARM_PPB = H5Z_SZIP_PARM_PPB(); + public static final int H5Z_SZIP_PARM_BPP = H5Z_SZIP_PARM_BPP(); + public static final int H5Z_SZIP_PARM_PPS = H5Z_SZIP_PARM_PPS(); + public static final int H5Z_NBIT_USER_NPARMS = H5Z_NBIT_USER_NPARMS(); + public static final int H5Z_SCALEOFFSET_USER_NPARMS = H5Z_SCALEOFFSET_USER_NPARMS(); + public static final int H5Z_FILTER_ALL = H5Z_FILTER_ALL(); + + // ///////////////////////////////////////////////////////////////////////// + // List of private native variables to get constant values from C // + // DO NOT EDIT THE LIST UNLESS YOU KNOW WHAT YOU DO!!! // + // ///////////////////////////////////////////////////////////////////////// + + private static native final long H5_QUARTER_HADDR_MAX(); + + private static native final int H5_SZIP_MAX_PIXELS_PER_BLOCK(); + + private static native final int H5_SZIP_NN_OPTION_MASK(); + + private static native final int H5_SZIP_EC_OPTION_MASK(); + + private static native final int H5_SZIP_ALLOW_K13_OPTION_MASK(); + + private static native final int H5_SZIP_CHIP_OPTION_MASK(); + + private static native final int H5_INDEX_UNKNOWN(); + + private static native final int H5_INDEX_NAME(); + + private static native final int H5_INDEX_CRT_ORDER(); + + private static native final int H5_INDEX_N(); + + private static native final int H5_ITER_UNKNOWN(); + + private static native final int H5_ITER_INC(); + + private static native final int H5_ITER_DEC(); + + private static native final int H5_ITER_NATIVE(); + + private static native final int H5_ITER_N(); + + private static native final int H5AC_CURR_CACHE_CONFIG_VERSION(); + + private static native final int H5AC_MAX_TRACE_FILE_NAME_LEN(); + + private static native final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + + private static native final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + + private static native final int H5C_incr_off(); + + private static native final int H5C_incr_threshold(); + + private static native final int H5C_flash_incr_off(); + + private static native final int H5C_flash_incr_add_space(); + + private static native final int H5C_decr_off(); + + private static native final int H5C_decr_threshold(); + + private static native final int H5C_decr_age_out(); + + private static native final int H5C_decr_age_out_with_threshold(); + + private static native final int H5D_CHUNK_IDX_BTREE(); + + private static native final int H5D_ALLOC_TIME_DEFAULT(); + + private static native final int H5D_ALLOC_TIME_EARLY(); + + private static native final int H5D_ALLOC_TIME_ERROR(); + + private static native final int H5D_ALLOC_TIME_INCR(); + + private static native final int H5D_ALLOC_TIME_LATE(); + + private static native final int H5D_FILL_TIME_ERROR(); + + private static native final int H5D_FILL_TIME_ALLOC(); + + private static native final int H5D_FILL_TIME_NEVER(); + + private static native final int H5D_FILL_TIME_IFSET(); + + private static native final int H5D_FILL_VALUE_DEFAULT(); + + private static native final int H5D_FILL_VALUE_ERROR(); + + private static native final int H5D_FILL_VALUE_UNDEFINED(); + + private static native final int H5D_FILL_VALUE_USER_DEFINED(); + + private static native final int H5D_LAYOUT_ERROR(); + + private static native final int H5D_CHUNKED(); + + private static native final int H5D_COMPACT(); + + private static native final int H5D_CONTIGUOUS(); + + private static native final int H5D_VIRTUAL(); + + private static native final int H5D_NLAYOUTS(); + + private static native final int H5D_SPACE_STATUS_ALLOCATED(); + + private static native final int H5D_SPACE_STATUS_ERROR(); + + private static native final int H5D_SPACE_STATUS_NOT_ALLOCATED(); + + private static native final int H5D_SPACE_STATUS_PART_ALLOCATED(); + + private static native final int H5D_VDS_ERROR(); + + private static native final int H5D_VDS_FIRST_MISSING(); + + private static native final int H5D_VDS_LAST_AVAILABLE(); + + private static native final long H5E_ALIGNMENT(); + + private static native final long H5E_ALREADYEXISTS(); + + private static native final long H5E_ALREADYINIT(); + + private static native final long H5E_ARGS(); + + private static native final long H5E_ATOM(); + + private static native final long H5E_ATTR(); + + private static native final long H5E_BADATOM(); + + private static native final long H5E_BADFILE(); + + private static native final long H5E_BADGROUP(); + + private static native final long H5E_BADMESG(); + + private static native final long H5E_BADRANGE(); + + private static native final long H5E_BADSELECT(); + + private static native final long H5E_BADSIZE(); + + private static native final long H5E_BADTYPE(); + + private static native final long H5E_BADVALUE(); + + private static native final long H5E_BTREE(); + + private static native final long H5E_CACHE(); + + private static native final long H5E_CALLBACK(); + + private static native final long H5E_CANAPPLY(); + + // private static native final long H5E_CANTALLOC(); + private static native final long H5E_CANTCLIP(); + + private static native final long H5E_CANTCLOSEFILE(); + + private static native final long H5E_CANTCONVERT(); + + private static native final long H5E_CANTCOPY(); + + private static native final long H5E_CANTCOUNT(); + + private static native final long H5E_CANTCREATE(); + + private static native final long H5E_CANTDEC(); + + private static native final long H5E_CANTDECODE(); + + private static native final long H5E_CANTDELETE(); + + private static native final long H5E_CANTENCODE(); + + private static native final long H5E_CANTFLUSH(); + + private static native final long H5E_CANTFREE(); + + private static native final long H5E_CANTGET(); + + private static native final long H5E_CANTINC(); + + private static native final long H5E_CANTINIT(); + + private static native final long H5E_CANTINSERT(); + + private static native final long H5E_CANTLIST(); + + private static native final long H5E_CANTLOAD(); + + private static native final long H5E_CANTLOCK(); + + private static native final long H5E_CANTNEXT(); + + private static native final long H5E_CANTOPENFILE(); + + private static native final long H5E_CANTOPENOBJ(); + + // private static native final long H5E_CANTRECV(); + private static native final long H5E_CANTREGISTER(); + + private static native final long H5E_CANTRELEASE(); + + private static native final long H5E_CANTSELECT(); + + private static native final long H5E_CANTSET(); + + private static native final long H5E_CANTSPLIT(); + + private static native final long H5E_CANTUNLOCK(); + + private static native final long H5E_CLOSEERROR(); + + private static native final long H5E_COMPLEN(); + + private static native final long H5E_DATASET(); + + private static native final long H5E_DATASPACE(); + + private static native final long H5E_DATATYPE(); + + private static native final long H5E_DEFAULT(); + + private static native final long H5E_DUPCLASS(); + + private static native final long H5E_EFL(); + + private static native final long H5E_EXISTS(); + + private static native final long H5E_FCNTL(); + + private static native final long H5E_FILE(); + + private static native final long H5E_FILEEXISTS(); + + private static native final long H5E_FILEOPEN(); + + private static native final long H5E_FUNC(); + + private static native final long H5E_HEAP(); + + private static native final long H5E_INTERNAL(); + + private static native final long H5E_IO(); + + private static native final long H5E_LINK(); + + private static native final long H5E_LINKCOUNT(); + + private static native final int H5E_MAJOR(); + + private static native final int H5E_MINOR(); + + private static native final long H5E_MOUNT(); + + private static native final long H5E_MPI(); + + private static native final long H5E_MPIERRSTR(); + + private static native final long H5E_NOFILTER(); + + private static native final long H5E_NOIDS(); + + private static native final long H5E_NONE_MAJOR(); + + private static native final long H5E_NONE_MINOR(); + + private static native final long H5E_NOSPACE(); + + private static native final long H5E_NOTCACHED(); + + private static native final long H5E_NOTFOUND(); + + private static native final long H5E_NOTHDF5(); + + private static native final long H5E_OHDR(); + + private static native final long H5E_OVERFLOW(); + + private static native final long H5E_PLINE(); + + private static native final long H5E_PLIST(); + + private static native final long H5E_PROTECT(); + + private static native final long H5E_READERROR(); + + private static native final long H5E_REFERENCE(); + + private static native final long H5E_RESOURCE(); + + private static native final long H5E_RS(); + + private static native final long H5E_SEEKERROR(); + + private static native final long H5E_SETLOCAL(); + + private static native final long H5E_STORAGE(); + + private static native final long H5E_SYM(); + + private static native final long H5E_TRUNCATED(); + + private static native final long H5E_TST(); + + private static native final long H5E_UNINITIALIZED(); + + private static native final long H5E_UNSUPPORTED(); + + private static native final long H5E_VERSION(); + + private static native final long H5E_VFL(); + + private static native final long H5E_WALK_DOWNWARD(); + + private static native final long H5E_WALK_UPWARD(); + + private static native final long H5E_WRITEERROR(); + + private static native final int H5F_ACC_CREAT(); + + private static native final int H5F_ACC_EXCL(); + + private static native final int H5F_ACC_RDONLY(); + + private static native final int H5F_ACC_RDWR(); + + private static native final int H5F_ACC_TRUNC(); + + private static native final int H5F_ACC_DEFAULT(); + + private static native final int H5F_CLOSE_DEFAULT(); + + private static native final int H5F_CLOSE_SEMI(); + + private static native final int H5F_CLOSE_STRONG(); + + private static native final int H5F_CLOSE_WEAK(); + + private static native final int H5F_LIBVER_EARLIEST(); + + private static native final int H5F_LIBVER_LATEST(); + + private static native final int H5F_OBJ_ALL(); + + private static native final int H5F_OBJ_ATTR(); + + private static native final int H5F_OBJ_DATASET(); + + private static native final int H5F_OBJ_DATATYPE(); + + private static native final int H5F_OBJ_FILE(); + + private static native final int H5F_OBJ_GROUP(); + + private static native final int H5F_OBJ_LOCAL(); /* 1.6.5 */ + + private static native final int H5F_SCOPE_DOWN(); + + private static native final int H5F_SCOPE_GLOBAL(); + + private static native final int H5F_SCOPE_LOCAL(); + + private static native final int H5F_UNLIMITED(); + + private static native final int H5F_FILE_SPACE_DEFAULT(); + + private static native final int H5F_FILE_SPACE_ALL_PERSIST(); + + private static native final int H5F_FILE_SPACE_ALL(); + + private static native final int H5F_FILE_SPACE_AGGR_VFD(); + + private static native final int H5F_FILE_SPACE_VFD(); + + private static native final int H5F_FILE_SPACE_NTYPES(); + + private static native final long H5FD_CORE(); + + private static native final long H5FD_DIRECT(); + + private static native final long H5FD_FAMILY(); + + private static native final long H5FD_LOG(); + + private static native final long H5FD_MPIO(); + + private static native final long H5FD_MULTI(); + + private static native final long H5FD_SEC2(); + + private static native final long H5FD_STDIO(); + + private static native final long H5FD_WINDOWS(); + + private static native final int H5FD_LOG_LOC_READ(); + + private static native final int H5FD_LOG_LOC_WRITE(); + + private static native final int H5FD_LOG_LOC_SEEK(); + + private static native final int H5FD_LOG_LOC_IO(); + + private static native final int H5FD_LOG_FILE_READ(); + + private static native final int H5FD_LOG_FILE_WRITE(); + + private static native final int H5FD_LOG_FILE_IO(); + + private static native final int H5FD_LOG_FLAVOR(); + + private static native final int H5FD_LOG_NUM_READ(); + + private static native final int H5FD_LOG_NUM_WRITE(); + + private static native final int H5FD_LOG_NUM_SEEK(); + + private static native final int H5FD_LOG_NUM_TRUNCATE(); + + private static native final int H5FD_LOG_NUM_IO(); + + private static native final int H5FD_LOG_TIME_OPEN(); + + private static native final int H5FD_LOG_TIME_STAT(); + + private static native final int H5FD_LOG_TIME_READ(); + + private static native final int H5FD_LOG_TIME_WRITE(); + + private static native final int H5FD_LOG_TIME_SEEK(); + + private static native final int H5FD_LOG_TIME_CLOSE(); + + private static native final int H5FD_LOG_TIME_IO(); + + private static native final int H5FD_LOG_ALLOC(); + + private static native final int H5FD_LOG_ALL(); + + private static native final int H5FD_MEM_NOLIST(); + + private static native final int H5FD_MEM_DEFAULT(); + + private static native final int H5FD_MEM_SUPER(); + + private static native final int H5FD_MEM_BTREE(); + + private static native final int H5FD_MEM_DRAW(); + + private static native final int H5FD_MEM_GHEAP(); + + private static native final int H5FD_MEM_LHEAP(); + + private static native final int H5FD_MEM_OHDR(); + + private static native final int H5FD_MEM_NTYPES(); + + private static native final long H5FD_DEFAULT_HADDR_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_SUPER_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_BTREE_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_DRAW_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_GHEAP_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_LHEAP_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_OHDR_SIZE(); + + private static native final int H5G_DATASET(); + + private static native final int H5G_GROUP(); + + private static native final int H5G_LINK(); + + private static native final int H5G_UDLINK(); + + private static native final int H5G_LINK_ERROR(); + + private static native final int H5G_LINK_HARD(); + + private static native final int H5G_LINK_SOFT(); + + private static native final int H5G_NLIBTYPES(); + + private static native final int H5G_NTYPES(); + + private static native final int H5G_NUSERTYPES(); + + private static native final int H5G_RESERVED_5(); + + private static native final int H5G_RESERVED_6(); + + private static native final int H5G_RESERVED_7(); + + private static native final int H5G_SAME_LOC(); + + private static native final int H5G_STORAGE_TYPE_UNKNOWN(); + + private static native final int H5G_STORAGE_TYPE_SYMBOL_TABLE(); + + private static native final int H5G_STORAGE_TYPE_COMPACT(); + + private static native final int H5G_STORAGE_TYPE_DENSE(); + + private static native final int H5G_TYPE(); + + private static native final int H5G_UNKNOWN(); + + private static native final int H5I_ATTR(); + + private static native final int H5I_BADID(); + + private static native final int H5I_DATASET(); + + private static native final int H5I_DATASPACE(); + + private static native final int H5I_DATATYPE(); + + private static native final int H5I_ERROR_CLASS(); + + private static native final int H5I_ERROR_MSG(); + + private static native final int H5I_ERROR_STACK(); + + private static native final int H5I_FILE(); + + private static native final int H5I_GENPROP_CLS(); + + private static native final int H5I_GENPROP_LST(); + + private static native final int H5I_GROUP(); + + private static native final int H5I_INVALID_HID(); + + private static native final int H5I_NTYPES(); + + private static native final int H5I_REFERENCE(); + + private static native final int H5I_UNINIT(); + + private static native final int H5I_VFL(); + + private static native final int H5L_TYPE_ERROR(); + + private static native final int H5L_TYPE_HARD(); + + private static native final int H5L_TYPE_SOFT(); + + private static native final int H5L_TYPE_EXTERNAL(); + + private static native final int H5L_TYPE_MAX(); + + private static native final int H5O_COPY_SHALLOW_HIERARCHY_FLAG(); + + private static native final int H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + + private static native final int H5O_COPY_EXPAND_EXT_LINK_FLAG(); + + private static native final int H5O_COPY_EXPAND_REFERENCE_FLAG(); + + private static native final int H5O_COPY_WITHOUT_ATTR_FLAG(); + + private static native final int H5O_COPY_PRESERVE_NULL_FLAG(); + + private static native final int H5O_SHMESG_NONE_FLAG(); + + private static native final int H5O_SHMESG_SDSPACE_FLAG(); + + private static native final int H5O_SHMESG_DTYPE_FLAG(); + + private static native final int H5O_SHMESG_FILL_FLAG(); + + private static native final int H5O_SHMESG_PLINE_FLAG(); + + private static native final int H5O_SHMESG_ATTR_FLAG(); + + private static native final int H5O_SHMESG_ALL_FLAG(); + + private static native final int H5O_TYPE_UNKNOWN(); + + private static native final int H5O_TYPE_GROUP(); + + private static native final int H5O_TYPE_DATASET(); + + private static native final int H5O_TYPE_NAMED_DATATYPE(); + + private static native final int H5O_TYPE_NTYPES(); + + private static native final long H5P_ROOT(); + + private static native final long H5P_OBJECT_CREATE(); + + private static native final long H5P_FILE_CREATE(); + + private static native final long H5P_FILE_ACCESS(); + + private static native final long H5P_DATASET_CREATE(); + + private static native final long H5P_DATASET_ACCESS(); + + private static native final long H5P_DATASET_XFER(); + + private static native final long H5P_FILE_MOUNT(); + + private static native final long H5P_GROUP_CREATE(); + + private static native final long H5P_GROUP_ACCESS(); + + private static native final long H5P_DATATYPE_CREATE(); + + private static native final long H5P_DATATYPE_ACCESS(); + + private static native final long H5P_STRING_CREATE(); + + private static native final long H5P_ATTRIBUTE_CREATE(); + + private static native final long H5P_ATTRIBUTE_ACCESS(); + + private static native final long H5P_OBJECT_COPY(); + + private static native final long H5P_LINK_CREATE(); + + private static native final long H5P_LINK_ACCESS(); + + private static native final long H5P_FILE_CREATE_DEFAULT(); + + private static native final long H5P_FILE_ACCESS_DEFAULT(); + + private static native final long H5P_DATASET_CREATE_DEFAULT(); + + private static native final long H5P_DATASET_ACCESS_DEFAULT(); + + private static native final long H5P_DATASET_XFER_DEFAULT(); + + private static native final long H5P_FILE_MOUNT_DEFAULT(); + + private static native final long H5P_GROUP_CREATE_DEFAULT(); + + private static native final long H5P_GROUP_ACCESS_DEFAULT(); + + private static native final long H5P_DATATYPE_CREATE_DEFAULT(); + + private static native final long H5P_DATATYPE_ACCESS_DEFAULT(); + + private static native final long H5P_ATTRIBUTE_CREATE_DEFAULT(); + + private static native final long H5P_ATTRIBUTE_ACCESS_DEFAULT(); + + private static native final long H5P_OBJECT_COPY_DEFAULT(); + + private static native final long H5P_LINK_CREATE_DEFAULT(); + + private static native final long H5P_LINK_ACCESS_DEFAULT(); + + private static native final int H5P_CRT_ORDER_TRACKED(); + + private static native final int H5P_CRT_ORDER_INDEXED(); + + private static native final long H5P_DEFAULT(); + + private static native final int H5PL_TYPE_ERROR(); + + private static native final int H5PL_TYPE_FILTER(); + + private static native final int H5PL_FILTER_PLUGIN(); + + private static native final int H5PL_ALL_PLUGIN(); + + private static native final int H5R_BADTYPE(); + + private static native final int H5R_DATASET_REGION(); + + private static native final int H5R_MAXTYPE(); + + private static native final int H5R_OBJ_REF_BUF_SIZE(); + + private static native final int H5R_OBJECT(); + + private static native final int H5S_ALL(); + + private static native final int H5S_MAX_RANK(); + + private static native final int H5S_NO_CLASS(); + + private static native final int H5S_NULL(); + + private static native final int H5S_SCALAR(); + + private static native final int H5S_SEL_ALL(); + + private static native final int H5S_SEL_ERROR(); + + private static native final int H5S_SEL_HYPERSLABS(); + + private static native final int H5S_SEL_N(); + + private static native final int H5S_SEL_NONE(); + + private static native final int H5S_SEL_POINTS(); + + private static native final int H5S_SELECT_AND(); + + private static native final int H5S_SELECT_APPEND(); + + private static native final int H5S_SELECT_INVALID(); + + private static native final int H5S_SELECT_NOOP(); + + private static native final int H5S_SELECT_NOTA(); + + private static native final int H5S_SELECT_NOTB(); + + private static native final int H5S_SELECT_OR(); + + private static native final int H5S_SELECT_PREPEND(); + + private static native final int H5S_SELECT_SET(); + + private static native final int H5S_SELECT_XOR(); + + private static native final int H5S_SIMPLE(); + + private static native final int H5S_UNLIMITED(); + + private static native final long H5T_ALPHA_B16(); + + private static native final long H5T_ALPHA_B32(); + + private static native final long H5T_ALPHA_B64(); + + private static native final long H5T_ALPHA_B8(); + + private static native final long H5T_ALPHA_F32(); + + private static native final long H5T_ALPHA_F64(); + + private static native final long H5T_ALPHA_I16(); + + private static native final long H5T_ALPHA_I32(); + + private static native final long H5T_ALPHA_I64(); + + private static native final long H5T_ALPHA_I8(); + + private static native final long H5T_ALPHA_U16(); + + private static native final long H5T_ALPHA_U32(); + + private static native final long H5T_ALPHA_U64(); + + private static native final long H5T_ALPHA_U8(); + + private static native final int H5T_ARRAY(); + + private static native final int H5T_BITFIELD(); + + private static native final int H5T_BKG_NO(); + + private static native final int H5T_BKG_YES(); + + private static native final long H5T_C_S1(); + + private static native final int H5T_COMPOUND(); + + private static native final int H5T_CONV_CONV(); + + private static native final int H5T_CONV_FREE(); + + private static native final int H5T_CONV_INIT(); + + private static native final int H5T_CSET_ERROR(); + + private static native final int H5T_CSET_ASCII(); + + private static native final int H5T_CSET_UTF8(); + + private static native final int H5T_CSET_RESERVED_10(); + + private static native final int H5T_CSET_RESERVED_11(); + + private static native final int H5T_CSET_RESERVED_12(); + + private static native final int H5T_CSET_RESERVED_13(); + + private static native final int H5T_CSET_RESERVED_14(); + + private static native final int H5T_CSET_RESERVED_15(); + + private static native final int H5T_CSET_RESERVED_2(); + + private static native final int H5T_CSET_RESERVED_3(); + + private static native final int H5T_CSET_RESERVED_4(); + + private static native final int H5T_CSET_RESERVED_5(); + + private static native final int H5T_CSET_RESERVED_6(); + + private static native final int H5T_CSET_RESERVED_7(); + + private static native final int H5T_CSET_RESERVED_8(); + + private static native final int H5T_CSET_RESERVED_9(); + + private static native final int H5T_DIR_ASCEND(); + + private static native final int H5T_DIR_DEFAULT(); + + private static native final int H5T_DIR_DESCEND(); + + private static native final int H5T_ENUM(); + + private static native final int H5T_FLOAT(); + + private static native final long H5T_FORTRAN_S1(); + + private static native final long H5T_IEEE_F32BE(); + + private static native final long H5T_IEEE_F32LE(); + + private static native final long H5T_IEEE_F64BE(); + + private static native final long H5T_IEEE_F64LE(); + + private static native final int H5T_INTEGER(); + + private static native final long H5T_INTEL_B16(); + + private static native final long H5T_INTEL_B32(); + + private static native final long H5T_INTEL_B64(); + + private static native final long H5T_INTEL_B8(); + + private static native final long H5T_INTEL_F32(); + + private static native final long H5T_INTEL_F64(); + + private static native final long H5T_INTEL_I16(); + + private static native final long H5T_INTEL_I32(); + + private static native final long H5T_INTEL_I64(); + + private static native final long H5T_INTEL_I8(); + + private static native final long H5T_INTEL_U16(); + + private static native final long H5T_INTEL_U32(); + + private static native final long H5T_INTEL_U64(); + + private static native final long H5T_INTEL_U8(); + + private static native final long H5T_MIPS_B16(); + + private static native final long H5T_MIPS_B32(); + + private static native final long H5T_MIPS_B64(); + + private static native final long H5T_MIPS_B8(); + + private static native final long H5T_MIPS_F32(); + + private static native final long H5T_MIPS_F64(); + + private static native final long H5T_MIPS_I16(); + + private static native final long H5T_MIPS_I32(); + + private static native final long H5T_MIPS_I64(); + + private static native final long H5T_MIPS_I8(); + + private static native final long H5T_MIPS_U16(); + + private static native final long H5T_MIPS_U32(); + + private static native final long H5T_MIPS_U64(); + + private static native final long H5T_MIPS_U8(); + + private static native final long H5T_NATIVE_B16(); + + private static native final long H5T_NATIVE_B32(); + + private static native final long H5T_NATIVE_B64(); + + private static native final long H5T_NATIVE_B8(); + + private static native final long H5T_NATIVE_CHAR(); + + private static native final long H5T_NATIVE_DOUBLE(); + + private static native final long H5T_NATIVE_FLOAT(); + + private static native final long H5T_NATIVE_HADDR(); + + private static native final long H5T_NATIVE_HBOOL(); + + private static native final long H5T_NATIVE_HERR(); + + private static native final long H5T_NATIVE_HSIZE(); + + private static native final long H5T_NATIVE_HSSIZE(); + + private static native final long H5T_NATIVE_INT(); + + private static native final long H5T_NATIVE_INT_FAST16(); + + private static native final long H5T_NATIVE_INT_FAST32(); + + private static native final long H5T_NATIVE_INT_FAST64(); + + private static native final long H5T_NATIVE_INT_FAST8(); + + private static native final long H5T_NATIVE_INT_LEAST16(); + + private static native final long H5T_NATIVE_INT_LEAST32(); + + private static native final long H5T_NATIVE_INT_LEAST64(); + + private static native final long H5T_NATIVE_INT_LEAST8(); + + private static native final long H5T_NATIVE_INT16(); + + private static native final long H5T_NATIVE_INT32(); + + private static native final long H5T_NATIVE_INT64(); + + private static native final long H5T_NATIVE_INT8(); + + private static native final long H5T_NATIVE_LDOUBLE(); + + private static native final long H5T_NATIVE_LLONG(); + + private static native final long H5T_NATIVE_LONG(); + + private static native final long H5T_NATIVE_OPAQUE(); + + private static native final long H5T_NATIVE_SCHAR(); + + private static native final long H5T_NATIVE_SHORT(); + + private static native final long H5T_NATIVE_UCHAR(); + + private static native final long H5T_NATIVE_UINT(); + + private static native final long H5T_NATIVE_UINT_FAST16(); + + private static native final long H5T_NATIVE_UINT_FAST32(); + + private static native final long H5T_NATIVE_UINT_FAST64(); + + private static native final long H5T_NATIVE_UINT_FAST8(); + + private static native final long H5T_NATIVE_UINT_LEAST16(); + + private static native final long H5T_NATIVE_UINT_LEAST32(); + + private static native final long H5T_NATIVE_UINT_LEAST64(); + + private static native final long H5T_NATIVE_UINT_LEAST8(); + + private static native final long H5T_NATIVE_UINT16(); + + private static native final long H5T_NATIVE_UINT32(); + + private static native final long H5T_NATIVE_UINT64(); + + private static native final long H5T_NATIVE_UINT8(); + + private static native final long H5T_NATIVE_ULLONG(); + + private static native final long H5T_NATIVE_ULONG(); + + private static native final long H5T_NATIVE_USHORT(); + + private static native final int H5T_NCLASSES(); + + private static native final int H5T_NO_CLASS(); + + private static native final int H5T_NORM_ERROR(); + + private static native final int H5T_NORM_IMPLIED(); + + private static native final int H5T_NORM_MSBSET(); + + private static native final int H5T_NORM_NONE(); + + private static native final int H5T_NPAD(); + + private static native final int H5T_NSGN(); + + private static native final int H5T_OPAQUE(); + + private static native final int H5T_OPAQUE_TAG_MAX(); + + private static native final int H5T_ORDER_BE(); + + private static native final int H5T_ORDER_ERROR(); + + private static native final int H5T_ORDER_LE(); + + private static native final int H5T_ORDER_NONE(); + + private static native final int H5T_ORDER_VAX(); + + private static native final int H5T_PAD_BACKGROUND(); + + private static native final int H5T_PAD_ERROR(); + + private static native final int H5T_PAD_ONE(); + + private static native final int H5T_PAD_ZERO(); + + private static native final int H5T_PERS_DONTCARE(); + + private static native final int H5T_PERS_HARD(); + + private static native final int H5T_PERS_SOFT(); + + private static native final int H5T_REFERENCE(); + + private static native final int H5T_SGN_2(); + + private static native final int H5T_SGN_ERROR(); + + private static native final int H5T_SGN_NONE(); + + private static native final long H5T_STD_B16BE(); + + private static native final long H5T_STD_B16LE(); + + private static native final long H5T_STD_B32BE(); + + private static native final long H5T_STD_B32LE(); + + private static native final long H5T_STD_B64BE(); + + private static native final long H5T_STD_B64LE(); + + private static native final long H5T_STD_B8BE(); + + private static native final long H5T_STD_B8LE(); + + private static native final long H5T_STD_I16BE(); + + private static native final long H5T_STD_I16LE(); + + private static native final long H5T_STD_I32BE(); + + private static native final long H5T_STD_I32LE(); + + private static native final long H5T_STD_I64BE(); + + private static native final long H5T_STD_I64LE(); + + private static native final long H5T_STD_I8BE(); + + private static native final long H5T_STD_I8LE(); + + private static native final long H5T_STD_REF_DSETREG(); + + private static native final long H5T_STD_REF_OBJ(); + + private static native final long H5T_STD_U16BE(); + + private static native final long H5T_STD_U16LE(); + + private static native final long H5T_STD_U32BE(); + + private static native final long H5T_STD_U32LE(); + + private static native final long H5T_STD_U64BE(); + + private static native final long H5T_STD_U64LE(); + + private static native final long H5T_STD_U8BE(); + + private static native final long H5T_STD_U8LE(); + + private static native final int H5T_STR_ERROR(); + + private static native final int H5T_STR_NULLPAD(); + + private static native final int H5T_STR_NULLTERM(); + + private static native final int H5T_STR_RESERVED_10(); + + private static native final int H5T_STR_RESERVED_11(); + + private static native final int H5T_STR_RESERVED_12(); + + private static native final int H5T_STR_RESERVED_13(); + + private static native final int H5T_STR_RESERVED_14(); + + private static native final int H5T_STR_RESERVED_15(); + + private static native final int H5T_STR_RESERVED_3(); + + private static native final int H5T_STR_RESERVED_4(); + + private static native final int H5T_STR_RESERVED_5(); + + private static native final int H5T_STR_RESERVED_6(); + + private static native final int H5T_STR_RESERVED_7(); + + private static native final int H5T_STR_RESERVED_8(); + + private static native final int H5T_STR_RESERVED_9(); + + private static native final int H5T_STR_SPACEPAD(); + + private static native final int H5T_STRING(); + + private static native final int H5T_TIME(); + + private static native final long H5T_UNIX_D32BE(); + + private static native final long H5T_UNIX_D32LE(); + + private static native final long H5T_UNIX_D64BE(); + + private static native final long H5T_UNIX_D64LE(); + + private static native final long H5T_VARIABLE(); + + private static native final int H5T_VLEN(); + + private static native final int H5Z_CB_CONT(); + + private static native final int H5Z_CB_ERROR(); + + private static native final int H5Z_CB_FAIL(); + + private static native final int H5Z_CB_NO(); + + private static native final int H5Z_DISABLE_EDC(); + + private static native final int H5Z_ENABLE_EDC(); + + private static native final int H5Z_ERROR_EDC(); + + private static native final int H5Z_FILTER_DEFLATE(); + + private static native final int H5Z_FILTER_ERROR(); + + private static native final int H5Z_FILTER_FLETCHER32(); + + private static native final int H5Z_FILTER_MAX(); + + private static native final int H5Z_FILTER_NBIT(); + + private static native final int H5Z_FILTER_NONE(); + + private static native final int H5Z_FILTER_RESERVED(); + + private static native final int H5Z_FILTER_SCALEOFFSET(); + + private static native final int H5Z_FILTER_SHUFFLE(); + + private static native final int H5Z_FILTER_SZIP(); + + private static native final int H5Z_FLAG_DEFMASK(); + + private static native final int H5Z_FLAG_INVMASK(); + + private static native final int H5Z_FLAG_MANDATORY(); + + private static native final int H5Z_FLAG_OPTIONAL(); + + private static native final int H5Z_FLAG_REVERSE(); + + private static native final int H5Z_FLAG_SKIP_EDC(); + + private static native final int H5Z_MAX_NFILTERS(); + + private static native final int H5Z_NO_EDC(); + + private static native final int H5Z_FILTER_CONFIG_ENCODE_ENABLED(); + + private static native final int H5Z_FILTER_CONFIG_DECODE_ENABLED(); + + private static native final int H5Z_SO_INT_MINBITS_DEFAULT(); + + private static native final int H5Z_SO_FLOAT_DSCALE(); + + private static native final int H5Z_SO_FLOAT_ESCALE(); + + private static native final int H5Z_SO_INT(); + + private static native final int H5Z_SHUFFLE_USER_NPARMS(); + + private static native final int H5Z_SHUFFLE_TOTAL_NPARMS(); + + private static native final int H5Z_SZIP_USER_NPARMS(); + + private static native final int H5Z_SZIP_TOTAL_NPARMS(); + + private static native final int H5Z_SZIP_PARM_MASK(); + + private static native final int H5Z_SZIP_PARM_PPB(); + + private static native final int H5Z_SZIP_PARM_BPP(); + + private static native final int H5Z_SZIP_PARM_PPS(); + + private static native final int H5Z_NBIT_USER_NPARMS(); + + private static native final int H5Z_SCALEOFFSET_USER_NPARMS(); + + private static native final int H5Z_FILTER_ALL(); + +} diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java new file mode 100644 index 00000000000..fa33fec16c9 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -0,0 +1,171 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +/** + *

+ * This class is a container for the information reported about an HDF5 Object + * from the H5Gget_obj_info() method. + *

+ * The fileno and objno fields contain four values which uniquely identify an + * object among those HDF5 files which are open: if all four values are the same + * between two objects, then the two objects are the same (provided both files + * are still open). The nlink field is the number of hard links to the object or + * zero when information is being returned about a symbolic link (symbolic links + * do not have hard links but all other objects always have at least one). The + * type field contains the type of the object, one of H5G_GROUP, H5G_DATASET, or + * H5G_LINK. The mtime field contains the modification time. If information is + * being returned about a symbolic link then linklen will be the length of the + * link value (the name of the pointed-to object with the null terminator); + * otherwise linklen will be zero. Other fields may be added to this structure + * in the future. + */ + +public class HDF5GroupInfo { + long[] fileno; + long[] objno; + int nlink; + int type; + long mtime; + int linklen; + + public HDF5GroupInfo() { + fileno = new long[2]; + objno = new long[2]; + nlink = -1; + type = -1; + mtime = 0; + linklen = 0; + } + + /** + * Sets the HDF5 group information. Used by the JHI5. + * + * @param fn + * File id number + * @param on + * Object id number + * @param nl + * Number of links + * @param t + * Type of the object + * @param mt + * Modification time + * @param len + * Length of link + **/ + public void setGroupInfo(long[] fn, long[] on, int nl, int t, long mt, + int len) { + fileno = fn; + objno = on; + nlink = nl; + type = t; + mtime = mt; + linklen = len; + } + + /** Resets all the group information to defaults. */ + public void reset() { + fileno[0] = 0; + fileno[1] = 0; + objno[0] = 0; + objno[1] = 0; + nlink = -1; + type = -1; + mtime = 0; + linklen = 0; + } + + /* accessors */ + public long[] getFileno() { + return fileno; + } + + public long[] getObjno() { + return objno; + } + + public int getType() { + return type; + } + + public int getNlink() { + return nlink; + } + + public long getMtime() { + return mtime; + } + + public int getLinklen() { + return linklen; + } + + /** + * The fileno and objno fields contain four values which uniquely identify + * an object among those HDF5 files. + */ + @Override + public boolean equals(Object obj) { + if (!(obj instanceof HDF5GroupInfo)) { + return false; + } + + HDF5GroupInfo target = (HDF5GroupInfo) obj; + if ((fileno[0] == target.fileno[0]) && (fileno[1] == target.fileno[1]) + && (objno[0] == target.objno[0]) + && (objno[1] == target.objno[1])) { + return true; + } + else { + return false; + } + } + + /** + * Returns the object id. + * + * @return the object id + */ + public long getOID() { + return objno[0]; + } + + /** + * /** Converts this object to a String representation. + * + * @return a string representation of this object + */ + @Override + public String toString() { + String fileStr = "fileno=null"; + String objStr = "objno=null"; + + if (fileno != null) { + fileStr = "fileno[0]=" + fileno[0] + ",fileno[1]=" + fileno[1]; + } + + if (objno != null) { + objStr = "objno[0]=" + objno[0] + ",objno[1]=" + objno[1]; + } + + return getClass().getName() + "[" + fileStr + "," + objStr + ",type=" + + type + ",nlink=" + nlink + ",mtime=" + mtime + ",linklen=" + + linklen + "]"; + } + +} diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java new file mode 100644 index 00000000000..55c19e4de71 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -0,0 +1,1096 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; + +/** + * This is a class for handling multidimensional arrays for HDF. + *

+ * The purpose is to allow the storage and retrieval of arbitrary array types + * containing scientific data. + *

+ * The methods support the conversion of an array to and from Java to a + * one-dimensional array of bytes suitable for I/O by the C library. + *

+ * This class heavily uses the HDFNativeData class to + * convert between Java and C representations. + */ + +public class HDFArray { + + private Object _theArray = null; + private ArrayDescriptor _desc = null; + private byte[] _barray = null; + + // public HDFArray() {} + + /** + * The input must be a Java Array (possibly multidimensional) of primitive + * numbers or sub-classes of Number. + *

+ * The input is analysed to determine the number of dimensions and size of + * each dimension, as well as the type of the elements. + *

+ * The description is saved in private variables, and used to convert data. + * + * @param anArray + * The array object. + * + * @exception hdf.hdf5lib.exceptions.HDF5Exception + * object is not an array. + */ + public HDFArray(Object anArray) throws HDF5Exception { + + if (anArray == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: array is null?: "); + } + Class tc = anArray.getClass(); + if (tc.isArray() == false) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: not an array?: "); + throw (ex); + } + _theArray = anArray; + _desc = new ArrayDescriptor(_theArray); + + /* extra error checking -- probably not needed */ + if (_desc == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: internal error: array description failed?: "); + throw (ex); + } + } + + /** + * Allocate a one-dimensional array of bytes sufficient to store the array. + * + * @return A one-D array of bytes, filled with zeroes. The bytes are + * sufficient to hold the data of the Array passed to the + * constructor. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * Allocation failed. + */ + + public byte[] emptyBytes() throws HDF5JavaException { + byte[] b = null; + + if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) { + b = (byte[]) _theArray; + } + else { + b = new byte[ArrayDescriptor.totalSize]; + } + if (b == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: emptyBytes: allocation failed"); + throw (ex); + } + return (b); + } + + /** + * Given a Java array of numbers, convert it to a one-dimensional array of + * bytes in correct native order. + * + * @return A one-D array of bytes, constructed from the Array passed to the + * constructor. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * the object not an array or other internal error. + */ + public byte[] byteify() throws HDF5JavaException { + + if (_barray != null) { + return _barray; + } + + if (_theArray == null) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify not an array?: "); + throw (ex); + } + + if (ArrayDescriptor.dims == 1) { + /* special case */ + if (ArrayDescriptor.NT == 'B') { + /* really special case! */ + _barray = (byte[]) _theArray; + return _barray; + } + else { + try { + _barray = new byte[ArrayDescriptor.totalSize]; + + byte[] therow; + if (ArrayDescriptor.NT == 'I') { + therow = HDFNativeData.intToByte(0, + ArrayDescriptor.dimlen[1], (int[]) _theArray); + } + else if (ArrayDescriptor.NT == 'S') { + therow = HDFNativeData.shortToByte(0, + ArrayDescriptor.dimlen[1], (short[]) _theArray); + } + else if (ArrayDescriptor.NT == 'F') { + therow = HDFNativeData.floatToByte(0, + ArrayDescriptor.dimlen[1], (float[]) _theArray); + } + else if (ArrayDescriptor.NT == 'J') { + therow = HDFNativeData.longToByte(0, + ArrayDescriptor.dimlen[1], (long[]) _theArray); + } + else if (ArrayDescriptor.NT == 'D') { + therow = HDFNativeData + .doubleToByte(0, ArrayDescriptor.dimlen[1], + (double[]) _theArray); + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + therow = ByteObjToByte((Byte[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + therow = IntegerToByte((Integer[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + therow = ShortToByte((Short[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + therow = FloatObjToByte((Float[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + therow = DoubleObjToByte((Double[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Long")) { + therow = LongObjToByte((Long[]) _theArray); + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown type of Object?"); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown type of data?"); + throw (ex); + } + System + .arraycopy( + therow, + 0, + _barray, + 0, + (ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize)); + return _barray; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + } + } + + try { + _barray = new byte[ArrayDescriptor.totalSize]; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + + Object oo = _theArray; + int n = 0; /* the current byte */ + int index = 0; + int i; + while (n < ArrayDescriptor.totalSize) { + oo = ArrayDescriptor.objs[0]; + index = n / ArrayDescriptor.bytetoindex[0]; + index %= ArrayDescriptor.dimlen[0]; + for (i = 0; i < (ArrayDescriptor.dims); i++) { + index = n / ArrayDescriptor.bytetoindex[i]; + index %= ArrayDescriptor.dimlen[i]; + + if (index == ArrayDescriptor.currentindex[i]) { + /* then use cached copy */ + oo = ArrayDescriptor.objs[i]; + } + else { + /* check range of index */ + if (index > (ArrayDescriptor.dimlen[i] - 1)) { + throw new java.lang.IndexOutOfBoundsException( + "HDFArray: byteify index OOB?"); + } + oo = java.lang.reflect.Array.get(oo, index); + ArrayDescriptor.currentindex[i] = index; + ArrayDescriptor.objs[i] = oo; + } + } + + /* byte-ify */ + byte arow[]; + try { + if (ArrayDescriptor.NT == 'J') { + arow = HDFNativeData + .longToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData + .longToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'I') { + arow = HDFNativeData + .intToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (int[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'S') { + arow = HDFNativeData + .shortToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'B') { + arow = (byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]; + } + else if (ArrayDescriptor.NT == 'F') { + /* 32 bit float */ + arow = HDFNativeData + .floatToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'D') { + /* 64 bit float */ + arow = HDFNativeData + .doubleToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + arow = ByteObjToByte((Byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + arow = IntegerToByte((Integer[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + arow = ShortToByte((Short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + arow = FloatObjToByte((Float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + arow = DoubleObjToByte((Double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + arow = LongObjToByte((Long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify Object type not implemented?"); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify unknown type not implemented?"); + throw (ex); + } + System + .arraycopy( + arow, + 0, + _barray, + n, + (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + } + /* assert: the whole array is completed--currentindex should == len - 1 */ + + /* error checks */ + + if (n < ArrayDescriptor.totalSize) { + throw new java.lang.InternalError(new String( + "HDFArray::byteify: Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); + } + for (i = 0; i < ArrayDescriptor.dims; i++) { + if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { + throw new java.lang.InternalError(new String( + "Panic didn't complete all data: currentindex[" + i + + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + " ?)")); + } + } + return _barray; + } + + /** + * Given a one-dimensional array of bytes representing numbers, convert it + * to a java array of the shape and size passed to the constructor. + * + * @param bytes + * The bytes to construct the Array. + * @return An Array (possibly multidimensional) of primitive or number + * objects. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * the object not an array or other internal error. + */ + public Object arrayify(byte[] bytes) throws HDF5JavaException { + + if (_theArray == null) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "arrayify: not an array?: "); + throw (ex); + } + + if (java.lang.reflect.Array.getLength(bytes) != ArrayDescriptor.totalSize) { + /* exception: array not right size */ + HDF5JavaException ex = new HDF5JavaException( + "arrayify: array is wrong size?: "); + throw (ex); + } + _barray = bytes; /* hope that the bytes are correct.... */ + if (ArrayDescriptor.dims == 1) { + /* special case */ + /* 2 data copies here! */ + try { + if (ArrayDescriptor.NT == 'I') { + int[] x = HDFNativeData.byteToInt(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'S') { + short[] x = HDFNativeData.byteToShort(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'F') { + float x[] = HDFNativeData.byteToFloat(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'J') { + long x[] = HDFNativeData.byteToLong(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'D') { + double x[] = HDFNativeData.byteToDouble(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'B') { + System.arraycopy(_barray, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + Byte I[] = ByteToByteObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + Integer I[] = ByteToInteger(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + Short I[] = ByteToShort(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + Float I[] = ByteToFloatObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + Double I[] = ByteToDoubleObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + Long I[] = ByteToLongObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else { + HDF5JavaException ex = new HDF5JavaException( + "arrayify: Object type not implemented yet..."); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "arrayify: unknown type not implemented yet..."); + throw (ex); + } + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: arrayify array too big?"); + throw (ex); + } + } + /* Assert dims >= 2 */ + + Object oo = _theArray; + int n = 0; /* the current byte */ + int index = 0; + int i; + while (n < ArrayDescriptor.totalSize) { + oo = ArrayDescriptor.objs[0]; + index = n / ArrayDescriptor.bytetoindex[0]; + index %= ArrayDescriptor.dimlen[0]; + for (i = 0; i < (ArrayDescriptor.dims); i++) { + index = n / ArrayDescriptor.bytetoindex[i]; + index %= ArrayDescriptor.dimlen[i]; + + if (index == ArrayDescriptor.currentindex[i]) { + /* then use cached copy */ + oo = ArrayDescriptor.objs[i]; + } + else { + /* check range of index */ + if (index > (ArrayDescriptor.dimlen[i] - 1)) { + System.out.println("out of bounds?"); + return null; + } + oo = java.lang.reflect.Array.get(oo, index); + ArrayDescriptor.currentindex[i] = index; + ArrayDescriptor.objs[i] = oo; + } + } + + /* array-ify */ + try { + if (ArrayDescriptor.NT == 'J') { + long[] arow = HDFNativeData.byteToLong(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'I') { + int[] arow = HDFNativeData.byteToInt(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'S') { + short[] arow = HDFNativeData.byteToShort(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'B') { + System.arraycopy(_barray, n, + ArrayDescriptor.objs[ArrayDescriptor.dims - 1], 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims]); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + } + else if (ArrayDescriptor.NT == 'F') { + float arow[] = HDFNativeData.byteToFloat(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'D') { + double[] arow = HDFNativeData.byteToDouble(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + Byte I[] = ByteToByteObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + Integer I[] = ByteToInteger(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + Short I[] = ByteToShort(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + Float I[] = ByteToFloatObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + Double I[] = ByteToDoubleObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + Long I[] = ByteToLongObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unsupported Object type: " + + ArrayDescriptor.NT); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown or unsupported type: " + + ArrayDescriptor.NT); + throw (ex); + } + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: arrayify array too big?"); + throw (ex); + } + + } + + /* assert: the whole array is completed--currentindex should == len - 1 */ + + /* error checks */ + + if (n < ArrayDescriptor.totalSize) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); + } + for (i = 0; i <= ArrayDescriptor.dims - 2; i++) { + if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + "?")); + } + } + if (ArrayDescriptor.NT != 'B') { + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + (ArrayDescriptor.dimlen[i]) + + "?")); + } + } + else { + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != (ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1] - 1)) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + "?")); + } + } + + return _theArray; + } + + private byte[] IntegerToByte(Integer in[]) { + int nelems = java.lang.reflect.Array.getLength(in); + int[] out = new int[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].intValue(); + } + return HDFNativeData.intToByte(0, nelems, out); + } + + private Integer[] ByteToInteger(byte[] bin) { + int in[] = HDFNativeData.byteToInt(bin); + int nelems = java.lang.reflect.Array.getLength(in); + Integer[] out = new Integer[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Integer(in[i]); + } + return out; + } + + private Integer[] ByteToInteger(int start, int len, byte[] bin) { + int in[] = HDFNativeData.byteToInt(start, len, bin); + int nelems = java.lang.reflect.Array.getLength(in); + Integer[] out = new Integer[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Integer(in[i]); + } + return out; + } + + private byte[] ShortToByte(Short in[]) { + int nelems = java.lang.reflect.Array.getLength(in); + short[] out = new short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].shortValue(); + } + return HDFNativeData.shortToByte(0, nelems, out); + } + + private Short[] ByteToShort(byte[] bin) { + short in[] = HDFNativeData.byteToShort(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Short[] out = new Short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Short(in[i]); + } + return out; + } + + private Short[] ByteToShort(int start, int len, byte[] bin) { + short in[] = (short[]) HDFNativeData.byteToShort(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Short[] out = new Short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Short(in[i]); + } + return out; + } + + private byte[] ByteObjToByte(Byte in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + byte[] out = new byte[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].byteValue(); + } + return out; + } + + private Byte[] ByteToByteObj(byte[] bin) { + int nelems = java.lang.reflect.Array.getLength((Object) bin); + Byte[] out = new Byte[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Byte(bin[i]); + } + return out; + } + + private Byte[] ByteToByteObj(int start, int len, byte[] bin) { + Byte[] out = new Byte[len]; + + for (int i = 0; i < len; i++) { + out[i] = new Byte(bin[i]); + } + return out; + } + + private byte[] FloatObjToByte(Float in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + float[] out = new float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].floatValue(); + } + return HDFNativeData.floatToByte(0, nelems, out); + } + + private Float[] ByteToFloatObj(byte[] bin) { + float in[] = (float[]) HDFNativeData.byteToFloat(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Float[] out = new Float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Float(in[i]); + } + return out; + } + + private Float[] ByteToFloatObj(int start, int len, byte[] bin) { + float in[] = (float[]) HDFNativeData.byteToFloat(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Float[] out = new Float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Float(in[i]); + } + return out; + } + + private byte[] DoubleObjToByte(Double in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + double[] out = new double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].doubleValue(); + } + return HDFNativeData.doubleToByte(0, nelems, out); + } + + private Double[] ByteToDoubleObj(byte[] bin) { + double in[] = (double[]) HDFNativeData.byteToDouble(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Double[] out = new Double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Double(in[i]); + } + return out; + } + + private Double[] ByteToDoubleObj(int start, int len, byte[] bin) { + double in[] = (double[]) HDFNativeData.byteToDouble(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Double[] out = new Double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Double(in[i]); + } + return out; + } + + private byte[] LongObjToByte(Long in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + long[] out = new long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].longValue(); + } + return HDFNativeData.longToByte(0, nelems, out); + } + + private Long[] ByteToLongObj(byte[] bin) { + long in[] = (long[]) HDFNativeData.byteToLong(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Long[] out = new Long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Long(in[i]); + } + return out; + } + + private Long[] ByteToLongObj(int start, int len, byte[] bin) { + long in[] = (long[]) HDFNativeData.byteToLong(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Long[] out = new Long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Long(in[i]); + } + return out; + } +} + +/** + * This private class is used by HDFArray to discover the shape and type of an + * arbitrary array. + *

+ * We use java.lang.reflection here. + */ +class ArrayDescriptor { + + static String theType = ""; + static Class theClass = null; + static int[] dimlen = null; + static int[] dimstart = null; + static int[] currentindex = null; + static int[] bytetoindex = null; + static int totalSize = 0; + static Object[] objs = null; + static char NT = ' '; /* must be B,S,I,L,F,D, else error */ + static int NTsize = 0; + static int dims = 0; + static String className; + + public ArrayDescriptor(Object anArray) throws HDF5Exception { + + Class tc = anArray.getClass(); + if (tc.isArray() == false) { + /* exception: not an array */ + HDF5Exception ex = new HDF5JavaException( + "ArrayDescriptor: not an array?: "); + throw (ex); + } + + theClass = tc; + + /* + * parse the type descriptor to discover the shape of the array + */ + String ss = tc.toString(); + theType = ss; + int n = 6; + dims = 0; + char c = ' '; + while (n < ss.length()) { + c = ss.charAt(n); + n++; + if (c == '[') { + dims++; + } + } + + String css = ss.substring(ss.lastIndexOf('[') + 1); + Class compC = tc.getComponentType(); + String cs = compC.toString(); + NT = c; /* must be B,S,I,L,F,D, else error */ + if (NT == 'B') { + NTsize = 1; + } + else if (NT == 'S') { + NTsize = 2; + } + else if ((NT == 'I') || (NT == 'F')) { + NTsize = 4; + } + else if ((NT == 'J') || (NT == 'D')) { + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.Byte")) { + NT = 'L'; + className = "java.lang.Byte"; + NTsize = 1; + } + else if (css.startsWith("Ljava.lang.Short")) { + NT = 'L'; + className = "java.lang.Short"; + NTsize = 2; + } + else if (css.startsWith("Ljava.lang.Integer")) { + NT = 'L'; + className = "java.lang.Integer"; + NTsize = 4; + } + else if (css.startsWith("Ljava.lang.Float")) { + NT = 'L'; + className = "java.lang.Float"; + NTsize = 4; + } + else if (css.startsWith("Ljava.lang.Double")) { + NT = 'L'; + className = "java.lang.Double"; + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.Long")) { + NT = 'L'; + className = "java.lang.Long"; + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.String")) { + throw new HDF5JavaException(new String( + "ArrayDesciptor: Error: String array not supported yet")); + } + else { + /* + * exception: not a numeric type + */ + throw new HDF5JavaException(new String( + "ArrayDesciptor: Error: array is not numeric (type is " + + css + ") ?")); + } + + /* fill in the table */ + dimlen = new int[dims + 1]; + dimstart = new int[dims + 1]; + currentindex = new int[dims + 1]; + bytetoindex = new int[dims + 1]; + objs = new Object[dims + 1]; + + Object o = anArray; + objs[0] = o; + dimlen[0] = 1; + dimstart[0] = 0; + currentindex[0] = 0; + int i; + for (i = 1; i <= dims; i++) { + dimlen[i] = java.lang.reflect.Array.getLength((Object) o); + o = java.lang.reflect.Array.get((Object) o, 0); + objs[i] = o; + dimstart[i] = 0; + currentindex[i] = 0; + } + + int j; + int dd; + bytetoindex[dims] = NTsize; + for (i = dims; i >= 0; i--) { + dd = NTsize; + for (j = i; j < dims; j++) { + dd *= dimlen[j + 1]; + } + bytetoindex[i] = dd; + } + + totalSize = bytetoindex[0]; + } + + /** + * Debug dump + */ + public void dumpInfo() { + System.out.println("Type: " + theType); + System.out.println("Class: " + theClass); + System.out.println("NT: " + NT + " NTsize: " + NTsize); + System.out.println("Array has " + dims + " dimensions (" + totalSize + + " bytes)"); + int i; + for (i = 0; i <= dims; i++) { + Class tc = objs[i].getClass(); + String ss = tc.toString(); + System.out.println(i + ": start " + dimstart[i] + ": len " + + dimlen[i] + " current " + currentindex[i] + + " bytetoindex " + bytetoindex[i] + " object " + objs[i] + + " otype " + ss); + } + } +} diff --git a/java/src/hdf/hdf5lib/HDFNativeData.java b/java/src/hdf/hdf5lib/HDFNativeData.java new file mode 100644 index 00000000000..66929fb89e7 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDFNativeData.java @@ -0,0 +1,481 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib; + +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; + +/** + * This class encapsulates native methods to deal with arrays of numbers, + * converting from numbers to bytes and bytes to numbers. + *

+ * These routines are used by class HDFArray to pass data to and from the + * HDF-5 library. + *

+ * Methods xxxToByte() convert a Java array of primitive numbers (int, short, + * ...) to a Java array of bytes. Methods byteToXxx() convert from a Java array + * of bytes into a Java array of primitive numbers (int, short, ...) + *

+ * Variant interfaces convert a section of an array, and also can convert to + * sub-classes of Java Number. + *

+ * See also: hdf.hdf5lib.HDFArray. + */ + +public class HDFNativeData { + + /** + * Convert an array of bytes into an array of ints + * + * @param data + * The input array of bytes + * @return an array of int + */ + public synchronized static native int[] byteToInt(byte[] data); + + /** + * Convert an array of bytes into an array of floats + * + * @param data + * The input array of bytes + * @return an array of float + */ + public synchronized static native float[] byteToFloat(byte[] data); + + /** + * Convert an array of bytes into an array of shorts + * + * @param data + * The input array of bytes + * @return an array of short + */ + public synchronized static native short[] byteToShort(byte[] data); + + /** + * Convert an array of bytes into an array of long + * + * @param data + * The input array of bytes + * @return an array of long + */ + /* + * does this really work? C 'long' is 32 bits, Java 'long' is 64-bits. What + * does this routine actually do? + */ + public synchronized static native long[] byteToLong(byte[] data); + + /** + * Convert an array of bytes into an array of double + * + * @param data + * The input array of bytes + * @return an array of double + */ + public synchronized static native double[] byteToDouble(byte[] data); + + /** + * Convert a range from an array of bytes into an array of int + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'int' to convert + * @param data + * The input array of bytes + * @return an array of 'len' int + */ + public synchronized static native int[] byteToInt(int start, int len, + byte[] data); + + /** + * Convert 4 bytes from an array of bytes into a single int + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The integer value of the bytes. + */ + public synchronized static int byteToInt(byte[] data, int start) { + int[] ival = new int[1]; + ival = byteToInt(start, 1, data); + return (ival[0]); + } + + /** + * Convert a range from an array of bytes into an array of short + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'short' to convert + * @param data + * The input array of bytes + * @return an array of 'len' short + */ + public synchronized static native short[] byteToShort(int start, int len, + byte[] data); + + /** + * Convert 2 bytes from an array of bytes into a single short + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The short value of the bytes. + */ + public synchronized static short byteToShort(byte[] data, int start) { + short[] sval = new short[1]; + sval = byteToShort(start, 1, data); + return (sval[0]); + } + + /** + * Convert a range from an array of bytes into an array of float + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'float' to convert + * @param data + * The input array of bytes + * @return an array of 'len' float + */ + public synchronized static native float[] byteToFloat(int start, int len, + byte[] data); + + /** + * Convert 4 bytes from an array of bytes into a single float + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The float value of the bytes. + */ + public synchronized static float byteToFloat(byte[] data, int start) { + float[] fval = new float[1]; + fval = byteToFloat(start, 1, data); + return (fval[0]); + } + + /** + * Convert a range from an array of bytes into an array of long + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'long' to convert + * @param data + * The input array of bytes + * @return an array of 'len' long + */ + public synchronized static native long[] byteToLong(int start, int len, + byte[] data); + + /** + * Convert 8 bytes from an array of bytes into a single long + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The long value of the bytes. + */ + public synchronized static long byteToLong(byte[] data, int start) { + long[] lval = new long[1]; + lval = byteToLong(start, 1, data); + return (lval[0]); + } + + /** + * Convert a range from an array of bytes into an array of double + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'double' to convert + * @param data + * The input array of bytes + * @return an array of 'len' double + */ + public synchronized static native double[] byteToDouble(int start, int len, + byte[] data); + + /** + * Convert 8 bytes from an array of bytes into a single double + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The double value of the bytes. + */ + public synchronized static double byteToDouble(byte[] data, int start) { + double[] dval = new double[1]; + dval = byteToDouble(start, 1, data); + return (dval[0]); + } + + /** + * Convert a range from an array of int into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'int' to convert + * @param data + * The input array of int + * @return an array of bytes + */ + public synchronized static native byte[] intToByte(int start, int len, + int[] data); + + /** + * Convert a range from an array of short into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'short' to convert + * @param data + * The input array of short + * @return an array of bytes + */ + public synchronized static native byte[] shortToByte(int start, int len, + short[] data); + + /** + * Convert a range from an array of float into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'float' to convert + * @param data + * The input array of float + * @return an array of bytes + */ + public synchronized static native byte[] floatToByte(int start, int len, + float[] data); + + /** + * Convert a range from an array of long into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'long' to convert + * @param data + * The input array of long + * @return an array of bytes + */ + public synchronized static native byte[] longToByte(int start, int len, + long[] data); + + /** + * Convert a range from an array of double into an array of bytes. + * + * @param start + * The position in the input array of double to start + * @param len + * The number of 'double' to convert + * @param data + * The input array of double + * @return an array of bytes + */ + public synchronized static native byte[] doubleToByte(int start, int len, + double[] data); + + /** + * Convert a single byte into an array of one byte. + *

+ * (This is a trivial method.) + * + * @param data + * The input byte + * @return an array of bytes + */ + public synchronized static native byte[] byteToByte(byte data); + + /** + * Convert a single Byte object into an array of one byte. + *

+ * (This is an almost trivial method.) + * + * @param data + * The input Byte + * @return an array of bytes + */ + public synchronized static byte[] byteToByte(Byte data) { + return byteToByte(data.byteValue()); + } + + /** + * Convert a single int into an array of 4 bytes. + * + * @param data + * The input int + * @return an array of bytes + */ + public synchronized static native byte[] intToByte(int data); + + /** + * Convert a single Integer object into an array of 4 bytes. + * + * @param data + * The input Integer + * @return an array of bytes + */ + public synchronized static byte[] intToByte(Integer data) { + return intToByte(data.intValue()); + } + + /** + * Convert a single short into an array of 2 bytes. + * + * @param data + * The input short + * @return an array of bytes + */ + public synchronized static native byte[] shortToByte(short data); + + /** + * Convert a single Short object into an array of 2 bytes. + * + * @param data + * The input Short + * @return an array of bytes + */ + public synchronized static byte[] shortToByte(Short data) { + return shortToByte(data.shortValue()); + } + + /** + * Convert a single float into an array of 4 bytes. + * + * @param data + * The input float + * @return an array of bytes + */ + public synchronized static native byte[] floatToByte(float data); + + /** + * Convert a single Float object into an array of 4 bytes. + * + * @param data + * The input Float + * @return an array of bytes + */ + public synchronized static byte[] floatToByte(Float data) { + return floatToByte(data.floatValue()); + }; + + /** + * Convert a single long into an array of 8 bytes. + * + * @param data + * The input long + * @return an array of bytes + */ + public synchronized static native byte[] longToByte(long data); + + /** + * Convert a single Long object into an array of 8 bytes. + * + * @param data + * The input Long + * @return an array of bytes + */ + public synchronized static byte[] longToByte(Long data) { + return longToByte(data.longValue()); + } + + /** + * Convert a single double into an array of 8 bytes. + * + * @param data + * The input double + * @return an array of bytes + */ + public synchronized static native byte[] doubleToByte(double data); + + /** + * Convert a single Double object into an array of 8 bytes. + * + * @param data + * The input Double + * @return an array of bytes + */ + public synchronized static byte[] doubleToByte(Double data) { + return doubleToByte(data.doubleValue()); + } + + /** + * Create a Number object from an array of bytes. + * + * @param barray + * The bytes to be converted + * @param obj + * Input object of the desired output class. Must be a sub-class + * of Number. + * @return A Object of the type of obj. + * + * @exception HDF5Exception + * - Error unsupported type. + */ + public synchronized static Object byteToNumber(byte[] barray, Object obj) + throws HDF5Exception { + Class theClass = obj.getClass(); + String type = theClass.getName(); + Object retobj = null; + + if (type.equals("java.lang.Integer")) { + int[] i = hdf.hdf5lib.HDFNativeData.byteToInt(0, 1, barray); + retobj = new Integer(i[0]); + } + else if (type.equals("java.lang.Byte")) { + retobj = new Byte(barray[0]); + } + else if (type.equals("java.lang.Short")) { + short[] f = hdf.hdf5lib.HDFNativeData + .byteToShort(0, 1, barray); + retobj = new Short(f[0]); + } + else if (type.equals("java.lang.Float")) { + float[] f = hdf.hdf5lib.HDFNativeData + .byteToFloat(0, 1, barray); + retobj = new Float(f[0]); + } + else if (type.equals("java.lang.Long")) { + long[] f = hdf.hdf5lib.HDFNativeData.byteToLong(0, 1, barray); + retobj = new Long(f[0]); + } + else if (type.equals("java.lang.Double")) { + double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, + barray); + retobj = new Double(f[0]); + } + else { + /* exception: unsupported type */ + HDF5Exception ex = new HDF5JavaException( + "byteToNumber: setfield bad type: " + obj + " " + type); + throw (ex); + } + return (retobj); + } +} diff --git a/java/src/hdf/hdf5lib/callbacks/Callbacks.java b/java/src/hdf/hdf5lib/callbacks/Callbacks.java new file mode 100644 index 00000000000..5757eef4884 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/Callbacks.java @@ -0,0 +1,33 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +/** All callback definitions must derive from this interface. Any + * derived interfaces must define a single public method named "callback". + * You are responsible for deregistering your callback (if necessary) + * in its {@link Object#finalize} method. If native code attempts to call + * a callback which has been GC'd, you will likely crash the VM. If + * there is no method to deregister the callback (e.g. atexit + * in the C library), you must ensure that you always keep a live reference + * to the callback object.

+ * A callback should generally never throw an exception, since it doesn't + * necessarily have an encompassing Java environment to catch it. Any + * exceptions thrown will be passed to the default callback exception + * handler. + */ +public interface Callbacks { + +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java new file mode 100644 index 00000000000..bac3dd9214a --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Diterate) +public interface H5D_iterate_cb extends Callbacks { + int callback(byte[] elem, long elem_type, int ndim, long[] point, H5D_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java new file mode 100644 index 00000000000..03bcc20a6b2 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5D_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java new file mode 100644 index 00000000000..521831160d1 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5L_info_t; + +//Information class for link callback(for H5Lvisit/H5Lvisit_by_name) +public interface H5L_iterate_cb extends Callbacks { + int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java new file mode 100644 index 00000000000..b7c25f4925f --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5L_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java new file mode 100644 index 00000000000..630205f59b7 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5O_info_t; + +//Information class for link callback(for H5Ovisit/H5Ovisit_by_name) +public interface H5O_iterate_cb extends Callbacks { + int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java new file mode 100644 index 00000000000..da64f1966f9 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5O_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java b/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java new file mode 100644 index 00000000000..3309223ce66 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java @@ -0,0 +1,44 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ATOM + */ + +public class HDF5AtomException extends HDF5LibraryException { + /** + * Constructs an HDF5AtomException with no specified detail + * message. + */ + public HDF5AtomException() { + super(); + } + + /** + * Constructs an HDF5AtomException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5AtomException(String s) { + super(s); + } + +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java new file mode 100644 index 00000000000..8c1a7b8534a --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ATTR + */ +public class HDF5AttributeException extends HDF5LibraryException { + /** + * Constructs an HDF5AttributeException with no specified + * detail message. + */ + public HDF5AttributeException() { + super(); + } + + /** + * Constructs an HDF5AttributeException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5AttributeException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java new file mode 100644 index 00000000000..dc82fd97d29 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_BTREE + */ +public class HDF5BtreeException extends HDF5LibraryException { + /** + * Constructs an HDF5BtreeException with no specified detail + * message. + */ + public HDF5BtreeException() { + super(); + } + + /** + * Constructs an HDF5BtreeException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5BtreeException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java new file mode 100644 index 00000000000..17fd9db6094 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_PLINE + */ +public class HDF5DataFiltersException extends HDF5LibraryException { + /** + * Constructs an HDF5DataFiltersException with no specified + * detail message. + */ + public HDF5DataFiltersException() { + super(); + } + + /** + * Constructs an HDF5DataFiltersException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5DataFiltersException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java new file mode 100644 index 00000000000..f22c9ec92f8 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_STORAGE + */ + +public class HDF5DataStorageException extends HDF5LibraryException { + /** + * Constructs an HDF5DataStorageExceptionn with no specified + * detail message. + */ + public HDF5DataStorageException() { + super(); + } + + /** + * Constructs an HDF5DataStorageException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5DataStorageException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java new file mode 100644 index 00000000000..e39709dc917 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATASET + */ +public class HDF5DatasetInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DatasetInterfaceException with no + * specified detail message. + */ + public HDF5DatasetInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DatasetInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DatasetInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java new file mode 100644 index 00000000000..531202c9977 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATASPACE + */ + +public class HDF5DataspaceInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DataspaceInterfaceException with no + * specified detail message. + */ + public HDF5DataspaceInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DataspaceInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DataspaceInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java new file mode 100644 index 00000000000..3c0c144ce44 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATATYPE + */ + +public class HDF5DatatypeInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DatatypeInterfaceException with no + * specified detail message. + */ + public HDF5DatatypeInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DatatypeInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DatatypeInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java new file mode 100644 index 00000000000..8a83ca13eb9 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + *

+ * The class HDF5Exception returns errors from the Java HDF5 Interface. + *

+ * Two sub-classes of HDF5Exception are defined: + *

    + *
  1. + * HDF5LibraryException -- errors raised the HDF5 library code + *
  2. + * HDF5JavaException -- errors raised the HDF5 Java wrapper code + *
+ *

+ * These exceptions are sub-classed to represent specific error conditions, as + * needed. In particular, HDF5LibraryException has a sub-class for each major + * error code returned by the HDF5 library. + * + */ +public class HDF5Exception extends Exception { + protected String detailMessage; + + /** + * Constructs an HDF5Exception with no specified detail + * message. + */ + public HDF5Exception() { + super(); + } + + /** + * Constructs an HDF5Exception with the specified detail + * message. + * + * @param message + * the detail message. + */ + public HDF5Exception(String message) { + super(); + detailMessage = message; + } + + /** + * Returns the detail message of this exception + * + * @return the detail message or null if this object does not + * have a detail message. + */ + @Override + public String getMessage() { + return detailMessage; + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java new file mode 100644 index 00000000000..62c5dd82e3a --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_EFL + */ + +public class HDF5ExternalFileListException extends HDF5LibraryException { + /** + * Constructs an HDF5ExternalFileListException with no + * specified detail message. + */ + public HDF5ExternalFileListException() { + super(); + } + + /** + * Constructs an HDF5ExternalFileListException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5ExternalFileListException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java new file mode 100644 index 00000000000..0b63b41cfcb --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_FILE + */ + +public class HDF5FileInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5FileInterfaceException with no specified + * detail message. + */ + public HDF5FileInterfaceException() { + super(); + } + + /** + * Constructs an HDF5FileInterfaceException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5FileInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java new file mode 100644 index 00000000000..c984aaec0e5 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ARGS + */ + +public class HDF5FunctionArgumentException extends HDF5LibraryException { + /** + * Constructs an HDF5FunctionArgumentException with no + * specified detail message. + */ + public HDF5FunctionArgumentException() { + super(); + } + + /** + * Constructs an HDF5FunctionArgumentException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5FunctionArgumentException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java new file mode 100644 index 00000000000..5dad930ee38 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_FUNC + */ + +public class HDF5FunctionEntryExitException extends HDF5LibraryException { + /** + * Constructs an HDF5FunctionEntryExitException with no + * specified detail message. + */ + public HDF5FunctionEntryExitException() { + super(); + } + + /** + * Constructs an HDF5FunctionEntryExitException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5FunctionEntryExitException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java new file mode 100644 index 00000000000..dfe4ced44c0 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_HEAP + */ + +public class HDF5HeapException extends HDF5LibraryException { + /** + * Constructs an HDF5HeapException with no specified detail + * message. + */ + public HDF5HeapException() { + super(); + } + + /** + * Constructs an HDF5HeapException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5HeapException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java new file mode 100644 index 00000000000..45a836c8091 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_INTERNAL + */ + +public class HDF5InternalErrorException extends HDF5LibraryException { + /** + * Constructs an HDF5InternalErrorException with no specified + * detail message. + */ + public HDF5InternalErrorException() { + super(); + } + + /** + * Constructs an HDF5InternalErrorException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5InternalErrorException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java new file mode 100644 index 00000000000..2db79ef3767 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java @@ -0,0 +1,45 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + *

+ * The class HDF5JavaException returns errors from the Java wrapper of theHDF5 + * library. + *

+ * These errors include Java configuration errors, security violations, and + * resource exhaustion. + */ +public class HDF5JavaException extends HDF5Exception { + /** + * Constructs an HDF5JavaException with no specified detail + * message. + */ + public HDF5JavaException() { + super(); + } + + /** + * Constructs an HDF5JavaException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5JavaException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java new file mode 100644 index 00000000000..8b21ff81c55 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -0,0 +1,383 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +/** + *

+ * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * Each major error code from the HDF-5 Library is represented by a sub-class of + * this class, and by default the 'detailedMessage' is set according to the + * minor error code from the HDF-5 Library. + *

+ * For major and minor error codes, see H5Epublic.h in the HDF-5 library. + * + */ + +@SuppressWarnings("serial") +public class HDF5LibraryException extends HDF5Exception { + /** + * Constructs an HDF5LibraryException with no specified detail + * message. + */ + public HDF5LibraryException() { + super(); + + // this code forces the loading of the HDF-5 library + // to assure that the native methods are available + try { + H5.H5open(); + } + catch (Exception e) { + } + ; + + detailMessage = getMinorError(getMinorErrorNumber()); + } + + /** + * Constructs an HDF5LibraryException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5LibraryException(String s) { + super(s); + // this code forces the loading of the HDF-5 library + // to assure that the native methods are available + try { + H5.H5open(); + } + catch (Exception e) { + } + ; + } + + /** + * Get the major error number of the first error on the HDF5 library error + * stack. + * + * @return the major error number + */ + public native long getMajorErrorNumber(); + + /** + * Get the minor error number of the first error on the HDF5 library error + * stack. + * + * @return the minor error number + */ + public native long getMinorErrorNumber(); + + /** + * Return a error message for the minor error number. + *

+ * These messages come from H5Epublic.h. + * + * @param err_code + * the error code + * + * @return the string of the minor error + */ + public String getMinorError(long err_code) { + if (err_code == 0) { + return "special zero no error"; + } + else if (err_code == HDF5Constants.H5E_UNINITIALIZED) { + return "information is unitialized"; + } + else if (err_code == HDF5Constants.H5E_UNSUPPORTED) { + return "feature is unsupported"; + } + else if (err_code == HDF5Constants.H5E_BADTYPE) { + return "incorrect type found"; + } + else if (err_code == HDF5Constants.H5E_BADRANGE) { + return "argument out of range"; + } + else if (err_code == HDF5Constants.H5E_BADVALUE) { + return "bad value for argument"; + } + else if (err_code == HDF5Constants.H5E_NOSPACE) { + return "no space available for allocation"; + } + else if (err_code == HDF5Constants.H5E_CANTCOPY) { + return "unable to copy object"; + } + else if (err_code == HDF5Constants.H5E_CANTFREE) { + return "unable to free object"; + } + else if (err_code == HDF5Constants.H5E_ALREADYEXISTS) { + return "Object already exists"; + } + else if (err_code == HDF5Constants.H5E_CANTLOCK) { + return "Unable to lock object"; + } + else if (err_code == HDF5Constants.H5E_CANTUNLOCK) { + return "Unable to unlock object"; + } + else if (err_code == HDF5Constants.H5E_FILEEXISTS) { + return "file already exists"; + } + else if (err_code == HDF5Constants.H5E_FILEOPEN) { + return "file already open"; + } + else if (err_code == HDF5Constants.H5E_CANTCREATE) { + return "Can't create file"; + } + else if (err_code == HDF5Constants.H5E_CANTOPENFILE) { + return "Can't open file"; + } + else if (err_code == HDF5Constants.H5E_CANTCLOSEFILE) { + return "Can't close file"; + } + else if (err_code == HDF5Constants.H5E_NOTHDF5) { + return "not an HDF5 format file"; + } + else if (err_code == HDF5Constants.H5E_BADFILE) { + return "bad file ID accessed"; + } + else if (err_code == HDF5Constants.H5E_TRUNCATED) { + return "file has been truncated"; + } + else if (err_code == HDF5Constants.H5E_MOUNT) { + return "file mount error"; + } + else if (err_code == HDF5Constants.H5E_SEEKERROR) { + return "seek failed"; + } + else if (err_code == HDF5Constants.H5E_READERROR) { + return "read failed"; + } + else if (err_code == HDF5Constants.H5E_WRITEERROR) { + return "write failed"; + } + else if (err_code == HDF5Constants.H5E_CLOSEERROR) { + return "close failed"; + } + else if (err_code == HDF5Constants.H5E_OVERFLOW) { + return "address overflowed"; + } + else if (err_code == HDF5Constants.H5E_FCNTL) { + return "file fcntl failed"; + } + else if (err_code == HDF5Constants.H5E_CANTINIT) { + return "Can't initialize object"; + } + else if (err_code == HDF5Constants.H5E_ALREADYINIT) { + return "object already initialized"; + } + else if (err_code == HDF5Constants.H5E_CANTRELEASE) { + return "Can't release object"; + } + else if (err_code == HDF5Constants.H5E_BADATOM) { + return "Can't find atom information"; + } + else if (err_code == HDF5Constants.H5E_BADGROUP) { + return "Can't find group information"; + } + else if (err_code == HDF5Constants.H5E_CANTREGISTER) { + return "Can't register new atom"; + } + else if (err_code == HDF5Constants.H5E_CANTINC) { + return "Can't increment reference count"; + } + else if (err_code == HDF5Constants.H5E_CANTDEC) { + return "Can't decrement reference count"; + } + else if (err_code == HDF5Constants.H5E_NOIDS) { + return "Out of IDs for group"; + } + else if (err_code == HDF5Constants.H5E_CANTFLUSH) { + return "Can't flush object from cache"; + } + else if (err_code == HDF5Constants.H5E_CANTLOAD) { + return "Can't load object into cache"; + } + else if (err_code == HDF5Constants.H5E_PROTECT) { + return "protected object error"; + } + else if (err_code == HDF5Constants.H5E_NOTCACHED) { + return "object not currently cached"; + } + else if (err_code == HDF5Constants.H5E_NOTFOUND) { + return "object not found"; + } + else if (err_code == HDF5Constants.H5E_EXISTS) { + return "object already exists"; + } + else if (err_code == HDF5Constants.H5E_CANTENCODE) { + return "Can't encode value"; + } + else if (err_code == HDF5Constants.H5E_CANTDECODE) { + return "Can't decode value"; + } + else if (err_code == HDF5Constants.H5E_CANTSPLIT) { + return "Can't split node"; + } + else if (err_code == HDF5Constants.H5E_CANTINSERT) { + return "Can't insert object"; + } + else if (err_code == HDF5Constants.H5E_CANTLIST) { + return "Can't list node"; + } + else if (err_code == HDF5Constants.H5E_LINKCOUNT) { + return "bad object header link count"; + } + else if (err_code == HDF5Constants.H5E_VERSION) { + return "wrong version number"; + } + else if (err_code == HDF5Constants.H5E_ALIGNMENT) { + return "alignment error"; + } + else if (err_code == HDF5Constants.H5E_BADMESG) { + return "unrecognized message"; + } + else if (err_code == HDF5Constants.H5E_CANTDELETE) { + return " Can't delete message"; + } + else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) { + return "Can't open object"; + } + else if (err_code == HDF5Constants.H5E_COMPLEN) { + return "name component is too long"; + } + else if (err_code == HDF5Constants.H5E_LINK) { + return "link count failure"; + } + else if (err_code == HDF5Constants.H5E_CANTCONVERT) { + return "Can't convert datatypes"; + } + else if (err_code == HDF5Constants.H5E_BADSIZE) { + return "Bad size for object"; + } + else if (err_code == HDF5Constants.H5E_CANTCLIP) { + return "Can't clip hyperslab region"; + } + else if (err_code == HDF5Constants.H5E_CANTCOUNT) { + return "Can't count elements"; + } + else if (err_code == HDF5Constants.H5E_CANTSELECT) { + return "Can't select hyperslab"; + } + else if (err_code == HDF5Constants.H5E_CANTNEXT) { + return "Can't move to next iterator location"; + } + else if (err_code == HDF5Constants.H5E_BADSELECT) { + return "Invalid selection"; + } + else if (err_code == HDF5Constants.H5E_CANTGET) { + return "Can't get value"; + } + else if (err_code == HDF5Constants.H5E_CANTSET) { + return "Can't set value"; + } + else if (err_code == HDF5Constants.H5E_DUPCLASS) { + return "Duplicate class name in parent class"; + } + else if (err_code == HDF5Constants.H5E_MPI) { + return "some MPI function failed"; + } + else if (err_code == HDF5Constants.H5E_MPIERRSTR) { + return "MPI Error String"; + // } + // else + // if + // (err_code + // == + // HDF5Constants.H5E_CANTRECV + // ) + // { + // return + // "can't receive messages from processes"; + // } + // else + // if + // (err_code + // == + // HDF5Constants.H5E_CANTALLOC + // ) + // { + // return + // "can't allocate from file"; + } + else if (err_code == HDF5Constants.H5E_NOFILTER) { + return "requested filter is not available"; + } + else if (err_code == HDF5Constants.H5E_CALLBACK) { + return "callback failed"; + } + else if (err_code == HDF5Constants.H5E_CANAPPLY) { + return "error from filter \"can apply\" callback"; + } + else if (err_code == HDF5Constants.H5E_SETLOCAL) { + return "error from filter \"set local\" callback"; + } + else { + return "undefined error(" + err_code + ")"; + } + } + + /** + * Prints this HDF5LibraryException, the HDF-5 Library error + * stack, and and the Java stack trace to the standard error stream. + */ + @Override + public void printStackTrace() { + System.err.println(this); + printStackTrace0(null); // the HDF-5 Library error stack + super.printStackTrace(); // the Java stack trace + } + + /** + * Prints this HDF5LibraryException the HDF-5 Library error + * stack, and and the Java stack trace to the specified print stream. + * + * @param f + * the file print stream. + */ + public void printStackTrace(java.io.File f) { + if ((f == null) || !f.exists() || f.isDirectory() || !f.canWrite()) { + printStackTrace(); + } + else { + try { + java.io.FileOutputStream o = new java.io.FileOutputStream(f); + java.io.PrintWriter p = new java.io.PrintWriter(o); + p.println(this); + p.close(); + } + catch (Exception ex) { + System.err.println(this); + } + ; + // the HDF-5 Library error stack + printStackTrace0(f.getPath()); + super.printStackTrace(); // the Java stack trace + } + } + + /* + * This private method calls the HDF-5 library to extract the error codes + * and error stack. + */ + private native void printStackTrace0(String s); + +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java new file mode 100644 index 00000000000..e0a95d08d3a --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_IO + */ + +public class HDF5LowLevelIOException extends HDF5LibraryException { + /** + * Constructs an HDF5LowLevelIOException with no specified + * detail message. + */ + public HDF5LowLevelIOException() { + super(); + } + + /** + * Constructs an HDF5LowLevelIOException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5LowLevelIOException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java new file mode 100644 index 00000000000..cbc3b75ae50 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_CACHE + */ + +public class HDF5MetaDataCacheException extends HDF5LibraryException { + /** + * Constructs an HDF5MetaDataCacheException with no specified + * detail message. + */ + public HDF5MetaDataCacheException() { + super(); + } + + /** + * Constructs an HDF5MetaDataCacheException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5MetaDataCacheException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java new file mode 100644 index 00000000000..0cdd0d1b62d --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_OHDR + */ + +public class HDF5ObjectHeaderException extends HDF5LibraryException { + /** + * Constructs an HDF5ObjectHeaderException with no specified + * detail message. + */ + public HDF5ObjectHeaderException() { + super(); + } + + /** + * Constructs an HDF5ObjectHeaderException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5ObjectHeaderException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java new file mode 100644 index 00000000000..aa9f6688453 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_PLIST + */ + +public class HDF5PropertyListInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5PropertyListInterfaceException with no + * specified detail message. + */ + public HDF5PropertyListInterfaceException() { + super(); + } + + /** + * Constructs an HDF5PropertyListInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5PropertyListInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java new file mode 100644 index 00000000000..2c8c93b2ef0 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +public class HDF5ReferenceException extends HDF5LibraryException { + /** + * Constructs an HDF5ReferenceException with no specified + * detail message. + */ + public HDF5ReferenceException() { + super(); + } + + /** + * Constructs an HDF5ReferenceException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5ReferenceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java new file mode 100644 index 00000000000..f1c0c607d64 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_RESOURCE + */ + +public class HDF5ResourceUnavailableException extends HDF5LibraryException { + /** + * Constructs an HDF5ResourceUnavailableException with no + * specified detail message. + */ + public HDF5ResourceUnavailableException() { + super(); + } + + /** + * Constructs an HDF5FunctionArgumentException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5ResourceUnavailableException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java new file mode 100644 index 00000000000..87384d1be6c --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_SYM + */ + +public class HDF5SymbolTableException extends HDF5LibraryException { + /** + * Constructs an HDF5SymbolTableException with no specified + * detail message. + */ + public HDF5SymbolTableException() { + super(); + } + + /** + * Constructs an HDF5SymbolTableException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5SymbolTableException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java new file mode 100644 index 00000000000..2128d8af088 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java @@ -0,0 +1,99 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for H5Pget_mdc_config/H5Pset_mdc_config +public class H5AC_cache_config_t implements Serializable{ + private static final long serialVersionUID = -6748085696476149972L; + // general configuration fields: + public int version; + public boolean rpt_fcn_enabled; + public boolean open_trace_file; + public boolean close_trace_file; + public String trace_file_name; + public boolean evictions_enabled; + public boolean set_initial_size; + public long initial_size; + public double min_clean_fraction; + public long max_size; + public long min_size; + public long epoch_length; + // size increase control fields: + public int incr_mode; // H5C_cache_incr_mode + public double lower_hr_threshold; + public double increment; + public boolean apply_max_increment; + public long max_increment; + public int flash_incr_mode; // H5C_cache_flash_incr_mode + public double flash_multiple; + public double flash_threshold; + // size decrease control fields: + public int decr_mode; // H5C_cache_decr_mode + public double upper_hr_threshold; + public double decrement; + public boolean apply_max_decrement; + public long max_decrement; + public int epochs_before_eviction; + public boolean apply_empty_reserve; + public double empty_reserve; + // parallel configuration fields: + public long dirty_bytes_threshold; + public int metadata_write_strategy; + + public H5AC_cache_config_t (int version, boolean rpt_fcn_enabled, boolean open_trace_file, + boolean close_trace_file, String trace_file_name, boolean evictions_enabled, + boolean set_initial_size, long initial_size, double min_clean_fraction, long max_size, + long min_size, long epoch_length, int incr_mode, double lower_hr_threshold, + double increment, boolean apply_max_increment, long max_increment, int flash_incr_mode, + double flash_multiple, double flash_threshold, int decr_mode, double upper_hr_threshold, + double decrement, boolean apply_max_decrement, long max_decrement, + int epochs_before_eviction, boolean apply_empty_reserve, double empty_reserve, + long dirty_bytes_threshold, int metadata_write_strategy) + { + this.version = version; + this.rpt_fcn_enabled = rpt_fcn_enabled; + this.open_trace_file = open_trace_file; + this.close_trace_file = close_trace_file; + this.trace_file_name = trace_file_name; + this.evictions_enabled = evictions_enabled; + this.set_initial_size = set_initial_size; + this.initial_size = initial_size; + this.min_clean_fraction = min_clean_fraction; + this.max_size = max_size; + this.min_size = min_size; + this.epoch_length = epoch_length; + this.incr_mode = incr_mode; + this.lower_hr_threshold = lower_hr_threshold; + this.increment = increment; + this.apply_max_increment = apply_max_increment; + this.max_increment = flash_incr_mode; + this.flash_incr_mode = flash_incr_mode; + this.flash_multiple = flash_multiple; + this.flash_threshold = flash_threshold; + this.decr_mode = decr_mode; + this.upper_hr_threshold = upper_hr_threshold; + this.decrement = decrement; + this.apply_max_decrement = apply_max_decrement; + this.max_decrement = max_decrement; + this.epochs_before_eviction = epochs_before_eviction; + this.apply_empty_reserve = apply_empty_reserve; + this.empty_reserve = empty_reserve; + this.dirty_bytes_threshold = dirty_bytes_threshold; + this.metadata_write_strategy = metadata_write_strategy; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java new file mode 100644 index 00000000000..b04a757f515 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java @@ -0,0 +1,34 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for Attribute (For H5Aget_info/H5Aget_info_by_idx/H5Aget_info_by_name) +public class H5A_info_t implements Serializable{ + private static final long serialVersionUID = 2791443594041667613L; + public boolean corder_valid; // Indicate if creation order is valid + public long corder; // Creation order of attribute + public int cset; // Character set of attribute name + public long data_size; // Size of raw data + + H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) { + this.corder_valid = corder_valid; + this.corder = corder; + this.cset = cset; + this.data_size = data_size; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5G_info_t.java b/java/src/hdf/hdf5lib/structs/H5G_info_t.java new file mode 100644 index 00000000000..daa6808b02d --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5G_info_t.java @@ -0,0 +1,27 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) +public class H5G_info_t implements Serializable{ + private static final long serialVersionUID = -3746463015312132912L; + public int storage_type; // Type of storage for links in group + public long nlinks; // Number of links in group + public long max_corder; // Current max. creation order value for group + public boolean mounted; // Whether group has a file mounted on it +} diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java new file mode 100644 index 00000000000..d43853fd0d1 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -0,0 +1,38 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for link (for H5Lget_info/H5Lget_info_by_idx) +public class H5L_info_t implements Serializable{ + private static final long serialVersionUID = -4754320605310155033L; + public int type; + public boolean corder_valid; + public long corder; + public int cset; + public long address_val_size; + + H5L_info_t (int type, boolean corder_valid, long corder, + int cset, long address_val_size) + { + this.type = type; + this.corder_valid = corder_valid; + this.corder = corder; + this.cset = cset; + this.address_val_size = address_val_size; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java new file mode 100644 index 00000000000..86cf88348be --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -0,0 +1,49 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +// Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +public class H5O_hdr_info_t implements Serializable{ + private static final long serialVersionUID = 7883826382952577189L; + public int version; /* Version number of header format in file */ + public int nmesgs; /* Number of object header messages */ + public int nchunks; /* Number of object header chunks */ + public int flags; /* Object header status flags */ + public long space_total; /* Total space for storing object header in file */ + public long space_meta; /* Space within header for object header metadata information */ + public long space_mesg; /* Space within header for actual message information */ + public long space_free; /* Free space within object header */ + public long mesg_present; /* Flags to indicate presence of message type in header */ + public long mesg_shared; /* Flags to indicate message type is shared in header */ + + H5O_hdr_info_t (int version, int nmesgs, int nchunks, int flags, + long space_total, long space_meta, long space_mesg, long space_free, + long mesg_present, long mesg_shared) + { + this.version = version; + this.nmesgs = nmesgs; + this.nchunks = nchunks; + this.flags = flags; + this.space_total = space_total; + this.space_meta = space_meta; + this.space_mesg = space_mesg; + this.space_free = space_free; + this.mesg_present = mesg_present; + this.mesg_shared = mesg_shared; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java new file mode 100644 index 00000000000..a89aaf0e7a7 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -0,0 +1,54 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +public class H5O_info_t implements Serializable{ + private static final long serialVersionUID = 4691681163544054518L; + public long fileno; /* File number that object is located in */ + public long addr; /* Object address in file */ + public int type; /* Basic object type (group, dataset, etc.) */ + public int rc; /* Reference count of object */ + public long atime; /* Access time */ + public long mtime; /* Modification time */ + public long ctime; /* Change time */ + public long btime; /* Birth time */ + public long num_attrs; /* # of attributes attached to object */ + public H5O_hdr_info_t hdr; /* Object header information */ + /* Extra metadata storage for obj & attributes */ + public H5_ih_info_t meta_size_obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + public H5_ih_info_t meta_size_attr; /* v2 B-tree & heap for attributes */ + + public H5O_info_t (long fileno, long addr, int type, + int rc, long num_attrs, long atime, long mtime, long ctime, long btime, + H5O_hdr_info_t hdr, H5_ih_info_t meta_size_obj, H5_ih_info_t meta_size_attr) + { + this.fileno = fileno; + this.addr = addr; + this.type = type; + this.rc = rc; + this.num_attrs = num_attrs; + this.atime = atime; + this.mtime = mtime; + this.ctime = ctime; + this.btime = btime; + this.hdr = hdr; + this.meta_size_obj = meta_size_obj; + this.meta_size_attr = meta_size_attr; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java new file mode 100644 index 00000000000..450f5483815 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -0,0 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) +public class H5_ih_info_t implements Serializable { + private static final long serialVersionUID = -142238015615462707L; + public long index_size; /* btree and/or list */ + public long heap_size; + + H5_ih_info_t (long index_size, long heap_size) + { + this.index_size = index_size; + this.heap_size = heap_size; + } +} diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt new file mode 100644 index 00000000000..6ee56c8216c --- /dev/null +++ b/java/src/jni/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_JNI C CXX) + +set (HDF5_JAVA_JNI_CSRCS + ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Constants.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Imp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c +) + +set (HDF5_JAVA_JNI_CHDRS + ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h +) + +INCLUDE_DIRECTORIES( ${HDF5_JAVA_JNI_SOURCE_DIR} ) + +set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +########### JNI libraries always must be built shared ############### +add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) +TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ") +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") +H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) +if (WIN32) + get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) + # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") + if (BUILD_TESTING) + add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} + COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) + endif (BUILD_TESTING) +endif (WIN32) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + install ( + TARGETS + ${HDF5_JAVA_JNI_LIB_TARGET} + EXPORT + ${HDF5_JAVA_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + ) +endif (HDF5_EXPORTED_TARGETS) diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am new file mode 100644 index 00000000000..764fcdb380b --- /dev/null +++ b/java/src/jni/Makefile.am @@ -0,0 +1,44 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Java native interface (JNI) Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am +include $(top_srcdir)/config/lt_vers.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +# Include src directory and JNI flags +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/java/src/jni $(JNIFLAGS) + +# This is our main target +lib_LTLIBRARIES=libhdf5_java.la + +# Add libtool numbers to the HDF5 Java (JNI) library (from config/lt_vers.am) +libhdf5_java_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) + +# Source files for the library +libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \ + h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \ + h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c + +# HDF5 Java (JNI) library depends on HDF5 Library. +libhdf5_java_la_LIBADD=$(LIBHDF5) + +include $(top_srcdir)/config/conclude.am diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c new file mode 100644 index 00000000000..8623ca9138c --- /dev/null +++ b/java/src/jni/exceptionImp.c @@ -0,0 +1,414 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/***********/ +/* Headers */ +/***********/ + +#include "hdf5.h" +#include +#include +#include "jni.h" +#include "h5jni.h" +#include "exceptionImp.h" + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* These types are copied from H5Eprivate.h + * They should be moved to a public include file, and deleted from + * here. + */ + +#define H5E_NSLOTS 32 /*number of slots in an error stack */ + +/* + * The list of error messages in the system is kept as an array of + * error_code/message pairs, one for major error numbers and another for + * minor error numbers. + */ +typedef struct H5E_major_mesg_t { + hid_t error_code; + const char *str; +} H5E_major_mesg_t; + +typedef struct H5E_minor_mesg_t { + hid_t error_code; + const char *str; +} H5E_minor_mesg_t; + +/* major and minor error numbers */ +typedef struct H5E_num_t { + hid_t maj_num; + hid_t min_num; +} H5E_num_t; + +/********************/ +/* Local Macros */ +/********************/ + +#define THROWEXCEPTION(className,args) { \ + jclass jc; \ + jmethodID jm; \ + jobject ex; \ + jc = ENVPTR->FindClass(ENVPAR (className)); \ + if (jc == NULL) { \ + return JNI_FALSE; \ + } \ + jm = ENVPTR->GetMethodID(ENVPAR jc, "", "(Ljava/lang/String;)V"); \ + if (jm == NULL) { \ + return JNI_FALSE; \ + } \ + ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \ + if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \ + printf("FATAL ERROR: %s: Throw failed\n", (className)); \ + return JNI_FALSE; \ + } \ + return JNI_TRUE; \ +} + +/********************/ +/* Local Prototypes */ +/********************/ + +static const char *defineHDF5LibraryException(hid_t maj_num); +static jboolean H5JNIErrorClass(JNIEnv *env, const char *message, const char *className); + +/* get the major and minor error numbers on the top of the error stack */ +static herr_t +walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *_err_nums) +{ + H5E_num_t *err_nums = (H5E_num_t *)_err_nums; + + if(err_desc) { + err_nums->maj_num = err_desc->maj_num; + err_nums->min_num = err_desc->min_num; + } /* end if */ + + return 0; +} /* end walk_error_callback() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDF5Library + * Method: H5error_off + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss) +{ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + return 0; +} /* end Java_hdf_hdf5lib_H5_H5error_1off() */ + + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: printStackTrace0 + * Signature: (Ljava/lang/Object;)V + * + * Call the HDF-5 library to print the HDF-5 error stack to 'file_name'. + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0( + JNIEnv *env, jobject obj, jstring file_name) +{ + FILE *stream = NULL; + const char *file = NULL; + + if(file_name == NULL) { + H5Eprint2(H5E_DEFAULT, stderr); + } /* end if */ + else { + file = ENVPTR->GetStringUTFChars(ENVPAR file_name, 0); + stream = HDfopen(file, "a+"); + if(stream) { + H5Eprint2(H5E_DEFAULT, stream); + HDfclose(stream); + } /* end if */ + ENVPTR->ReleaseStringUTFChars(ENVPAR file_name, file); + } /* end else */ +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMajorErrorNumber + * Signature: ()J + * + * Extract the HDF-5 major error number from the HDF-5 error stack. + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber( + JNIEnv *env, jobject obj) +{ + H5E_num_t err_nums; + err_nums.maj_num = 0; + err_nums.min_num = 0; + + H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); + + return err_nums.maj_num; +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMinorErrorNumber + * Signature: ()J + * + * Extract the HDF-5 minor error number from the HDF-5 error stack. + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber( + JNIEnv *env, jobject obj) +{ + H5E_num_t err_nums; + err_nums.maj_num = 0; + err_nums.min_num = 0; + + H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); + + return err_nums.min_num; +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber() */ + +/* + * Routine to raise particular Java exceptions from C + */ +static +jboolean +H5JNIErrorClass(JNIEnv *env, const char *message, const char *className) +{ + char *args[2]; + jstring str = ENVPTR->NewStringUTF(ENVPAR message); + args[0] = (char *)str; + args[1] = 0; + + THROWEXCEPTION(className, args); +} /* end H5JNIErrorClass() */ + +/* + * Create and throw an 'outOfMemoryException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5outOfMemory(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/OutOfMemoryError"); +} /* end h5outOfMemory() */ + + +/* + * A fatal error in a JNI call + * Create and throw an 'InternalError' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5JNIFatalError(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/InternalError"); +} /* end h5JNIFatalError() */ + +/* + * A NULL argument in an HDF5 call + * Create and throw an 'NullPointerException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5nullArgument(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/NullPointerException"); +} /* end h5nullArgument() */ + +/* + * A bad argument in an HDF5 call + * Create and throw an 'IllegalArgumentException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5badArgument(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/IllegalArgumentException"); +} /* end h5badArgument() */ + +/* + * Some feature Not implemented yet + * Create and throw an 'UnsupportedOperationException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5unimplemented(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/UnsupportedOperationException"); +} /* end h5unimplemented() */ + +/* h5raiseException(). This routine is called to generate + * an arbitrary Java exception with a particular message. + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5raiseException(JNIEnv *env, const char *exception, const char *message) +{ + return H5JNIErrorClass(env, message, exception); +} /* end h5raiseException() */ + +/* + * h5libraryError() determines the HDF-5 major error code + * and creates and throws the appropriate sub-class of + * HDF5LibraryException(). This routine should be called + * whenever a call to the HDF-5 library fails, i.e., when + * the return is -1. + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5libraryError(JNIEnv *env) +{ + char *args[2]; + const char *exception = NULL; + char *msg_str = NULL; + int num_errs = 0; + hid_t min_num; + hid_t maj_num; + ssize_t msg_size = 0; + H5E_type_t error_msg_type; + jstring str = NULL; + hid_t stk_id = -1; + H5E_num_t exceptionNumbers; + + exceptionNumbers.maj_num = 0; + exceptionNumbers.min_num = 0; + + /* Save current stack contents for future use */ + stk_id = H5Eget_current_stack(); /* This will clear current stack */ + if(stk_id >= 0) + H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers); + maj_num = exceptionNumbers.maj_num; + min_num = exceptionNumbers.min_num; + + exception = defineHDF5LibraryException(maj_num); + + /* get the length of the name */ + msg_size = H5Eget_msg(min_num, NULL, NULL, 0); + if(msg_size > 0) { + msg_size++; /* add extra space for the null terminator */ + msg_str = (char*)HDcalloc((size_t)msg_size, sizeof(char)); + if(msg_str) { + msg_size = H5Eget_msg(min_num, &error_msg_type, (char *)msg_str, (size_t)msg_size); + str = ENVPTR->NewStringUTF(ENVPAR msg_str); + HDfree(msg_str); + } /* end if */ + } /* end if */ + else + str = NULL; + if(stk_id >= 0) + H5Eset_current_stack(stk_id); + + args[0] = (char *)str; + args[1] = 0; + THROWEXCEPTION(exception, args); +} /* end h5libraryError() */ + + +/* + * defineHDF5LibraryException() returns the name of the sub-class + * which goes with an HDF-5 error code. + */ +static const char * +defineHDF5LibraryException(hid_t maj_num) +{ + hid_t err_num = maj_num; + + if (H5E_ARGS == err_num) + return "hdf/hdf5lib/exceptions/HDF5FunctionArgumentException"; + else if (H5E_RESOURCE == err_num) + return "hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException"; + else if (H5E_INTERNAL == err_num) + return "hdf/hdf5lib/exceptions/HDF5InternalErrorException"; + else if (H5E_FILE == err_num) + return "hdf/hdf5lib/exceptions/HDF5FileInterfaceException"; + else if (H5E_IO == err_num) + return "hdf/hdf5lib/exceptions/HDF5LowLevelIOException"; + else if (H5E_FUNC == err_num) + return "hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException"; + else if (H5E_ATOM == err_num) + return "hdf/hdf5lib/exceptions/HDF5AtomException"; + else if (H5E_CACHE == err_num) + return "hdf/hdf5lib/exceptions/HDF5MetaDataCacheException"; + else if (H5E_BTREE == err_num) + return "hdf/hdf5lib/exceptions/HDF5BtreeException"; + else if (H5E_SYM == err_num) + return "hdf/hdf5lib/exceptions/HDF5SymbolTableException"; + else if (H5E_HEAP == err_num) + return "hdf/hdf5lib/exceptions/HDF5HeapException"; + else if (H5E_OHDR == err_num) + return "hdf/hdf5lib/exceptions/HDF5ObjectHeaderException"; + else if (H5E_DATATYPE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException"; + else if (H5E_DATASPACE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException"; + else if (H5E_DATASET == err_num) + return "hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException"; + else if (H5E_STORAGE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataStorageException"; + else if (H5E_PLIST == err_num) + return "hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException"; + else if (H5E_ATTR == err_num) + return "hdf/hdf5lib/exceptions/HDF5AttributeException"; + else if (H5E_PLINE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataFiltersException"; + else if (H5E_EFL == err_num) + return "hdf/hdf5lib/exceptions/HDF5ExternalFileListException"; + else if (H5E_REFERENCE == err_num) + return "hdf/hdf5lib/exceptions/HDF5ReferenceException"; + + return "hdf/hdf5lib/exceptions/HDF5LibraryException"; +} /* end defineHDF5LibraryException() */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h new file mode 100644 index 00000000000..e238372ae5b --- /dev/null +++ b/java/src/jni/exceptionImp.h @@ -0,0 +1,67 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_exception */ + +#ifndef _Included_hdf_hdf5lib_H5_exception +#define _Included_hdf_hdf5lib_H5_exception + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_exceptions_HDF5Library + * Method: H5error_off + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss ); + + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: printStackTrace0 + * Signature: (Ljava/lang/Object;)V + * + * Call the HDF-5 library to print the HDF-5 error stack to 'file_name'. + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0(JNIEnv *env, + jobject obj, jstring file_name); + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMajorErrorNumber + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber(JNIEnv *env, jobject obj); + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMinorErrorNumber + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber(JNIEnv *env, jobject obj); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_exception */ diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c new file mode 100644 index 00000000000..f1d49be3a05 --- /dev/null +++ b/java/src/jni/h5Constants.c @@ -0,0 +1,692 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" + +#pragma GCC diagnostic ignored "-Wmissing-prototypes" + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1ALLOW_1K13_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_ALLOW_K13_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1CHIP_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_CHIP_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1EC_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_EC_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1MAX_1PIXELS_1PER_1BLOCK(JNIEnv *env, jclass cls) { return H5_SZIP_MAX_PIXELS_PER_BLOCK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1NN_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_NN_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_INDEX_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1NAME(JNIEnv *env, jclass cls) { return H5_INDEX_NAME; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1CRT_1ORDER(JNIEnv *env, jclass cls) { return H5_INDEX_CRT_ORDER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1N(JNIEnv *env, jclass cls) { return H5_INDEX_N; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_ITER_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1INC(JNIEnv *env, jclass cls) { return H5_ITER_INC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1DEC(JNIEnv *env, jclass cls) { return H5_ITER_DEC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1NATIVE(JNIEnv *env, jclass cls) { return H5_ITER_NATIVE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1N(JNIEnv *env, jclass cls) { return H5_ITER_N; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1CURR_1CACHE_1CONFIG_1VERSION(JNIEnv *env, jclass cls) { return H5AC__CURR_CACHE_CONFIG_VERSION; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1MAX_1TRACE_1FILE_1NAME_1LEN(JNIEnv *env, jclass cls) { return H5AC__MAX_TRACE_FILE_NAME_LEN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1PROCESS_1ZERO_1ONLY(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1DISTRIBUTED(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1off(JNIEnv *env, jclass cls) { return H5C_incr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1threshold(JNIEnv *env, jclass cls) { return H5C_incr__threshold; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1off(JNIEnv *env, jclass cls) { return H5C_flash_incr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1add_1space(JNIEnv *env, jclass cls) { return H5C_flash_incr__add_space; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1off(JNIEnv *env, jclass cls) { return H5C_decr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__threshold; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out(JNIEnv *env, jclass cls) { return H5C_decr__age_out; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out_1with_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__age_out_with_threshold; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1IDX_1BTREE(JNIEnv *env, jclass cls) { return H5D_CHUNK_IDX_BTREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1EARLY(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_EARLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1INCR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_INCR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1LATE(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_LATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ALLOC(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ALLOC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1NEVER(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_NEVER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1IFSET(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_IFSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1UNDEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_UNDEFINED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1USER_1DEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_USER_DEFINED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1LAYOUT_1ERROR(JNIEnv *env, jclass cls) { return H5D_LAYOUT_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNKED(JNIEnv *env, jclass cls) { return H5D_CHUNKED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1COMPACT(JNIEnv *env, jclass cls) { return H5D_COMPACT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CONTIGUOUS(JNIEnv *env, jclass cls) { return H5D_CONTIGUOUS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VIRTUAL(JNIEnv *env, jclass cls) { return H5D_VIRTUAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1NLAYOUTS(JNIEnv *env, jclass cls) { return H5D_NLAYOUTS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ERROR(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1NOT_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_NOT_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1PART_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_PART_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1ERROR(JNIEnv *env, jclass cls) { return H5D_VDS_ERROR; } +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 jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYEXISTS(JNIEnv *env, jclass cls) { return H5E_ALREADYEXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYINIT(JNIEnv *env, jclass cls) { return H5E_ALREADYINIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls) { return H5E_ARGS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls) { return H5E_ATOM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) { return H5E_ATTR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls) { return H5E_BADATOM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls) { return H5E_BADFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADGROUP(JNIEnv *env, jclass cls) { return H5E_BADGROUP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADMESG(JNIEnv *env, jclass cls) { return H5E_BADMESG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADRANGE(JNIEnv *env, jclass cls) { return H5E_BADRANGE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSELECT(JNIEnv *env, jclass cls) { return H5E_BADSELECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSIZE(JNIEnv *env, jclass cls) { return H5E_BADSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADTYPE(JNIEnv *env, jclass cls) { return H5E_BADTYPE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADVALUE(JNIEnv *env, jclass cls) { return H5E_BADVALUE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BTREE(JNIEnv *env, jclass cls) { return H5E_BTREE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CACHE(JNIEnv *env, jclass cls) { return H5E_CACHE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CALLBACK(JNIEnv *env, jclass cls) { return H5E_CALLBACK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANAPPLY(JNIEnv *env, jclass cls) { return H5E_CANAPPLY; } +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTALLOC(JNIEnv *env, jclass cls) { return H5E_CANTALLOC; }*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLIP(JNIEnv *env, jclass cls) { return H5E_CANTCLIP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLOSEFILE(JNIEnv *env, jclass cls) { return H5E_CANTCLOSEFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCONVERT(JNIEnv *env, jclass cls) { return H5E_CANTCONVERT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOPY(JNIEnv *env, jclass cls) { return H5E_CANTCOPY; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOUNT(JNIEnv *env, jclass cls) { return H5E_CANTCOUNT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCREATE(JNIEnv *env, jclass cls) { return H5E_CANTCREATE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDEC(JNIEnv *env, jclass cls) { return H5E_CANTDEC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return H5E_CANTDECODE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFREE(JNIEnv *env, jclass cls) { return H5E_CANTFREE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTGET(JNIEnv *env, jclass cls) { return H5E_CANTGET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINC(JNIEnv *env, jclass cls) { return H5E_CANTINC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINIT(JNIEnv *env, jclass cls) { return H5E_CANTINIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINSERT(JNIEnv *env, jclass cls) { return H5E_CANTINSERT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLIST(JNIEnv *env, jclass cls) { return H5E_CANTLIST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOAD(JNIEnv *env, jclass cls) { return H5E_CANTLOAD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOCK(JNIEnv *env, jclass cls) { return H5E_CANTLOCK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTNEXT(JNIEnv *env, jclass cls) { return H5E_CANTNEXT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENFILE(JNIEnv *env, jclass cls) { return H5E_CANTOPENFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENOBJ(JNIEnv *env, jclass cls) { return H5E_CANTOPENOBJ; } +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRECV(JNIEnv *env, jclass cls) { return H5E_CANTRECV; }*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTREGISTER(JNIEnv *env, jclass cls) { return H5E_CANTREGISTER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRELEASE(JNIEnv *env, jclass cls) { return H5E_CANTRELEASE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSELECT(JNIEnv *env, jclass cls) { return H5E_CANTSELECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSET(JNIEnv *env, jclass cls) { return H5E_CANTSET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSPLIT(JNIEnv *env, jclass cls) { return H5E_CANTSPLIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTUNLOCK(JNIEnv *env, jclass cls) { return H5E_CANTUNLOCK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CLOSEERROR(JNIEnv *env, jclass cls) { return H5E_CLOSEERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1COMPLEN(JNIEnv *env, jclass cls) { return H5E_COMPLEN; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASET(JNIEnv *env, jclass cls) { return H5E_DATASET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASPACE(JNIEnv *env, jclass cls) { return H5E_DATASPACE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATATYPE(JNIEnv *env, jclass cls) { return H5E_DATATYPE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DEFAULT(JNIEnv *env, jclass cls) { return H5E_DEFAULT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DUPCLASS(JNIEnv *env, jclass cls) { return H5E_DUPCLASS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EFL(JNIEnv *env, jclass cls) { return H5E_EFL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EXISTS(JNIEnv *env, jclass cls) { return H5E_EXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FCNTL(JNIEnv *env, jclass cls) { return H5E_FCNTL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILE(JNIEnv *env, jclass cls) { return H5E_FILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEEXISTS(JNIEnv *env, jclass cls) { return H5E_FILEEXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEOPEN(JNIEnv *env, jclass cls) { return H5E_FILEOPEN; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FUNC(JNIEnv *env, jclass cls) { return H5E_FUNC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1HEAP(JNIEnv *env, jclass cls) { return H5E_HEAP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1INTERNAL(JNIEnv *env, jclass cls) { return H5E_INTERNAL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1IO(JNIEnv *env, jclass cls) { return H5E_IO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINK(JNIEnv *env, jclass cls) { return H5E_LINK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINKCOUNT(JNIEnv *env, jclass cls) { return H5E_LINKCOUNT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MAJOR(JNIEnv *env, jclass cls) { return H5E_MAJOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MINOR(JNIEnv *env, jclass cls) { return H5E_MINOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MOUNT(JNIEnv *env, jclass cls) { return H5E_MOUNT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPI(JNIEnv *env, jclass cls) { return H5E_MPI; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPIERRSTR(JNIEnv *env, jclass cls) { return H5E_MPIERRSTR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOFILTER(JNIEnv *env, jclass cls) { return H5E_NOFILTER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOIDS(JNIEnv *env, jclass cls) { return H5E_NOIDS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MAJOR(JNIEnv *env, jclass cls) { return H5E_NONE_MAJOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MINOR(JNIEnv *env, jclass cls) { return H5E_NONE_MINOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOSPACE(JNIEnv *env, jclass cls) { return H5E_NOSPACE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTCACHED(JNIEnv *env, jclass cls) { return H5E_NOTCACHED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTFOUND(JNIEnv *env, jclass cls) { return H5E_NOTFOUND; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTHDF5(JNIEnv *env, jclass cls) { return H5E_NOTHDF5; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OHDR(JNIEnv *env, jclass cls) { return H5E_OHDR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OVERFLOW(JNIEnv *env, jclass cls) { return H5E_OVERFLOW; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLINE(JNIEnv *env, jclass cls) { return H5E_PLINE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLIST(JNIEnv *env, jclass cls) { return H5E_PLIST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PROTECT(JNIEnv *env, jclass cls) { return H5E_PROTECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1READERROR(JNIEnv *env, jclass cls) { return H5E_READERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1REFERENCE(JNIEnv *env, jclass cls) { return H5E_REFERENCE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RESOURCE(JNIEnv *env, jclass cls) { return H5E_RESOURCE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RS(JNIEnv *env, jclass cls) { return H5E_RS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SEEKERROR(JNIEnv *env, jclass cls) { return H5E_SEEKERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SETLOCAL(JNIEnv *env, jclass cls) { return H5E_SETLOCAL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1STORAGE(JNIEnv *env, jclass cls) { return H5E_STORAGE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SYM(JNIEnv *env, jclass cls) { return H5E_SYM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TRUNCATED(JNIEnv *env, jclass cls) { return H5E_TRUNCATED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TST(JNIEnv *env, jclass cls) { return H5E_TST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNINITIALIZED(JNIEnv *env, jclass cls) { return H5E_UNINITIALIZED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNSUPPORTED(JNIEnv *env, jclass cls) { return H5E_UNSUPPORTED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5E_VERSION; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; } + +/* Java does not have unsigned native types */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1EXCL(JNIEnv *env, jclass cls) { return H5F_ACC_EXCL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDONLY(JNIEnv *env, jclass cls) { return H5F_ACC_RDONLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDWR(JNIEnv *env, jclass cls) { return H5F_ACC_RDWR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1TRUNC(JNIEnv *env, jclass cls) { return H5F_ACC_TRUNC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_ACC_DEFAULT; } +#pragma GCC diagnostic pop + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1SEMI(JNIEnv *env, jclass cls) { return H5F_CLOSE_SEMI; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { return H5F_CLOSE_STRONG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ATTR(JNIEnv *env, jclass cls) { return H5F_OBJ_ATTR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATASET(JNIEnv *env, jclass cls) { return H5F_OBJ_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATATYPE(JNIEnv *env, jclass cls) { return H5F_OBJ_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1FILE(JNIEnv *env, jclass cls) { return H5F_OBJ_FILE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1GROUP(JNIEnv *env, jclass cls) { return H5F_OBJ_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1LOCAL(JNIEnv *env, jclass cls) { return H5F_OBJ_LOCAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1GLOBAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_GLOBAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1LOCAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_LOCAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5F_UNLIMITED; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL_1PERSIST(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL_PERSIST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1AGGR_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_AGGR_VFD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_VFD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_NTYPES; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls) { return H5FD_CORE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_DIRECT + return H5FD_DIRECT; +#else + return -1; +#endif +} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5FD_MULTI; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_WINDOWS + return H5FD_DIRECT; +#else + return -1; +#endif +} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FLAVOR(JNIEnv *env, jclass cls) { return H5FD_LOG_FLAVOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1TRUNCATE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_TRUNCATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1OPEN(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_OPEN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1STAT(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_STAT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1CLOSE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_CLOSE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALLOC(JNIEnv *env, jclass cls) { return H5FD_LOG_ALLOC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALL(JNIEnv *env, jclass cls) { return H5FD_LOG_ALL; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NOLIST(JNIEnv *env, jclass cls) { return H5FD_MEM_NOLIST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT(JNIEnv *env, jclass cls) { return H5FD_MEM_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1SUPER(JNIEnv *env, jclass cls) { return H5FD_MEM_SUPER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1BTREE(JNIEnv *env, jclass cls) { return H5FD_MEM_BTREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DRAW(JNIEnv *env, jclass cls) { return H5FD_MEM_DRAW; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1GHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_GHEAP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1LHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_LHEAP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1OHDR(JNIEnv *env, jclass cls) { return H5FD_MEM_OHDR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NTYPES(JNIEnv *env, jclass cls) { return H5FD_MEM_NTYPES; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DEFAULT_1HADDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(HADDR_MAX/H5FD_MEM_NTYPES); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SUPER_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1BTREE_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(1 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1DRAW_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(2 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1GHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(3 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1LHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(4 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(5 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } + + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls) { return H5G_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) { return H5G_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) { return H5G_LINK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) { return H5G_UDLINK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) { return H5G_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) { return H5G_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) { return H5G_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) { return H5G_TYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) { return H5G_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) { return H5G_LINK_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls) { return H5G_LINK_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls) { return H5G_LINK_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NLIBTYPES(JNIEnv *env, jclass cls) { return H5G_NLIBTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NTYPES(JNIEnv *env, jclass cls) { return H5G_NTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NUSERTYPES(JNIEnv *env, jclass cls) { return H5G_NUSERTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1SAME_1LOC(JNIEnv *env, jclass cls) { return H5G_SAME_LOC; } + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1SYMBOL_1TABLE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_SYMBOL_TABLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1COMPACT(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_COMPACT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1DENSE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_DENSE; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1UNINIT(JNIEnv *env, jclass cls) { return H5I_UNINIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1BADID(JNIEnv *env, jclass cls) { return H5I_BADID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1FILE(JNIEnv *env, jclass cls) { return H5I_FILE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GROUP(JNIEnv *env, jclass cls) { return H5I_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATATYPE(JNIEnv *env, jclass cls) { return H5I_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASPACE(JNIEnv *env, jclass cls) { return H5I_DATASPACE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5I_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1LST(JNIEnv *env, jclass cls) { return H5I_GENPROP_LST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1CLASS(JNIEnv *env, jclass cls) { return H5I_ERROR_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1MSG(JNIEnv *env, jclass cls) { return H5I_ERROR_MSG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1STACK(JNIEnv *env, jclass cls) { return H5I_ERROR_STACK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1NTYPES(JNIEnv *env, jclass cls) { return H5I_NTYPES; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5L_TYPE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1HARD(JNIEnv *env, jclass cls) { return H5L_TYPE_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1SOFT(JNIEnv *env, jclass cls) { return H5L_TYPE_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1EXTERNAL(JNIEnv *env, jclass cls) { return H5L_TYPE_EXTERNAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1MAX(JNIEnv *env, jclass cls) { return H5L_TYPE_MAX; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1SHALLOW_1HIERARCHY_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_SHALLOW_HIERARCHY_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1SOFT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_SOFT_LINK_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1EXT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_EXT_LINK_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1REFERENCE_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_REFERENCE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_WITHOUT_ATTR_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1DTYPE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_DTYPE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1FILL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_FILL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1PLINE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_PLINE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ATTR_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ALL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ALL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls) { return H5O_TYPE_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1GROUP(JNIEnv *env, jclass cls) { return H5O_TYPE_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1DATASET(JNIEnv *env, jclass cls) { return H5O_TYPE_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1CREATE(JNIEnv *env, jclass cls){return H5P_OBJECT_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE(JNIEnv *env, jclass cls){return H5P_FILE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER(JNIEnv *env, jclass cls){return H5P_DATASET_XFER;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1STRING_1CREATE(JNIEnv *env, jclass cls){return H5P_STRING_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return H5P_LINK_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_XFER_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY_1DEFAULT(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1INDEXED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_INDEXED;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DEFAULT(JNIEnv *env, jclass cls) { return H5P_DEFAULT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5P_ROOT; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5PL_TYPE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5R_BADTYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; } +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_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; } +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_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) { return H5S_MAX_RANK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5S_NO_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) { return H5S_NULL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) { return H5S_SCALAR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) { return H5S_SEL_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) { return H5S_SEL_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) { return H5S_SEL_HYPERSLABS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) { return H5S_SEL_N; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) { return H5S_SEL_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) { return H5S_SEL_POINTS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) { return H5S_SELECT_AND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_APPEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls) { return H5S_SELECT_INVALID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls) { return H5S_SELECT_NOOP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTA(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTA; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTB(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTB; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1OR(JNIEnv *env, jclass cls) { return H5S_SELECT_OR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1PREPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_PREPEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1SET(JNIEnv *env, jclass cls) { return H5S_SELECT_SET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1XOR(JNIEnv *env, jclass cls) { return H5S_SELECT_XOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SIMPLE(JNIEnv *env, jclass cls) { return H5S_SIMPLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5S_UNLIMITED; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B16(JNIEnv *env, jclass cls) { return H5T_ALPHA_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B32(JNIEnv *env, jclass cls) { return H5T_ALPHA_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B64(JNIEnv *env, jclass cls) { return H5T_ALPHA_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B8(JNIEnv *env, jclass cls) { return H5T_ALPHA_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F32(JNIEnv *env, jclass cls) { return H5T_ALPHA_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F64(JNIEnv *env, jclass cls) { return H5T_ALPHA_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I16(JNIEnv *env, jclass cls) { return H5T_ALPHA_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I32(JNIEnv *env, jclass cls) { return H5T_ALPHA_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I64(JNIEnv *env, jclass cls) { return H5T_ALPHA_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I8(JNIEnv *env, jclass cls) { return H5T_ALPHA_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U16(JNIEnv *env, jclass cls) { return H5T_ALPHA_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U32(JNIEnv *env, jclass cls) { return H5T_ALPHA_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U64(JNIEnv *env, jclass cls) { return H5T_ALPHA_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U8(JNIEnv *env, jclass cls) { return H5T_ALPHA_U8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ARRAY(JNIEnv *env, jclass cls) { return H5T_ARRAY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BITFIELD(JNIEnv *env, jclass cls) { return H5T_BITFIELD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1NO(JNIEnv *env, jclass cls) { return H5T_BKG_NO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1YES(JNIEnv *env, jclass cls) { return H5T_BKG_YES; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls) { return H5T_C_S1; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls) { return H5T_COMPOUND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1CONV(JNIEnv *env, jclass cls) { return H5T_CONV_CONV; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1FREE(JNIEnv *env, jclass cls) { return H5T_CONV_FREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls) { return H5T_CONV_INIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls) { return H5T_CSET_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ASCII(JNIEnv *env, jclass cls) { return H5T_CSET_ASCII; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1UTF8(JNIEnv *env, jclass cls) { return H5T_CSET_UTF8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_10; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_11; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_12; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_13; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_14; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_15; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_12(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_2; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_3; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_4; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_9; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1ASCEND(JNIEnv *env, jclass cls) { return H5T_DIR_ASCEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DEFAULT(JNIEnv *env, jclass cls) { return H5T_DIR_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DESCEND(JNIEnv *env, jclass cls) { return H5T_DIR_DESCEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ENUM(JNIEnv *env, jclass cls) { return H5T_ENUM; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT(JNIEnv *env, jclass cls) { return H5T_FLOAT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls) { return H5T_FORTRAN_S1; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls) { return H5T_INTEGER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B16(JNIEnv *env, jclass cls) { return H5T_INTEL_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B32(JNIEnv *env, jclass cls) { return H5T_INTEL_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B64(JNIEnv *env, jclass cls) { return H5T_INTEL_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B8(JNIEnv *env, jclass cls) { return H5T_INTEL_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F32(JNIEnv *env, jclass cls) { return H5T_INTEL_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F64(JNIEnv *env, jclass cls) { return H5T_INTEL_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I16(JNIEnv *env, jclass cls) { return H5T_INTEL_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I32(JNIEnv *env, jclass cls) { return H5T_INTEL_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I64(JNIEnv *env, jclass cls) { return H5T_INTEL_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I8(JNIEnv *env, jclass cls) { return H5T_INTEL_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U16(JNIEnv *env, jclass cls) { return H5T_INTEL_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U32(JNIEnv *env, jclass cls) { return H5T_INTEL_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U64(JNIEnv *env, jclass cls) { return H5T_INTEL_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U8(JNIEnv *env, jclass cls) { return H5T_INTEL_U8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B16(JNIEnv *env, jclass cls) { return H5T_MIPS_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B32(JNIEnv *env, jclass cls) { return H5T_MIPS_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B64(JNIEnv *env, jclass cls) { return H5T_MIPS_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B8(JNIEnv *env, jclass cls) { return H5T_MIPS_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F32(JNIEnv *env, jclass cls) { return H5T_MIPS_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F64(JNIEnv *env, jclass cls) { return H5T_MIPS_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I16(JNIEnv *env, jclass cls) { return H5T_MIPS_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I32(JNIEnv *env, jclass cls) { return H5T_MIPS_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I64(JNIEnv *env, jclass cls) { return H5T_MIPS_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I8(JNIEnv *env, jclass cls) { return H5T_MIPS_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U16(JNIEnv *env, jclass cls) { return H5T_MIPS_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U32(JNIEnv *env, jclass cls) { return H5T_MIPS_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U64(JNIEnv *env, jclass cls) { return H5T_MIPS_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U8(JNIEnv *env, jclass cls) { return H5T_MIPS_U8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B16(JNIEnv *env, jclass cls) { return H5T_NATIVE_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B32(JNIEnv *env, jclass cls) { return H5T_NATIVE_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B64(JNIEnv *env, jclass cls) { return H5T_NATIVE_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B8(JNIEnv *env, jclass cls) { return H5T_NATIVE_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1CHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_CHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_DOUBLE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls) { return H5T_NATIVE_FLOAT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HADDR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HBOOL(JNIEnv *env, jclass cls) { return H5T_NATIVE_HBOOL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HERR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HERR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_LDOUBLE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LLONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_NATIVE_OPAQUE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_SCHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_SHORT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_UCHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULLONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1USHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_USHORT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NCLASSES(JNIEnv *env, jclass cls) { return H5T_NCLASSES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5T_NO_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1ERROR(JNIEnv *env, jclass cls) { return H5T_NORM_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1IMPLIED(JNIEnv *env, jclass cls) { return H5T_NORM_IMPLIED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1MSBSET(JNIEnv *env, jclass cls) { return H5T_NORM_MSBSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1NONE(JNIEnv *env, jclass cls) { return H5T_NORM_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NPAD(JNIEnv *env, jclass cls) { return H5T_NPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NSGN(JNIEnv *env, jclass cls) { return H5T_NSGN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_OPAQUE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE_1TAG_1MAX(JNIEnv *env, jclass cls) { return H5T_OPAQUE_TAG_MAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1BE(JNIEnv *env, jclass cls) { return H5T_ORDER_BE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1ERROR(JNIEnv *env, jclass cls) { return H5T_ORDER_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1LE(JNIEnv *env, jclass cls) { return H5T_ORDER_LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1NONE(JNIEnv *env, jclass cls) { return H5T_ORDER_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1VAX(JNIEnv *env, jclass cls) { return H5T_ORDER_VAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1BACKGROUND(JNIEnv *env, jclass cls) { return H5T_PAD_BACKGROUND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ERROR(JNIEnv *env, jclass cls) { return H5T_PAD_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ONE(JNIEnv *env, jclass cls) { return H5T_PAD_ONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ZERO(JNIEnv *env, jclass cls) { return H5T_PAD_ZERO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1DONTCARE(JNIEnv *env, jclass cls) { return H5T_PERS_DONTCARE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1HARD(JNIEnv *env, jclass cls) { return H5T_PERS_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1SOFT(JNIEnv *env, jclass cls) { return H5T_PERS_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1REFERENCE(JNIEnv *env, jclass cls) { return H5T_REFERENCE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_12(JNIEnv *env, jclass cls) { return H5T_SGN_2; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1ERROR(JNIEnv *env, jclass cls) { return H5T_SGN_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1NONE(JNIEnv *env, jclass cls) { return H5T_SGN_NONE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16BE(JNIEnv *env, jclass cls) { return H5T_STD_B16BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16LE(JNIEnv *env, jclass cls) { return H5T_STD_B16LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32BE(JNIEnv *env, jclass cls) { return H5T_STD_B32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32LE(JNIEnv *env, jclass cls) { return H5T_STD_B32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64BE(JNIEnv *env, jclass cls) { return H5T_STD_B64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64LE(JNIEnv *env, jclass cls) { return H5T_STD_B64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8BE(JNIEnv *env, jclass cls) { return H5T_STD_B8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8LE(JNIEnv *env, jclass cls) { return H5T_STD_B8LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16BE(JNIEnv *env, jclass cls) { return H5T_STD_I16BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16LE(JNIEnv *env, jclass cls) { return H5T_STD_I16LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32BE(JNIEnv *env, jclass cls) { return H5T_STD_I32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32LE(JNIEnv *env, jclass cls) { return H5T_STD_I32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64BE(JNIEnv *env, jclass cls) { return H5T_STD_I64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64LE(JNIEnv *env, jclass cls) { return H5T_STD_I64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8BE(JNIEnv *env, jclass cls) { return H5T_STD_I8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8LE(JNIEnv *env, jclass cls) { return H5T_STD_I8LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) { return H5T_STD_REF_DSETREG; } +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_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; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32BE(JNIEnv *env, jclass cls) { return H5T_STD_U32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32LE(JNIEnv *env, jclass cls) { return H5T_STD_U32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64BE(JNIEnv *env, jclass cls) { return H5T_STD_U64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64LE(JNIEnv *env, jclass cls) { return H5T_STD_U64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8BE(JNIEnv *env, jclass cls) { return H5T_STD_U8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8LE(JNIEnv *env, jclass cls) { return H5T_STD_U8LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1ERROR(JNIEnv *env, jclass cls) { return H5T_STR_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLPAD(JNIEnv *env, jclass cls) { return H5T_STR_NULLPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLTERM(JNIEnv *env, jclass cls) { return H5T_STR_NULLTERM; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_10; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_11; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_12; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_13; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_14; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_15; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_3; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_4; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_9; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1SPACEPAD(JNIEnv *env, jclass cls) { return H5T_STR_SPACEPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STRING(JNIEnv *env, jclass cls) { return H5T_STRING; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1TIME(JNIEnv *env, jclass cls) { return H5T_TIME; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls) { return H5Z_CB_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1FAIL(JNIEnv *env, jclass cls) { return H5Z_CB_FAIL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1NO(JNIEnv *env, jclass cls) { return H5Z_CB_NO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1DISABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_DISABLE_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ENABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_ENABLE_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ERROR_1EDC(JNIEnv *env, jclass cls) { return H5Z_ERROR_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1DECODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_DECODE_ENABLED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1ENCODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_ENCODE_ENABLED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1DEFLATE(JNIEnv *env, jclass cls) { return H5Z_FILTER_DEFLATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ERROR(JNIEnv *env, jclass cls) { return H5Z_FILTER_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1FLETCHER32(JNIEnv *env, jclass cls) { return H5Z_FILTER_FLETCHER32; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1MAX(JNIEnv *env, jclass cls) { return H5Z_FILTER_MAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NBIT(JNIEnv *env, jclass cls) {return H5Z_FILTER_NBIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NONE(JNIEnv *env, jclass cls) { return H5Z_FILTER_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1RESERVED(JNIEnv *env, jclass cls) { return H5Z_FILTER_RESERVED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SCALEOFFSET(JNIEnv *env, jclass cls){ return H5Z_FILTER_SCALEOFFSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SHUFFLE(JNIEnv *env, jclass cls) { return H5Z_FILTER_SHUFFLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SZIP(JNIEnv *env, jclass cls) { return H5Z_FILTER_SZIP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1DEFMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_DEFMASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1INVMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_INVMASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1MANDATORY(JNIEnv *env, jclass cls) { return H5Z_FLAG_MANDATORY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1OPTIONAL(JNIEnv *env, jclass cls) { return H5Z_FLAG_OPTIONAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1REVERSE(JNIEnv *env, jclass cls) { return H5Z_FLAG_REVERSE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1SKIP_1EDC(JNIEnv *env, jclass cls) { return H5Z_FLAG_SKIP_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1MAX_1NFILTERS(JNIEnv *env, jclass cls) { return H5Z_MAX_NFILTERS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NO_1EDC(JNIEnv *env, jclass cls) { return H5Z_NO_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT_1MINBITS_1DEFAULT(JNIEnv *env, jclass cls) { return H5Z_SO_INT_MINBITS_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1DSCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_DSCALE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1ESCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_ESCALE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT(JNIEnv *env, jclass cls){return H5Z_SO_INT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_TOTAL_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_TOTAL_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1MASK(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPB(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPB; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1BPP(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_BPP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPS(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NBIT_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_NBIT_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SCALEOFFSET_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; } + +#pragma GCC diagnostic pop + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c new file mode 100644 index 00000000000..05d5d59d72f --- /dev/null +++ b/java/src/jni/h5Imp.c @@ -0,0 +1,181 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * This code is the C-interface called by Java programs to access the + * general library functions of the HDF5 library. + * + * Each routine wraps a single HDF entry point, generally with the + * analogous arguments and return codes. + * + */ + +#include "hdf5.h" +#include +#include "h5jni.h" +#include "h5Imp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5open + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5open(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5open(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5open */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5close + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5close(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5close(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5dont_atexit + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5dont_1atexit(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5dont_atexit(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5dont_1atexit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5get_libversion + * Signature: ([I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5get_1libversion(JNIEnv *env, jclass clss, jintArray libversion) +{ + unsigned *theArray = NULL; + herr_t status = -1; + jboolean isCopy; + + if (libversion == NULL) { + h5nullArgument(env, "H5get_version: libversion is NULL"); + } /* end if */ + else { + theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy); + if (theArray == NULL) { + h5JNIFatalError( env, "H5get_libversion: input not pinned"); + } /* end if */ + else { + status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0); + } /* end else */ + } /* end else */ + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5get_1libversion */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5check_version + * Signature: (III)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5check_1version(JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum) +{ + return (jint)H5check_version((unsigned)majnum, (unsigned)minnum, (unsigned)relnum); +} /* end Java_hdf_hdf5lib_H5_H5check_1version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5garbage_collect + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5garbage_1collect(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5garbage_collect(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5garbage_1collect */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5set_free_list_limits + * Signature: (IIIIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits(JNIEnv *env, jclass clss, jint reg_global_lim, jint reg_list_lim, + jint arr_global_lim, jint arr_list_lim, jint blk_global_lim, jint blk_list_lim ) +{ + herr_t retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim, + (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5is_library_threadsafe + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv *env, jclass clss) +{ + hbool_t is_ts = false; + H5is_library_threadsafe(&is_ts); + return (jboolean)is_ts; +} /* end Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h new file mode 100644 index 00000000000..660037828c3 --- /dev/null +++ b/java/src/jni/h5Imp.h @@ -0,0 +1,95 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5 */ + +#ifndef _Included_hdf_hdf5lib_H5_H5 +#define _Included_hdf_hdf5lib_H5_H5 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5open + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5open + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5close + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5close + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5dont_atexit + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5dont_1atexit + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5get_libversion + * Signature: ([I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5get_1libversion + (JNIEnv *, jclass, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5check_version + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5check_1version + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5garbage_collect + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5garbage_1collect + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5set_free_list_limits + * Signature: (IIIIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jint ); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5is_library_threadsafe + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe + (JNIEnv *, jclass); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5 */ diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c new file mode 100644 index 00000000000..a081271f3a7 --- /dev/null +++ b/java/src/jni/h5aImp.c @@ -0,0 +1,879 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include "h5util.h" +#include +#include +#include +#include "h5aImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus +#define CBENVPTR (cbenv) +#define CBENVPAR +#define JVMPTR (jvm) +#define JVMPAR +#define JVMPAR2 +#else +#define CBENVPTR (*cbenv) +#define CBENVPAR cbenv, +#define JVMPTR (*jvm) +#define JVMPAR jvm +#define JVMPAR2 jvm, +#endif + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Acreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist) +{ + hid_t attr_id = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + attr_id = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, aName); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_name + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + hid_t attr_id = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + attr_id = H5Aopen_name((hid_t)loc_id, aName); + + UNPIN_JAVA_STRING(name,aName); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_idx + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1idx(JNIEnv *env, jclass clss, jlong loc_id, jint idx) +{ + hid_t attr_id = H5Aopen_idx((hid_t)loc_id, (unsigned int) idx); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument( env,"H5Awrite: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env,"H5Awrite: buf is not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, byteP); + + /* free the buffer without copying back */ + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument( env,"H5Aread: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError( env,"H5Aread: buf is not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1space(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_space((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1type(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_type((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *env, jclass clss, jlong attr_id) +{ + char *aName; + jstring str = NULL; + ssize_t buf_size; + + /* get the length of the name */ + buf_size = H5Aget_name((hid_t)attr_id, NULL, 0); + + if (buf_size <= 0) { + h5badArgument(env, "H5Aget_name: buf_size <= 0"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (aName == NULL) { + h5outOfMemory(env, "H5Aget_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Aget_name((hid_t)attr_id, (size_t)buf_size, aName); + if (buf_size < 0) { + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + /* save the string; */ + str = ENVPTR->NewStringUTF(ENVPAR aName); + HDfree(aName); + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_num_attrs + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs(JNIEnv *env, jclass clss, jlong loc_id) +{ + int retVal = -1; + + retVal = H5Aget_num_attrs((hid_t)loc_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Adelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + herr_t status = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + status = H5Adelete((hid_t)loc_id, aName); + + UNPIN_JAVA_STRING(name, aName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Adelete */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Aclose(JNIEnv *env, jclass clss, jlong attr_id) +{ + herr_t retVal = -1; + + if (attr_id > 0) + retVal = H5Aclose((hid_t)attr_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Acreate2 + * Signature: (JLjava/lang/String;JJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist, jlong access_plist) +{ + hid_t status = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + status = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, + (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist ); + + UNPIN_JAVA_STRING(name, aName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen(JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist) + +{ + hid_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, aName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_idx + * Signature: (JLjava/lang/String;IIJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type, jint order, jlong n, jlong aapl_id, jlong lapl_id) +{ + hid_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + retVal = H5Aopen_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, aName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */ + +/* +* Class: hdf_hdf5lib_H5 +* Method: _H5Acreate_by_name +* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J +*/ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id, jlong aapl_id, jlong lapl_id) +{ + hid_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1); + + retVal = H5Acreate_by_name((hid_t)loc_id, aName, attrName, (hid_t)type_id, + (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Aexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + htri_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, JNI_FALSE); + + retVal = H5Aexists_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jboolean)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aexists_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename + * Signature: (JLjava/lang/String;Ljava/lang/String)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Arename(JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name, jstring new_attr_name) +{ + herr_t retVal = -1; + const char *oName; + const char *nName; + + PIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName, -1); + + retVal = H5Arename((hid_t)loc_id, oName, nName); + + UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Arename */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Arename_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring old_attr_name, jstring new_attr_name, jlong lapl_id) +{ + herr_t retVal = -1; + const char *aName; + const char *oName; + const char *nName; + + PIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName, -1); + + retVal = H5Arename_by_name((hid_t)loc_id, aName, oName, nName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Arename_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + size_t buf_size; + char *aValue; + jlong status_size; + jstring str = NULL; + const char *aName; + + PIN_JAVA_STRING(obj_name, aName, NULL); + + /* get the length of the attribute name */ + status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t) order, (hsize_t) n, (char*)NULL, (size_t)0, (hid_t)lapl_id); + + if(status_size < 0) { + UNPIN_JAVA_STRING(obj_name, aName); + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */ + + aValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (aValue == NULL) { + UNPIN_JAVA_STRING(obj_name, aName); + h5outOfMemory(env, "H5Aget_name_by_idx: malloc failed "); + } /* end if */ + else { + status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t) order, (hsize_t) n, (char*)aValue, (size_t)buf_size, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status_size < 0) { + HDfree(aValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aValue); + HDfree(aValue); + if (str == NULL) { + /* exception -- fatal JNI error */ + h5JNIFatalError(env, "H5Aget_name_by_idx: return string not created"); + } /* end if */ + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1storage_1size(JNIEnv *env, jclass clss, jlong attr_id) +{ + hsize_t retVal = (hsize_t)-1; + + retVal = H5Aget_storage_size((hid_t)attr_id); +/* probably returns '0' if fails--don't do an exception */ + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1storage_1size */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info(JNIEnv *env, jclass clss, jlong attr_id) +{ + herr_t status = -1; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + + status = H5Aget_info((hid_t)attr_id, &ainfo); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + herr_t status; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + const char *aName; + + PIN_JAVA_STRING(obj_name, aName, NULL); + + status = H5Aget_info_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + const char *aName; + const char *attrName; + herr_t status; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, NULL); + + status = H5Aget_info_by_name((hid_t)loc_id, aName, attrName, &ainfo, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Adelete_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + herr_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1); + + retVal = H5Adelete_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists + * Signature: (JLjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Aexists(JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name) +{ + htri_t bval = JNI_FALSE; + const char *aName; + + PIN_JAVA_STRING(attr_name, aName, JNI_FALSE); + + bval = H5Aexists((hid_t)obj_id, aName); + + UNPIN_JAVA_STRING(attr_name, aName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Aexists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + herr_t status = -1; + const char *aName; + + PIN_JAVA_STRING0(obj_name, aName); + + status = H5Adelete_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong aapl_id, jlong lapl_id) + +{ + hid_t status = -1; + const char *aName; + const char *oName; + + PIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName, -1); + + status = H5Aopen_by_name((hid_t)loc_id, oName, aName, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_create_plist((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist */ + +static herr_t +H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) { + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[4]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].z = info->corder_valid; + args[1].j = info->corder; + args[2].i = info->cset; + args[3].j = (jlong)info->data_size; + /* get a reference to your class if you don't have it already */ + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5A_info_t"); + if (cls != 0) { + /* get a reference to the constructor; the name is */ + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(ZJIJ)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + } /* end if (constructor != 0) */ + } /* end if (cls != 0) */ + } /* end if (mid != 0) */ + } /* end if (cls != 0) */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + + return (herr_t)status; +} /* end H5A_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aiterate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aiterate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data, jlong access_id) +{ + const char *lName; + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h new file mode 100644 index 00000000000..bbc61f5f51f --- /dev/null +++ b/java/src/jni/h5aImp.h @@ -0,0 +1,273 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5A */ + +#ifndef _Included_hdf_hdf5lib_H5_H5A +#define _Included_hdf_hdf5lib_H5_H5A + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Acreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate + (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_name + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1name + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_idx + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1idx + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1space + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_num_attrs + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Aclose + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Acreate2 + * Signature: (JLjava/lang/String;JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate2 +(JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen + (JNIEnv *, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_idx + * Signature: (JLjava/lang/String;IIJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong, jlong); + +/* +* Class: hdf_hdf5lib_H5 +* Method: _H5Acreate_by_name +* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J +*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name +(JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename + * Signature: (JLjava/lang/String;Ljava/lang/String)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Aget_1storage_1size + (JNIEnv *, jclass, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists + * Signature: (JLjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate + (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong); + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5A */ diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c new file mode 100644 index 00000000000..f70cb5e1518 --- /dev/null +++ b/java/src/jni/h5dImp.c @@ -0,0 +1,1758 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5dImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus + #ifdef _WINDOWS + #include + #endif + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DreadVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); + +/********************/ +/* Local Macros */ +/********************/ + +#define PIN_BYTE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jbyte*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_BYTE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_SHORT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jshort*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetShortArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_SHORT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseShortArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_INT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jint*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetIntArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_INT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseIntArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_LONG_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jlong*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetLongArrayElements(ENVPAR buf,&isCopy); \ +} + +#define UNPIN_LONG_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_FLOAT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jfloat*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetFloatArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_FLOAT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseFloatArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_DOUBLE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jdouble*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetDoubleArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_DOUBLE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseDoubleArrayElements(ENVPAR buf, buffP, mode); \ +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist_id) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, fileName); + + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1space(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_space((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1type(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_type((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_create_plist((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist */ + +static htri_t +H5Tdetect_variable_str(hid_t tid) { + htri_t ret_val = 0; + + if (H5Tget_class(tid) == H5T_COMPOUND) { + unsigned i; + unsigned nm = (unsigned)H5Tget_nmembers(tid); + for(i = 0; i < nm; i++) { + htri_t status = 0; + hid_t mtid = 0; + if((mtid = H5Tget_member_type(tid, i)) < 0) + return -1; /* exit immediately on error */ + if((status = H5Tdetect_variable_str(mtid)) < 0) + return status; /* exit immediately on error */ + ret_val |= status; + H5Tclose (mtid); + } /* end for */ + } /* end if */ + else + ret_val = H5Tis_variable_str(tid); + + return ret_val; +} /* end H5Tdetect_variable_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +{ + herr_t status; + jbyte *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread: buf does not support variable length type"); + } /* end else if */ + else { + PIN_BYTE_ARRAY(); + + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_BYTE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_BYTE_ARRAY(0); /* update java buffer for return */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +{ + herr_t status; + jbyte *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite: buf does not support variable length type"); + } /* end else if */ + else { + PIN_BYTE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */ + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Dclose(JNIEnv *env, jclass clss, jlong dataset_id) +{ + herr_t retVal = -1; + + retVal = H5Dclose((hid_t)dataset_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1storage_1size(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hsize_t retVal = (hsize_t)-1; + + if (dataset_id < 0) { + h5badArgument(env, "H5Dget_storage_size: not a dataset"); + } /* end if */ + else { + retVal = H5Dget_storage_size((hid_t)dataset_id); + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1storage_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_reclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim(JNIEnv *env, jclass clss, jlong type_id, jlong space_id, + jlong xfer_plist_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument(env, "H5Dvlen_reclaim: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Dvlen_reclaim: buf not pinned"); + } /* end if */ + else { + status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, byteP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim */ + +/* + //////////////////////////////////////////////////////////////////// + // // + // New APIs for read data from library // + // Using H5Dread(..., Object buf) requires function calls // + // theArray.emptyBytes() and theArray.arrayify(buf), which // + // triples the actual memory needed by the data set. // + // Using the following APIs solves the problem. // + // // + //////////////////////////////////////////////////////////////////// +*/ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jshort *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_short: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_short: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_short: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_short: buf does not support variable length type"); + } /* end else if */ + else { + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_short: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_SHORT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_SHORT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1short */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jshort *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL ) { + h5nullArgument(env, "H5Dwrite_short: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_short: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_short: buf does not support variable length type"); + } /* end else if */ + else { + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_short: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_SHORT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1short */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_int: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_int: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_int: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_INT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_INT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_int: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_int: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_int: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_INT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_long: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_long: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_long: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_LONG_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_LONG_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_long: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_long: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_long: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_LONG_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_float: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_FLOAT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_FLOAT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_float: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_FLOAT_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_double: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_DOUBLE_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_double: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +{ + herr_t status = -1; + char *c_buf; + char *cstr; + size_t str_len; + jsize i; + jsize n; + size_t pos; + jstring jstr; + + c_buf = cstr = NULL; + if (j_buf == NULL) { + h5nullArgument(env, "H5Dread_string: buf is NULL"); + } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Dread_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ + else { + if ((cstr = (char*)HDmalloc(str_len + 1)) == NULL) { + h5JNIFatalError(env, "H5Dread_string: memory allocation failed."); + } /* end if */ + else { + if ((c_buf = (char*)HDmalloc((size_t)n * str_len)) == NULL) { + if (cstr) + HDfree(cstr); + cstr = NULL; + h5JNIFatalError(env, "H5Dread_string: memory allocation failed."); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf); + + if (status < 0) { + if (cstr) + HDfree(cstr); + cstr = NULL; + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + h5libraryError(env); + } /* end if */ + else { + pos = 0; + for (i = 0; i < n; i++) { + HDmemcpy(cstr, c_buf+pos, str_len); + cstr[str_len] = '\0'; + jstr = ENVPTR->NewStringUTF(ENVPAR cstr); + ENVPTR->SetObjectArrayElement(ENVPAR j_buf, i, jstr); + pos += str_len; + } /* end for */ + } /* end else */ + + if (c_buf) + HDfree(c_buf); + } /* end else cbuf allocation*/ + + if (cstr) + HDfree(cstr); + } /* end else cstr allocation*/ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1string */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +{ + herr_t status = -1; + char *c_buf; + jsize str_len; + jsize i; + jsize n; + + if (j_buf == NULL) { + h5nullArgument(env, "H5Dwrite_string: buf is NULL"); + } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Dwrite_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = (jsize)H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ + else { + if ((c_buf = (char*)HDmalloc((size_t)n * (size_t)str_len)) == NULL) { + h5JNIFatalError(env, "H5Dwrite_string: memory allocation failed."); + } /* end if */ + else { + for (i = 0; i < n; i++) { + jstring obj = (jstring)ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)j_buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + strncpy(&c_buf[i * str_len], utf8, str_len); + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for */ + + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf); + + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + + if (status < 0) { + h5libraryError(env); + } /* end if */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1string */ + +/** + * Read VLEN data into array of arrays. + * Object[] buf contains VL arrays of data points + * Currently only deal with variable length of atomic data types + */ +/* old version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + htri_t isVlenStr=0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_VLStrings: buf is NULL"); + } /* end if */ + else { + isVlenStr = H5Tis_variable_str((hid_t)mem_type_id); + + if (isVlenStr) { + status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, + (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, buf); + } /* end if */ + else + h5badArgument(env, "H5Dread_VLStrings: type is not variable length String"); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */ + +herr_t +H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t + file_sid, hid_t xfer_plist_id, jobjectArray buf) +{ + char **strs; + jstring jstr; + jint i; + jint n; + herr_t status = -1; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + strs =(char**)HDcalloc((size_t)n, sizeof(char*)); + + if (strs == NULL) { + h5JNIFatalError(env, "H5DreadVL_str: failed to allocate buff for read variable length strings"); + } /* end if */ + else { + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs); + + if (status < 0) { + H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); + HDfree(strs); + h5JNIFatalError(env, "H5DreadVL_str: failed to read variable length strings"); + } /* end if */ + else { + for (i=0; i < n; i++) { + jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]); + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + H5free_memory (strs[i]); + } /* end for */ + + /* + for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings, + H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings + after it is done. + H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); + */ + + HDfree(strs); + } /* end else */ + } /* end else */ + + return status; +} /* end H5DreadVL_str */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + htri_t isVlenStr=0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_VLStrings: buf is NULL"); + } /* end if */ + else { + isVlenStr = H5Tis_variable_str((hid_t)mem_type_id); + + if (isVlenStr) { + status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, + (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, buf); + } /* end if */ + else + h5badArgument(env, "H5Dwrite_VLStrings: type is not variable length String"); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */ + +herr_t +H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + char **wdata; + jsize size; + jsize i; + + size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + wdata = (char**)HDmalloc((size_t)size * sizeof (char*)); + + if (!wdata) { + h5JNIFatalError(env, "H5DwriteVL_string: cannot allocate buffer"); + } /* end if */ + else { + HDmemset(wdata, 0, (size_t)size * sizeof(char*)); + for (i = 0; i < size; ++i) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + wdata[i] = (char*)HDmalloc((size_t)length + 1); + if (wdata[i]) { + HDmemset(wdata[i], 0, (size_t)length + 1); + HDstrncpy(wdata[i], utf8, (size_t)length + 1); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for (i = 0; i < size; ++i) */ + + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, wdata); + + /* now free memory*/ + for (i = 0; i < size; i++) { + if(wdata[i]) { + HDfree(wdata[i]); + } /* end if */ + } /* end for */ + HDfree(wdata); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end H5DwriteVL_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref (JNIEnv *env, jclass clss, + jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region = -1; + hid_t did = (hid_t) dataset_id; + hid_t tid = (hid_t) mem_type_id; + hid_t mem_sid = (hid_t) mem_space_id; + hid_t file_sid = (hid_t) file_space_id; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Dread_reg_ref: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Dread_reg_ref: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; iNewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref_data + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data (JNIEnv *env, jclass clss, + jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region_obj; + H5S_sel_type region_type; + + hid_t region = -1; + hid_t did = (hid_t) dataset_id; + hid_t tid = (hid_t) mem_type_id; + hid_t mem_sid = (hid_t) mem_space_id; + hid_t file_sid = (hid_t) file_space_id; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; i= 0) { + region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]); + if (region >= 0) { + region_type = H5Sget_select_type(region); + if(region_type==H5S_SEL_POINTS) { + h5str_dump_region_points_data(&h5str, region, region_obj); + } /* end if */ + else { + h5str_dump_region_blocks_data(&h5str, region, region_obj); + } /* end else */ + + H5Sclose(region); + } /* end if */ + H5Dclose(region_obj); + } /* end if */ + jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate2 + * Signature: (JLjava/lang/String;JJJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) +{ + hid_t dset_id; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dopen2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate_anon + * Signature: (JJJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate_1anon(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id) +{ + hid_t dset_id = -1; + + dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate_1anon */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_space_status + * Signature: (J)I; + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1space_1status(JNIEnv *env, jclass clss, jlong loc_id) +{ + H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR; + + if (H5Dget_space_status((hid_t)loc_id, &space_status) < 0) + h5libraryError(env); + + return (jint)space_status; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1space_1status */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1access_1plist(JNIEnv *env, jclass clss, jlong loc_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_access_plist((hid_t)loc_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1access_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1offset(JNIEnv *env, jclass clss, jlong loc_id) +{ + haddr_t offset = HADDR_UNDEF; + + offset = H5Dget_offset((hid_t)loc_id); + if (offset == HADDR_UNDEF) + h5libraryError(env); + + return (jlong)offset; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_get_buf_size + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id) +{ + hsize_t sz = 0; + + if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0) + h5libraryError(env); + + return (jlong)sz; +} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dfill + * Signature: ([BJ[BJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Dfill(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id) +{ + herr_t status; + jbyte *fillP; + jbyte *buffP; + jboolean isCopy1; + jboolean isCopy2; + + + if (buf == NULL) { + h5nullArgument(env, "H5Dfill: buf is NULL"); + return; + } /* end if */ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dfill: buf not pinned"); + return; + } /* end if */ + + if(fill) { + fillP = ENVPTR->GetByteArrayElements(ENVPAR fill, &isCopy1); + if (fillP == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5JNIFatalError( env, "H5Dfill: fill not pinned"); + return; + } /* end if */ + } /* end if */ + else + fillP = NULL; + + status = H5Dfill((const void*)fillP, (hid_t)fill_type_id, (void*)buffP, (hid_t)buf_type_id, (hid_t)space_id); + if(fillP) { + /* free the buffer without copying back */ + /* end if */ ENVPTR->ReleaseByteArrayElements(ENVPAR fill, fillP, JNI_ABORT); + } + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (isCopy2 == JNI_TRUE) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0); + } /* end if */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Dfill */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dset_extent + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf) +{ + herr_t status; + hsize_t *dims; + jlong *buffP; + jsize rank; + jboolean isCopy; + int i = 0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dset_extent: buf is NULL"); + return; + } /* end if */ + + rank = ENVPTR->GetArrayLength(ENVPAR buf); + if (rank <= 0) { + h5JNIFatalError(env, "H5Dset_extent: rank <=0"); + } /* end if */ + else { + buffP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (buffP == NULL) { + h5JNIFatalError( env, "H5Dset_extent: buf not pinned"); + } /* end if */ + else { + dims = (hsize_t*)HDmalloc((size_t)rank * sizeof(hsize_t)); + for (i = 0; i< rank; i++) + dims[i] = (hsize_t)buffP[i]; + + status = H5Dset_extent((hid_t)loc_id, (hsize_t*)dims); + + HDfree (dims); + + /* free the buffer without copying back */ + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */ + +static herr_t +H5D_iterate_cb(void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) { + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jbyteArray elemArray; + jlongArray pointArray; + jsize size; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I"); + if (mid == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + + if (elem == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + if (point == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + + size = (jsize)H5Tget_size(elem_id); + elemArray = CBENVPTR->NewByteArray(CBENVPAR size); + if (elemArray == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + CBENVPTR->SetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem); + + pointArray = CBENVPTR->NewLongArray(CBENVPAR 2); + if (pointArray == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + CBENVPTR->SetLongArrayRegion(CBENVPAR pointArray, 0, 2, (const jlong *)point); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, (void*)elemArray, elem_id, ndim, pointArray, op_data); + + CBENVPTR->GetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem); + + JVMPTR->DetachCurrentThread(JVMPAR); + + return status; +} /* end H5D_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Diterate + * Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Diterate(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + jboolean isCopy; + jbyte *buffP; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Diterate: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Diterate: callback_op is NULL"); + return -1; + } /* end if */ + + if (buf == NULL) { + h5nullArgument(env, "H5Diterate: buf is NULL"); + return -1; + } /* end if */ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Diterate: buf not pinned"); + } /* end if */ + else { + status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (isCopy == JNI_TRUE) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0); + } /* end if */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Diterate */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h new file mode 100644 index 00000000000..12078e86bbc --- /dev/null +++ b/java/src/jni/h5dImp.h @@ -0,0 +1,319 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5D */ + +#ifndef _Included_hdf_hdf5lib_H5_H5D +#define _Included_hdf_hdf5lib_H5_H5D + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen + (JNIEnv*, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1space + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1type + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Dclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1storage_1size + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_reclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim + (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1short + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1short + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1int + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1int + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1long + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1long + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1float + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1float + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1double + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1double + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1string + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1string +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1VLStrings +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_VLStrings + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref_data + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate2 + * Signature: (JLjava/lang/String;JJJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate2 + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen2 + (JNIEnv*, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate_anon + * Signature: (JJJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate_1anon + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_space_status + * Signature: (J)I; + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dget_1space_1status + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1access_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1offset + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_get_buf_size + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size + (JNIEnv*, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dfill + * Signature: ([BJ[BJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dfill + (JNIEnv*, jclass, jbyteArray, jlong, jbyteArray, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dset_extent + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dset_1extent + (JNIEnv*, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Diterate + * Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Diterate + (JNIEnv*, jclass, jbyteArray, jlong, jlong, jobject, jobject); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5D */ diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c new file mode 100644 index 00000000000..f0c41351dfb --- /dev/null +++ b/java/src/jni/h5eImp.c @@ -0,0 +1,524 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * This code is the C-interface called by Java programs to access the + * general library functions of the HDF5 library. + * + * Each routine wraps a single HDF entry point, generally with the + * analogous arguments and return codes. + * + * For details of the HDF libraries, see the HDF Documentation at: + * http://www.hdfgroup.org/HDF5/doc/ + * + */ + +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5eImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else /* __cplusplus */ + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif /* __cplusplus */ + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eauto_is_v2 + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2(JNIEnv *env, jclass cls, jlong stk_id) +{ + unsigned int is_stack = 0; + + if (stk_id < 0) { + h5badArgument(env, "H5Eauto_is_v2: invalid argument"); + } /* end if */ + else if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0) + h5libraryError(env); + + return (jboolean)is_stack; +} /* end Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eregister_class + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eregister_1class(JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version) +{ + hid_t ret_val = -1; + const char* the_cls_name; + const char* the_lib_name; + const char* the_version; + + PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version, -1); + + ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version); + + UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eunregister_class + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eunregister_1class(JNIEnv *env, jclass cls, jlong cls_id) +{ + if (cls_id < 0) { + h5badArgument(env, "H5Eunregister_class: invalid argument"); + } /* end if */ + else if (H5Eunregister_class((hid_t)cls_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eunregister_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_msg + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclose_1msg(JNIEnv *env, jclass cls, jlong err_id) +{ + if (err_id < 0) { + h5badArgument(env, "H5Eclose_msg: invalid argument"); + } /* end if */ + else if (H5Eclose_msg((hid_t)err_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclose_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_msg + * Signature: (JILjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ecreate_1msg(JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg) +{ + hid_t ret_val = -1; + const char *the_err_msg; + H5E_type_t error_msg_type = (H5E_type_t)msg_type; + + if (err_id < 0) { + h5badArgument(env, "H5Ecreate_msg: invalid argument"); + } /* end if */ + else { + PIN_JAVA_STRING(err_msg, the_err_msg, -1); + + ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg); + + UNPIN_JAVA_STRING(err_msg, the_err_msg); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ecreate_1stack(JNIEnv *env, jclass cls) +{ + hid_t ret_val = -1; + + ret_val = H5Ecreate_stack(); + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_current_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1current_1stack(JNIEnv *env, jclass cls) +{ + hid_t ret_val = -1; + + ret_val = H5Eget_current_stack(); + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1current_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclose_1stack(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eclose_stack: invalid argument"); + } /* end if */ + else if (H5Eclose_stack((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclose_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eprint2 + * Signature: (JLjava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eprint2(JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj) +{ + herr_t ret_val = -1; + + if (stk_id < 0) { + h5badArgument(env, "H5Eprint2: invalid argument"); + } /* end if */ + else { + if(!stream_obj) + ret_val = H5Eprint2((hid_t)stk_id, stdout); + else + ret_val = H5Eprint2((hid_t)stk_id, (FILE*)stream_obj); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Eprint2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *env, jclass cls, jlong cls_id) +{ + char *namePtr; + jstring str = NULL; + ssize_t buf_size; + + if (cls_id < 0) { + h5badArgument(env, "H5Eget_class_name: invalid argument"); + } /* end if */ + else { + /* get the length of the name */ + buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0); + + if (buf_size < 0) { + h5badArgument( env, "H5Eget_class_name: buf_size < 0"); + } /* end if */ + else if (buf_size == 0) { + h5badArgument( env, "H5Eget_class_name: No class name"); + } /* end else if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory( env, "H5Eget_class_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size); + + if (buf_size < 0) { + HDfree(namePtr); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1class_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eset_current_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eset_1current_1stack(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eset_current_stack: invalid argument"); + } /* end if */ + else if (H5Eset_current_stack((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eset_1current_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epop + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Epop(JNIEnv *env, jclass cls, jlong stk_id, jlong count) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Epop: invalid argument"); + } /* end if */ + else if (H5Epop((hid_t)stk_id, (size_t)count) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Epop */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epush2 + * Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Epush2(JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname, + jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc) +{ + herr_t ret_val = -1; + const char* fName; + const char* fncName; + const char* errMsg; + + if (stk_id < 0) { + h5badArgument(env, "H5Epush: invalid argument"); + } /* end if */ + else if (class_id < 0) { + h5badArgument(env, "H5Epush: invalid class_id argument"); + } /* end else if */ + else if (major_id < 0) { + h5badArgument(env, "H5Epush: invalid major_id argument"); + } /* end else if */ + else if (minor_id < 0) { + h5badArgument(env, "H5Epush: invalid minor_id argument"); + } /* end else if */ + else { + PIN_JAVA_STRING_THREE0(filename, fName, funcname, fncName, err_desc, errMsg); + + ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id, + (hid_t)major_id, (hid_t)minor_id, errMsg); + + UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Epush2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclear2 + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclear2(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eclear2: invalid argument"); + } /* end if */ + else if (H5Eclear2((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclear2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_msg + * Signature: (J[I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list) +{ + char *namePtr; + jstring str = NULL; + jboolean isCopy; + ssize_t buf_size; + jint *theArray; + H5E_type_t error_msg_type; + + if (msg_id < 0) { + h5badArgument(env, "H5Eget_msg: invalid argument"); + } /* end if */ + else if (error_msg_type_list == NULL) { + h5nullArgument(env, "H5Eget_msg: error_msg_type_list is NULL"); + } /* end if */ + else { + /* get the length of the name */ + buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0); + + if ((buf_size < 0) || (buf_size == 0)) { + h5JNIFatalError(env, "H5Eget_msg: Invalid message"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory(env, "H5Eget_msg: malloc failed"); + } /* end if */ + else { + theArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR error_msg_type_list, &isCopy); + if (theArray == NULL) { + HDfree(namePtr); + h5JNIFatalError(env, "H5Eget_msg: error_msg_type_list not pinned"); + } /* end if */ + else { + buf_size = H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size); + + if (buf_size < 0) { + HDfree(namePtr); + ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = error_msg_type; + ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, 0); + + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_num + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1num(JNIEnv *env, jclass cls, jlong stk_id) +{ + ssize_t ret_val = -1; + + if (stk_id < 0) { + h5badArgument(env, "H5Eget_num: invalid argument"); + } /* end if */ + else { + ret_val = H5Eget_num((hid_t)stk_id); + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1num */ + +static herr_t +H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str1, str2, str3; + jmethodID constructor; + jvalue args[7]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I"); + if (mid != 0) { + args[0].j = info->cls_id; + args[1].j = info->maj_num; + args[2].j = info->min_num; + args[3].i = (jint)info->line; + str1 = CBENVPTR->NewStringUTF(CBENVPAR info->func_name); + args[4].l = str1; + str2 = CBENVPTR->NewStringUTF(CBENVPAR info->file_name); + args[5].l = str2; + str3 = CBENVPTR->NewStringUTF(CBENVPAR info->desc); + args[6].l = str3; + // get a reference to your class if you don't have it already + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5E_error2_t"); + if (cls != 0) { + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, nindx, cb_info_t, op_data); + } /* end if (constructor != 0) */ + } /* end if(cls != 0) */ + } /* end if (mid != 0) */ + } /* end if (cls != 0) */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return (herr_t)status; +} /* end H5E_walk_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ewalk2 + * Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) +{ + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); + } /* end if */ + else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) + h5libraryError(env); +} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h new file mode 100644 index 00000000000..c40c0133a4a --- /dev/null +++ b/java/src/jni/h5eImp.h @@ -0,0 +1,167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5E */ + +#ifndef _Included_hdf_hdf5lib_H5_H5E +#define _Included_hdf_hdf5lib_H5_H5E + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eauto_is_v2 + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eregister_class + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eregister_1class + (JNIEnv *, jclass, jstring, jstring, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eunregister_class + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eunregister_1class + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_msg + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1msg + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_msg + * Signature: (JILjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1msg + (JNIEnv *, jclass, jlong, jint, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1stack + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_current_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1current_1stack + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1stack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eprint2 + * Signature: (JLjava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eprint2 + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1class_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eset_current_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epop + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epop + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epush2 + * Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epush2 + (JNIEnv *, jclass, jlong, jstring, jstring, jint, jlong, jlong, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclear2 + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclear2 + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_msg + * Signature: (J[I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_num + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1num + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ewalk2 + * Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 + (JNIEnv *, jclass, jlong, jlong, jobject, jobject); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5E */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c new file mode 100644 index 00000000000..b484fb2cda1 --- /dev/null +++ b/java/src/jni/h5fImp.c @@ -0,0 +1,516 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include "hdf5.h" +#include "h5fImp.h" +#include "h5util.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fopen + * Signature: (Ljava/lang/String;IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fopen(JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id) +{ + hid_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id ); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fcreate + * Signature: (Ljava/lang/String;IJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fcreate(JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id, jlong access_id) +{ + hid_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fflush + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fflush(JNIEnv *env, jclass clss, jlong object_id, jint scope) +{ + herr_t retVal = -1; + + retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope ); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Fflush */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *env, jclass cls, jlong file_id) +{ + char *namePtr; + jstring str = NULL; + ssize_t buf_size; + + /* get the length of the name */ + buf_size = H5Fget_name((hid_t)file_id, NULL, 0); + + if (buf_size <= 0) { + h5badArgument(env, "H5Fget_name: buf_size <= 0"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory(env, "H5Fget_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size); + if (buf_size < 0) { + HDfree(namePtr); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + }/* end else */ + }/* end else */ + }/* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fis_hdf5 + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Fis_1hdf5(JNIEnv *env, jclass clss, jstring name) +{ + htri_t bval = JNI_FALSE; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, JNI_FALSE); + + bval = H5Fis_hdf5(fileName); + + 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_1hdf5 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Fget_create_plist((hid_t)file_id ); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Fget_access_plist((hid_t)file_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_intent + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1intent(JNIEnv *env, jclass cls, jlong file_id) +{ + unsigned intent = 0; + + if (H5Fget_intent((hid_t)file_id, &intent) < 0) + h5libraryError(env); + + return (jint)intent; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1intent */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Fclose(JNIEnv *env, jclass clss, jlong file_id) +{ + herr_t status = -1; + + if (file_id > 0) + status = H5Fclose((hid_t)file_id ); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fmount + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id, jlong plist_id) +{ + herr_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Fmount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Funmount + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Funmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + herr_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Funmount((hid_t)loc_id, fileName); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Funmount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_freespace + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1freespace(JNIEnv *env, jclass cls, jlong file_id) +{ + hssize_t ret_val = H5Fget_freespace((hid_t)file_id); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1freespace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freopen + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Freopen(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Freopen((hid_t)file_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Freopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_ids + * Signature: (JIJ[J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs, + jlongArray obj_id_list) +{ + ssize_t ret_val = -1; + jlong *obj_id_listP; + jboolean isCopy; + hid_t *id_list; + size_t rank; + size_t i; + + if (obj_id_list == NULL) { + h5nullArgument(env, "H5Fget_obj_ids: obj_id_list is NULL"); + } /* end if */ + else { + obj_id_listP = ENVPTR->GetLongArrayElements(ENVPAR obj_id_list, &isCopy); + if (obj_id_listP == NULL) { + h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not pinned"); + } /* end if */ + else { + rank = (size_t)ENVPTR->GetArrayLength(ENVPAR obj_id_list); + + id_list = (hid_t *)HDmalloc(rank * sizeof(hid_t)); + if (id_list == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT); + h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not converted to hid_t"); + } /* end if */ + else { + ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT); + HDfree(id_list); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + obj_id_listP[i] = (jlong)id_list[i]; + } /* end for */ + HDfree(id_list); + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_count + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1obj_1count(JNIEnv *env, jclass cls, jlong file_id, jint types) +{ + ssize_t ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1count_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_filesize + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1filesize(JNIEnv *env, jclass clss, jlong file_id) +{ + hsize_t size = 0; + + if (H5Fget_filesize ((hid_t)file_id, &size) < 0) + h5libraryError(env); + + return (jlong) size; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1filesize */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_hit_rate + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate(JNIEnv *env, jclass cls, jlong file_id) +{ + double rate = 0.0; + + if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0) + h5libraryError(env); + + return (jdouble)rate; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size(JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache) +{ + jint size = 0; + jlong *metadata_cache_ptr; + size_t max_size = 0, min_clean_size = 0, cur_size = 0; + int cur_num_entries = -1; + jboolean isCopy; + + if (metadata_cache == NULL) { + h5nullArgument(env, "H5Fget_mdc_size: metadata_cache is NULL"); + } /* end if */ + else { + size = (int)ENVPTR->GetArrayLength(ENVPAR metadata_cache); + if (size < 3) { + h5badArgument(env, "H5Fget_mdc_size: length of metadata_cache < 3."); + } /* end if */ + else { + if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) { + h5libraryError(env); + } /* end if */ + else { + metadata_cache_ptr = ENVPTR->GetLongArrayElements(ENVPAR metadata_cache, &isCopy); + metadata_cache_ptr[0] = (jlong)max_size; + metadata_cache_ptr[1] = (jlong)min_clean_size; + metadata_cache_ptr[2] = (jlong)cur_size; + ENVPTR->ReleaseLongArrayElements(ENVPAR metadata_cache, metadata_cache_ptr, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)cur_num_entries; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1info(JNIEnv *env, jclass clss, jlong obj_id) +{ + H5F_info2_t finfo; + jvalue args[9]; + jobject ihinfobuf; + jobject ret_obj = NULL; + + if (H5Fget_info2((hid_t)obj_id, &finfo) < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].j = (jlong)finfo.sohm.msgs_info.index_size; + args[1].j = (jlong)finfo.sohm.msgs_info.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf = ret_obj; + + args[0].i = (jint)finfo.super.version; + args[1].j = (jlong)finfo.super.super_size; + args[2].j = (jlong)finfo.super.super_ext_size; + args[3].i = (jint)finfo.free.version; + args[4].j = (jlong)finfo.free.meta_size; + args[5].j = (jlong)finfo.free.tot_space; + args[6].j = (jint)finfo.sohm.version; + args[7].j = (jlong)finfo.sohm.hdr_size; + args[8].l = ihinfobuf; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freset_mdc_hit_rate_stats + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats(JNIEnv *env, jclass cls, jlong file_id) +{ + if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclear_elink_file_cache + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache(JNIEnv *env, jclass cls, jlong file_id) +{ + if (H5Fclear_elink_file_cache((hid_t)file_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h new file mode 100644 index 00000000000..5a72fab243b --- /dev/null +++ b/java/src/jni/h5fImp.h @@ -0,0 +1,198 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5F */ + +#ifndef _Included_hdf_hdf5lib_H5_H5F +#define _Included_hdf_hdf5lib_H5_H5F + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fopen + * Signature: (Ljava/lang/String;IJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fopen + (JNIEnv*, jclass, jstring, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fcreate + * Signature: (Ljava/lang/String;IJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fcreate + (JNIEnv*, jclass, jstring, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fflush + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fflush + (JNIEnv*, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Fget_1name + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fis_hdf5 + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fis_1hdf5 + (JNIEnv*, jclass, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_intent + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1intent + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Fclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fmount + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fmount + (JNIEnv*, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Funmount + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Funmount + (JNIEnv*, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_freespace + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1freespace + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freopen + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Freopen + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_ids + * Signature: (JIJ[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids + (JNIEnv*, jclass, jlong, jint, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_count + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1count + (JNIEnv*, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_filesize + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1filesize + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_hit_rate + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size + (JNIEnv*, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freset_mdc_hit_rate_stats + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Fget_1info + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclear_elink_file_cache + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5F */ diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c new file mode 100644 index 00000000000..632942aaab6 --- /dev/null +++ b/java/src/jni/h5gImp.c @@ -0,0 +1,257 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5gImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Gclose(JNIEnv *env, jclass clss, jlong group_id) +{ + herr_t retVal = -1; + + retVal = H5Gclose((hid_t)group_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Gclose */ + +/* + * Create a java object of hdf.h5.structs.H5G_info_t + * public class H5G_info_t { + * public H5G_STORAGE_TYPE storage_type; // Type of storage for links in group + * public long nlinks; // Number of links in group + * public long max_corder; // Current max. creation order value for group + * public int mounted; // Whether group has a file mounted on it + * } + * + */ +jobject +create_H5G_info_t(JNIEnv *env, H5G_info_t group_info) +{ + jclass cls; + jboolean jmounted; + jint storage_type; + jobject obj; + jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted; + + cls = ENVPTR->FindClass(ENVPAR "hdf/hdf5lib/structs/H5G_info_t"); + if (cls == NULL) + return NULL; + + obj = ENVPTR->AllocObject(ENVPAR cls); + if (obj == NULL) + return NULL; + + fid_storage_type = ENVPTR->GetFieldID(ENVPAR cls, "storage_type", "I"); + fid_nlinks = ENVPTR->GetFieldID(ENVPAR cls, "nlinks", "J"); + fid_max_corder = ENVPTR->GetFieldID(ENVPAR cls, "max_corder", "J"); + fid_mounted = ENVPTR->GetFieldID(ENVPAR cls, "mounted", "Z"); + + if (fid_storage_type==NULL || fid_nlinks==NULL || fid_max_corder==NULL || fid_mounted == NULL) + return NULL; + + jmounted = (group_info.mounted==0) ? JNI_FALSE : JNI_TRUE; + storage_type = (jint)group_info.storage_type; + + ENVPTR->SetIntField(ENVPAR obj, fid_storage_type, (jint)storage_type); + ENVPTR->SetLongField(ENVPAR obj, fid_nlinks, (jlong)group_info.nlinks); + ENVPTR->SetLongField(ENVPAR obj, fid_max_corder, (jlong)group_info.max_corder); + ENVPTR->SetBooleanField(ENVPAR obj, fid_mounted, jmounted); + + return obj; +} /* end create_H5G_info_t */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate2 + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + hid_t group_id = -1; + const char *gName; + + PIN_JAVA_STRING(name, gName, -1); + + group_id = H5Gcreate2((hid_t)loc_id, gName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, gName); + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end Java_hdf_hdf5lib_H5__1H5Gcreate2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate_anon + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gcreate_1anon(JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id) +{ + hid_t group_id = -1; + + group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id); + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end JNICALL */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id) +{ + hid_t group_id = -1; + const char *gName; + + PIN_JAVA_STRING(name, gName, -1); + + group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, gName); + + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1create_1plist(JNIEnv *env, jclass cls, jlong loc_id) +{ + hid_t plist_id = H5Gget_create_plist((hid_t)loc_id); + + if (plist_id < 0) + h5libraryError(env); + + return (jlong)plist_id; +} /* end Java_hdf_hdf5lib_H5_H5Gget_1create_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info(JNIEnv *env, jclass cls, jlong loc_id) +{ + H5G_info_t group_info; + + if (H5Gget_info((hid_t)loc_id, &group_info) < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id) +{ + herr_t ret_val = -1; + const char *gName; + H5G_info_t group_info; + + PIN_JAVA_STRING(name, gName, NULL); + + ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, gName); + + if (ret_val < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type, + jint order, jlong n, jlong lapl_id) +{ + herr_t ret_val = -1; + const char *gName; + H5G_info_t group_info; + H5_index_t cindex_type = (H5_index_t)index_type; + H5_iter_order_t corder = (H5_iter_order_t)order; + + PIN_JAVA_STRING(name, gName, NULL); + + ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type, + corder, (hsize_t)n, &group_info, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, gName); + + if (ret_val < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h new file mode 100644 index 00000000000..2b9bc5769dc --- /dev/null +++ b/java/src/jni/h5gImp.h @@ -0,0 +1,96 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5G */ + +#ifndef _Included_hdf_hdf5lib_H5_H5G +#define _Included_hdf_hdf5lib_H5_H5G + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Gclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate2 + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate2 + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate_anon + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate_1anon + (JNIEnv*, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gopen2 + (JNIEnv*, jclass, jlong, jstring, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Gget_1create_1plist +(JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5G */ diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c new file mode 100644 index 00000000000..e7d663fb1bc --- /dev/null +++ b/java/src/jni/h5iImp.c @@ -0,0 +1,289 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5iImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1type(JNIEnv *env, jclass clss, jlong obj_id) +{ + H5I_type_t retVal = H5I_BADID; + + retVal = H5Iget_type((hid_t)obj_id); + if (retVal == H5I_BADID) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_name + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size) +{ + char *aName; + jstring str; + hssize_t size = -1; + long bs; + + bs = (long)buf_size; + if (bs <= 0) { + h5badArgument(env, "H5Iget_name: buf_size <= 0"); + } /* end if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Iget_name: malloc failed"); + } /* end if */ + else { + size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size); + if (size < 0) { + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str); + } + HDfree(aName); + } + } + return (jlong)size; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Iget_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iinc_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Iinc_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iinc_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_1ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Idec_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Idec_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Idec_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_file_id + * Signature: (J)J + */ + +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1file_1id(JNIEnv *env, jclass clss, jlong obj_id) +{ + hid_t file_id = -1; + + file_id = H5Iget_file_id((hid_t)obj_id); + if (file_id < 0) + h5libraryError(env); + + return (jlong) file_id; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1file_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Iget_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Idec_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Idec_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Idec_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Iinc_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Inmembers + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Inmembers(JNIEnv *env, jclass clss, jint type) +{ + hsize_t num_members; + + if (H5Inmembers((H5I_type_t)type, &num_members) < 0) + h5libraryError(env); + + return (jint)num_members; +} /* end Java_hdf_hdf5lib_H5_H5Inmembers */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iis_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Iis_1valid(JNIEnv *env, jclass clss, jlong obj_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Iis_valid((hid_t)obj_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Iis_1valid */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Itype_exists + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Itype_1exists(JNIEnv *env, jclass clss, jint type) +{ + htri_t bval = JNI_FALSE; + + bval = H5Itype_exists((H5I_type_t)type); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end else Java_hdf_hdf5lib_H5_H5Itype_1exists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iclear_type + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Iclear_1type(JNIEnv *env, jclass clss, jint type, jboolean force) +{ + if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Iclear_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idestroy_type + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *env, jclass clss, jint type) +{ + if (H5Idestroy_type((H5I_type_t)type) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Idestroy_1type */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h new file mode 100644 index 00000000000..fe36b5b8c27 --- /dev/null +++ b/java/src/jni/h5iImp.h @@ -0,0 +1,143 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5I */ + +#ifndef _Included_hdf_hdf5lib_H5_H5I +#define _Included_hdf_hdf5lib_H5_H5I + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_name + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1name + (JNIEnv*, jclass, jlong, jobjectArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_1ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_file_id + * Signature: (J)J + */ + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1file_1id + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Inmembers + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Inmembers + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iis_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Iis_1valid + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Itype_exists + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Itype_1exists + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iclear_type + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Iclear_1type + (JNIEnv*, jclass, jint, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idestroy_type + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Idestroy_1type + (JNIEnv*, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5I */ diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h new file mode 100644 index 00000000000..da49eeb0126 --- /dev/null +++ b/java/src/jni/h5jni.h @@ -0,0 +1,249 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#include +#include "H5version.h" +#include +#include "H5private.h" + +#ifndef _Included_h5jni +#define _Included_h5jni + +#ifdef __cplusplus + #define ENVPTR (env) + #define ENVPAR + #define ENVONLY + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else /* __cplusplus */ + #define ENVPTR (*env) + #define ENVPAR env, + #define ENVONLY env + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif /* __cplusplus */ + +/* Macros for class access */ +/* Calling code must define ret_obj as jobject */ +#define CALL_CONSTRUCTOR(classname,classsig,args) { \ + jclass cls; \ + jmethodID constructor; \ + cls = ENVPTR->FindClass(ENVPAR (classname)); \ + if (cls == 0) { \ + h5JNIFatalError(env, "JNI error: GetObjectClass\n"); \ + ret_obj = NULL; \ + } \ + constructor = ENVPTR->GetMethodID(ENVPAR cls, "", (classsig)); \ + if (constructor == 0) { \ + h5JNIFatalError(env, "JNI error: GetMethodID failed\n"); \ + ret_obj = NULL; \ + } \ + ret_obj = ENVPTR->NewObjectA(ENVPAR cls, constructor, (args)); \ +} + + +/* Macros for string access */ +#define PIN_JAVA_STRING(javastr,localstr,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING0(javastr,localstr) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING(javastr,localstr) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ +} + +#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING_TWO0(javastr,localstr,java2str,local2str) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ +} + +#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return (retdefault); \ + } \ + if ((java3str) == NULL) { \ + h5nullArgument(env, "third java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return (retdefault); \ + } \ + (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \ + if ((local3str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + h5JNIFatalError(env, "third local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING_THREE0(javastr,localstr,java2str,local2str,java3str,local3str) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return; \ + } \ + if ((java3str) == NULL) { \ + h5nullArgument(env, "third java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return; \ + } \ + (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \ + if ((local3str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + h5JNIFatalError(env, "third local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java3str), (local3str)); \ +} + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern jboolean h5JNIFatalError(JNIEnv *, const char *); +extern jboolean h5nullArgument(JNIEnv *, const char *); +extern jboolean h5badArgument (JNIEnv *, const char *); +extern jboolean h5outOfMemory (JNIEnv *, const char *); +extern jboolean h5libraryError(JNIEnv *env ); +extern jboolean h5raiseException(JNIEnv *, const char *, const char *); +extern jboolean h5unimplemented( JNIEnv *env, const char *functName); + +/* implemented at H5.c */ +extern jint get_enum_value(JNIEnv *env, jobject enum_obj); +extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name, + jint enum_val, const char* enum_field_desc); + +/* implemented at H5G.c */ +extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_h5jni */ diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c new file mode 100644 index 00000000000..739e43b4188 --- /dev/null +++ b/java/src/jni/h5lImp.c @@ -0,0 +1,736 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5lImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_external + * Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1external(JNIEnv *env, jclass clss, jstring file_name, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lFileName; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_THREE0(file_name, lFileName, cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_hard + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1hard(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1hard */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_soft + * Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1soft(JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_soft(lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1soft */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete + * Signature: (JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ldelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + PIN_JAVA_STRING0(name, lName); + + status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ldelete */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + hsize_t n = (hsize_t)link_n; + herr_t status; + const char *lName; + + PIN_JAVA_STRING0(name, lName); + + status = H5Ldelete_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lexists + * Signature: (JLjava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Lexists(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + htri_t bval = JNI_FALSE; + const char *lName; + + PIN_JAVA_STRING(name, lName, JNI_FALSE); + + bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Lexists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + jobject ret_obj = NULL; + jvalue args[5]; + herr_t status; + H5L_info_t infobuf; + const char *lName; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + if(infobuf.type==0) + args[4].j = (jlong)infobuf.u.address; + else + args[4].j = (jlong)infobuf.u.val_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + jobject ret_obj = NULL; + jvalue args[5]; + herr_t status; + H5L_info_t infobuf; + const char *lName; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + if(infobuf.type==0) + args[4].j = (jlong)infobuf.u.address; + else + args[4].j = (jlong)infobuf.u.val_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args); + } /* end els */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + jlong status_size; + jstring str = NULL; + size_t buf_size; + const char *lName; + char *lValue; + + PIN_JAVA_STRING(name, lName, NULL); + + /* get the length of the link name */ + status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)NULL, (size_t)0, H5P_DEFAULT); + if(status_size < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */ + + lValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed "); + } /* end if */ + else { + status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)lValue, (size_t)buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status_size < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR lValue); + HDfree(lValue); + if (str == NULL) + h5JNIFatalError(env, "H5Lget_name_by_idx: return string not created"); + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value + * Signature: (JLjava/lang/String;[Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id) +{ + size_t buf_size; + herr_t status; + H5L_info_t infobuf; + const char *lName; + char *lValue; + const char *file_name; + const char *obj_name; + jstring str; + + PIN_JAVA_STRING(name, lName, -1); + + infobuf.type = -1; + /* get the length of the link val */ + status = H5Lget_info((hid_t)loc_id, lName, &infobuf, H5P_DEFAULT); + if(status < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + } /* end if */ + else { + buf_size = infobuf.u.val_size + 1;/* add extra space for the null terminator */ + + if(infobuf.type == H5L_TYPE_HARD) { + UNPIN_JAVA_STRING(name, lName); + h5JNIFatalError(env, "H5Lget_val: link is hard type"); + } /* end if */ + else { + lValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_val: malloc failed"); + } /* end if */ + else { + status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else if(infobuf.type == H5L_TYPE_EXTERNAL) { + status = H5Lunpack_elink_val(lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, &file_name, &obj_name); + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR obj_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + + str = ENVPTR->NewStringUTF(ENVPAR file_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR lValue); + if (str == NULL) { + /* exception -- fatal JNI error */ + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return infobuf.type; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1val */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value_by_idx + * Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order, + jlong link_n, jobjectArray link_value, jlong access_id) +{ + herr_t status; + size_t buf_size; + H5L_info_t infobuf; + const char *lName; + void *lValue; + const char *file_name; + const char *obj_name; + jstring str; + + PIN_JAVA_STRING(name, lName, -1); + + infobuf.type = -1; + /* get the length of the link valuee */ + status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + if(status < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + return -1; + } /* end if */ + else { + buf_size = infobuf.u.val_size; + if(buf_size < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + return -1; + } /* end if */ + else { + lValue = (void*)HDmalloc(buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed "); + return -1; + } /* end if */ + else { + status = H5Lget_val_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void*)lValue, (size_t)buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else if(infobuf.type == H5L_TYPE_EXTERNAL) { + status = H5Lunpack_elink_val((char*)lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, (const char**)&file_name, (const char**)&obj_name); + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR obj_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + + str = ENVPTR->NewStringUTF(ENVPAR file_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR (char *)lValue); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return infobuf.type; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1val_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lmove + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lmove(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); + +} /* end Java_hdf_hdf5lib_H5_H5Lmove */ + +static herr_t +H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) { + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[5]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].i = info->type; + args[1].z = info->corder_valid; + args[2].j = info->corder; + args[3].i = info->cset; + if(info->type==0) + args[4].j = (jlong)info->u.address; + else + args[4].j = (jlong)info->u.val_size; + // get a reference to your class if you don't have it already + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5L_info_t"); + if (cls != 0) { + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(IZJIJ)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5L_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lvisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Lvisit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jobject callback_op, jobject op_data, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Literate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Literate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Literate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data, jlong access_id) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Literate_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lis_registered + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lis_1registered(JNIEnv *env, jclass clss, jint link_cls_id) +{ + htri_t ret_val = H5Lis_registered((H5L_type_t)link_cls_id); + + if (ret_val < 0) + h5libraryError(env); + + return (int)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Lis_1registered */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lunregister + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *env, jclass clss, jint link_cls_id) +{ + if (H5Lunregister((H5L_type_t)link_cls_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lunregister */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h new file mode 100644 index 00000000000..f0a9a63989c --- /dev/null +++ b/java/src/jni/h5lImp.h @@ -0,0 +1,183 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5L */ + +#ifndef _Included_hdf_hdf5lib_H5_H5L +#define _Included_hdf_hdf5lib_H5_H5L + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcopy + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_external + * Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1external + (JNIEnv*, jclass, jstring, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_hard + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1hard + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_soft + * Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1soft + (JNIEnv*, jclass, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete + * Signature: (JLjava/lang/String;J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lexists + * Signature: (JLjava/lang/String;J)Z + */ + JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Lexists + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value + * Signature: (JLjava/lang/String;[Ljava/lang/String;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value + (JNIEnv*, jclass, jlong, jstring, jobjectArray, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value_by_idx + * Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobjectArray, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lmove + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lmove + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit + (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate + (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lis_registered + * Signature: (I)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lis_1registered + (JNIEnv*, jclass, jint); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lunregister + * Signature: (I)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lunregister + (JNIEnv*, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5L */ diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c new file mode 100644 index 00000000000..c38ec9ae1a2 --- /dev/null +++ b/java/src/jni/h5oImp.c @@ -0,0 +1,766 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5oImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id) +{ + hid_t status; + const char *oName; + + PIN_JAVA_STRING(name, oName, -1); + + status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, oName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Oclose(JNIEnv *env, jclass clss, jlong object_id) +{ + herr_t retVal = H5Oclose((hid_t)object_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ocopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ocopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ocopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info(JNIEnv *env, jclass clss, jlong loc_id) +{ + herr_t status = -1; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + status = H5Oget_info((hid_t)loc_id, &infobuf); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + const char *lName; + herr_t status = -1; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, + jstring name, jint index_field, jint order, jlong link_n, jlong access_id) +{ + const char *lName; + herr_t status; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Oget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Olink + * Signature: (JJLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Olink(JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lDstName; + + PIN_JAVA_STRING0(dst_name, lDstName); + + status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING(dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Olink */ + +static herr_t +H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + /* printf("JNI H5O_iterate_cb error: GetObjectClass failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I"); + if (mid == 0) { + /* printf("JNI H5O_iterate_cb error: GetMethodID failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].i = (jint)info->hdr.version; + args[1].i = (jint)info->hdr.nmesgs; + args[2].i = (jint)info->hdr.nchunks; + args[3].i = (jint)info->hdr.flags; + args[4].j = (jlong)info->hdr.space.total; + args[5].j = (jlong)info->hdr.space.meta; + args[6].j = (jlong)info->hdr.space.mesg; + args[7].j = (jlong)info->hdr.space.free; + args[8].j = (jlong)info->hdr.mesg.present; + args[9].j = (jlong)info->hdr.mesg.shared; + // get a reference to the H5_hdr_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_hdr_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(IIIIJJJJJJ)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + args[0].j = (jlong)info->meta_size.obj.index_size; + args[1].j = (jlong)info->meta_size.obj.heap_size; + // get a reference to the H5_ih_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJ)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + args[0].j = (jlong)info->meta_size.attr.index_size; + args[1].j = (jlong)info->meta_size.attr.heap_size; + ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + args[0].j = (jlong)info->fileno; + args[1].j = (jlong)info->addr; + args[2].i = info->type; + args[3].i = (jint)info->rc; + args[4].j = (jlong)info->num_attrs; + args[5].j = info->atime; + args[6].j = info->mtime; + args[7].j = info->ctime; + args[8].j = info->btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + // get a reference to the H5O_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + + JVMPTR->DetachCurrentThread(JVMPAR); + + return status; +} /* end H5O_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Ovisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Ovisit: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Ovisit: callback_op is NULL"); + return -1; + } /* end if */ + + status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Ovisit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jobject callback_op, jobject op_data, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Ovisit_by_name: callback_op is NULL"); + return -1; + } /* end if */ + + PIN_JAVA_STRING(name, lName, -1); + + status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oset_1comment(JNIEnv *env, jclass clss, jlong loc_id, jstring comment) +{ + herr_t status = -1; + const char *oComment; + jboolean isCopy; + + if (comment == NULL) { + oComment = NULL; + } /* end if */ + else { + oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy); + if (oComment == NULL) { + h5JNIFatalError( env, "H5Oset_comment: comment not pinned"); + return; + } /* end if */ + } /* end else */ + + status = H5Oset_comment((hid_t)loc_id, oComment); + + if(oComment) + ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, + jstring name, jstring comment, jlong access_id) +{ + herr_t status = -1; + const char *oName; + const char *oComment; + + PIN_JAVA_STRING0(name, oName); + + if (comment == NULL) { + oComment = NULL; + } /* end if */ + else { + jboolean isCopy; + oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy); + if (oComment == NULL) { + UNPIN_JAVA_STRING(name, oName); + h5JNIFatalError( env, "H5Oset_comment_by_name: comment not pinned"); + return; + } /* end if */ + } /* end else */ + + status = H5Oset_comment_by_name((hid_t)loc_id, oName, oComment, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, oName); + + if(oComment) + ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *env, jclass clss, jlong loc_id) +{ + char *oComment; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the comment */ + buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Oget_comment: buf_size < 0"); + return NULL; + } /* end if */ + if (buf_size == 0) { + return NULL; + } /* end if */ + + buf_size++; /* add extra space for the null terminator */ + oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (oComment == NULL) { + /* exception -- out of memory */ + h5outOfMemory( env, "H5Oget_comment: malloc failed"); + return NULL; + } /* end if */ + + status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size); + + if (status >= 0) { + /* may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR oComment); + HDfree(oComment); + if (str == NULL) { + h5JNIFatalError( env, "H5Oget_comment: return string not allocated"); + } /* end if */ + } /* end if */ + else { + HDfree(oComment); + h5libraryError(env); + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment_by_name + * Signature: (JLjava/lang/String;J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + char *oComment; + const char *oName; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + PIN_JAVA_STRING(name, oName, NULL); + + /* get the length of the comment */ + buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id); + if (buf_size < 0) { + UNPIN_JAVA_STRING(name, oName); + h5badArgument( env, "H5Oget_comment_by_name: buf_size < 0"); + return NULL; + } /* end if */ + if (buf_size == 0) { + UNPIN_JAVA_STRING(name, oName); + return NULL; + } /* end if */ + + buf_size++; /* add extra space for the null terminator */ + oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (oComment == NULL) { + UNPIN_JAVA_STRING(name, oName); + h5outOfMemory( env, "H5Oget_comment_by_name: malloc failed"); + return NULL; + } /* end if */ + + status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id); + UNPIN_JAVA_STRING(name, oName); + + if (status >= 0) { + /* may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR oComment); + HDfree(oComment); + if (str == NULL) { + h5JNIFatalError( env, "H5Oget_comment_by_name: return string not allocated"); + } /* end if */ + } /* end if */ + else { + HDfree(oComment); + h5libraryError(env); + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oexists_by_name + * Signature: (JLjava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + htri_t bval = JNI_FALSE; + const char *oName; + + PIN_JAVA_STRING(name, oName, JNI_FALSE); + + bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, oName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Oexists_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odecr_refcount + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odecr_1refcount(JNIEnv *env, jclass clss, jlong object_id) +{ + if (H5Odecr_refcount((hid_t)object_id) < 0) + h5libraryError(env); +} +/* end Java_hdf_hdf5lib_H5_H5Odecr_1refcount */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oincr_refcount + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oincr_1refcount(JNIEnv *env, jclass clss, jlong object_id) +{ + if (H5Oincr_refcount((hid_t)object_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oincr_1refcount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_addr + * Signature: (JJ)J; + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr(JNIEnv *env, jclass clss, jlong loc_id, jlong addr) +{ + hid_t retVal = -1; + + retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr ); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_idx + * Signature: (JLjava/lang/String;IIJJ)J; + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong lapl_id) +{ + hid_t retVal = -1; + const char *oName; + + PIN_JAVA_STRING(name, oName, -1); + + retVal = H5Oopen_by_idx((hid_t)loc_id, oName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id ); + + UNPIN_JAVA_STRING(name, oName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h new file mode 100644 index 00000000000..e6889b2a05b --- /dev/null +++ b/java/src/jni/h5oImp.h @@ -0,0 +1,175 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5O */ + +#ifndef _Included_hdf_hdf5lib_H5_H5O +#define _Included_hdf_hdf5lib_H5_H5O + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen + * Signature: (JLjava/lang/String;J)J + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oclose + * Signature: (J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Oclose + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ocopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ocopy + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Olink + * Signature: (JJLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Olink + (JNIEnv*, jclass, jlong, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit + (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment + * Signature: (JLjava/lang/String;)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment + (JNIEnv*, jclass, jlong, jstring); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name + (JNIEnv*, jclass, jlong, jstring, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment + * Signature: (J)Ljava/lang/String; + */ + JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment_by_name + * Signature: (JLjava/lang/String;J)Ljava/lang/String; + */ + JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oexists_by_name + * Signature: (JLjava/lang/String;J)Z + */ + JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oexists_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Odecr_refcount + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Odecr_1refcount + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oincr_refcount + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oincr_1refcount + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_addr + * Signature: (JJ)J; + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr + (JNIEnv*, jclass, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_idx + * Signature: (JLjava/lang/String;IIJJ)J; + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5O */ diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c new file mode 100644 index 00000000000..f4fee742cb7 --- /dev/null +++ b/java/src/jni/h5pImp.c @@ -0,0 +1,5344 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5pImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; +extern jobject copy_callback; +extern jobject close_callback; +extern jobject create_callback; +extern jobject compare_callback; +extern jobject get_callback; +extern jobject set_callback; +extern jobject delete_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5P_cls_create_func_cb(hid_t prop_id, void *create_data); +static herr_t H5P_cls_copy_func_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); +static herr_t H5P_cls_close_func_cb(hid_t prop_id, void *close_data); + +static herr_t H5P_prp_create_func_cb(const char *name, size_t size, void *value); +static herr_t H5P_prp_copy_func_cb(const char *name, size_t size, void *value); +static herr_t H5P_prp_close_func_cb(const char *name, size_t size, void *value); +static int H5P_prp_compare_func_cb(void *value1, void *value2, size_t size); +static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value); + +static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcreate + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate(JNIEnv *env, jclass clss, jlong type) +{ + hid_t retVal = -1; + + retVal = H5Pcreate((hid_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Pclose(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = 0; + + if (plist > 0) + retVal = H5Pclose((hid_t)plist); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = retVal = H5Pget_class((hid_t) plist); + if (retVal == H5P_ROOT) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcopy(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = H5Pcopy((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_version + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1version(JNIEnv *env, jclass clss, jlong plist, jintArray version_info) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (version_info == NULL) { + h5nullArgument(env, "H5Pget_version: version_info input array is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) { + h5badArgument(env, "H5Pget_version: version_info input array < 4"); + } /* end else if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_version: version_info not pinned"); + } /* end if */ + else { + status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]), + (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_userblock + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1userblock(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + herr_t retVal = -1; + long sz = (long)size; + + retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_userblock + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1userblock(JNIEnv *env, jclass clss, jlong plist, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t s; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_userblock: size is NULL"); + } /* end if */ + else { + theArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_userblock: size not pinned"); + } /* end if */ + else { + status = H5Pget_userblock((hid_t)plist, &s); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)s; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sizes + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sizes(JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size) +{ + herr_t retVal = -1; + + retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sizes + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sizes(JNIEnv *env, jclass clss, jlong plist, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + size_t ss; + size_t sa; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_sizes: size is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + h5badArgument(env, "H5Pget_sizes: size input array < 2 elements"); + } + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_sizes: size not pinned"); + } /* end if */ + else { + status = H5Pget_sizes((hid_t)plist, &sa, &ss); + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)sa; + theArray[1] = (jlong)ss; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sym_k + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk) +{ + herr_t retVal = -1; + + retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sym_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jintArray size) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_sym_k: size is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + h5badArgument(env, "H5Pget_sym_k: size < 2 elements"); + } /* end else if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_sym_k: size not pinned"); + } /* end if */ + else { + status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_istore_k + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jint ik) +{ + herr_t retVal = -1; + + retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_istore_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jintArray ik) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (ik == NULL) { + h5nullArgument(env, "H5Pget_store_k: ik is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ik, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_store_k: size not pinned"); + } /* end if */ + else { + status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_layout + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1layout(JNIEnv *env, jclass clss, jlong plist, jint layout) +{ + herr_t retVal = -1; + + retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_layout + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1layout(JNIEnv *env, jclass clss, jlong plist) +{ + H5D_layout_t retVal = H5D_LAYOUT_ERROR; + + retVal = H5Pget_layout((hid_t)plist); + if (retVal == H5D_LAYOUT_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim) +{ + herr_t status = -1; + jbyte *theArray; + jboolean isCopy; + hsize_t *da; + hsize_t *lp; + jlong *jlp; + size_t i; + size_t rank; + + if (dim == NULL) { + h5nullArgument(env, "H5Pset_chunk: dim array is NULL"); + } /* end if */ + else { + i = (size_t)ENVPTR->GetArrayLength(ENVPAR dim); + rank = i / sizeof(jlong); + if (rank < ndims) { + h5badArgument(env, "H5Pset_chunk: dims array < ndims"); + } /* end if */ + else { + theArray = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR dim, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pset_chunk: dim array not pinned"); + } /* end if */ + else { + da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t)); + if (da == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pset_chunk: dims not converted to hsize_t"); + } /* end if */ + else { + jlp = (jlong *)theArray; + for (i = 0; i < rank; i++) { + *lp = (hsize_t)*jlp; + lp++; + jlp++; + } /* end if */ + + status = H5Pset_chunk((hid_t)plist, (int)ndims, da); + + ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT); + HDfree(da); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk + * Signature: (JI[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t *da; + int i; + + if (dims == NULL) { + h5nullArgument(env, "H5Pget_chunk: dims is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR dims) < max_ndims) { + h5badArgument(env, "H5Pget_chunk: dims array < max_ndims"); + } /* end else if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_chunk: input dims not pinned"); + } /* end if */ + else { + da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t)); + if (da == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_chunk: dims not converted to hsize_t"); + } /* end if */ + else { + status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT); + HDfree (da); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < max_ndims; i++) { + theArray[i] = (jlong)da[i]; + } + HDfree (da); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alignment + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1alignment(JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment) +{ + herr_t retVal = -1; + long thr = (long)threshold; + long align = (long)alignment; + + retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alignment + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1alignment(JNIEnv *env, jclass clss, jlong plist, jlongArray alignment) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t t; + hsize_t a; + + if (alignment == NULL) { + h5nullArgument(env, "H5Pget_alignment: input alignment is NULL"); + } /* end if */ + else { + if (ENVPTR->GetArrayLength(ENVPAR alignment) < 2) { + h5badArgument(env, "H5Pget_alignment: alignment input array < 2"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR alignment, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_alignment: input array not pinned"); + } /* end if */ + else { + status = H5Pget_alignment((hid_t)plist, &t, &a); + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)t; + theArray[1] = (jlong)a; + ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_external + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size) +{ + herr_t status = -1; + const char *fileName; + off_t off; + hsize_t sz; + hid_t plid; + + plid = (hid_t)plist; + off = (off_t)offset; + sz = (hsize_t)size; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Pset_external(plid, fileName, off, sz); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external_count + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1external_1count(JNIEnv *env, jclass clss, jlong plist) +{ + int retVal = -1; + + retVal = H5Pget_external_count((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external + * Signature: (JIJ[Ljava/lang/String;[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size, + jobjectArray name, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + char *file; + jstring str; + off_t o; + hsize_t s; + + if (name_size < 0) { + h5badArgument(env, "H5Pget_external: name_size < 0"); + return -1; + } /* end if */ + else if (name_size == 0) { + file = NULL; + } /* end else if */ + else { + file = (char *)HDmalloc(sizeof(char)*(size_t)name_size); + } /* end else */ + + if (size != NULL) { + if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + HDfree(file); + h5badArgument(env, "H5Pget_external: size input array < 2"); + return -1; + } /* end if */ + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + HDfree(file); + h5JNIFatalError( env, "H5Pget_external: size array not pinned"); + return -1; + } /* end if */ + } /* end if */ + + status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size, + file, (off_t *)&o, (hsize_t *)&s); + if (status < 0) { + if (size != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + } /* end if */ + HDfree(file); + h5libraryError(env); + } /* end if */ + else { + if (size != NULL) { + theArray[0] = o; + theArray[1] = (jlong)s; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end if */ + + if (file != NULL) { + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR file); + if (str == NULL) { + HDfree(file); + h5JNIFatalError(env, "H5Pget_external: return array not created"); + } /* end if */ + else { + /* SetObjectArrayElement may raise exceptions */ + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + HDfree(file); + } /* end else */ + } /* end if */ + } /* end else */ + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value) +{ + jint status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value != NULL) { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned"); + return -1; + } /* end if */ + } /* end if */ + + status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP); + + if (value != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value) +{ + jint status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value == NULL) { + h5badArgument(env, "H5Pget_fill_value: value is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned"); + } /* end if */ + else { + status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags, + jlong cd_nelmts, jintArray cd_values) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (cd_values == NULL) { + status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int)flags, (size_t)cd_nelmts, NULL); + if (status < 0) + h5libraryError(env); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pset_filter: input array not pinned"); + }/* end if */ + else { + status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, theArray, JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nfilters + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nfilters(JNIEnv *env, jclass clss, jlong plist) +{ + int retVal = -1; + + retVal = H5Pget_nfilters((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags, + jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name) +{ + herr_t status = -1; + jint *flagsArray; + jlong *cd_nelmtsArray; + jint *cd_valuesArray; + jboolean isCopy; + jstring str; + char *filter; + + if (namelen <= 0) { + h5badArgument(env, "H5Pget_filter: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5badArgument(env, "H5Pget_filter: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5badArgument(env, "H5Pget_filter: cd_values is NULL"); + } /* end else if */ + else { + filter = (char *)HDmalloc(sizeof(char)*(size_t)namelen); + if (filter == NULL) { + h5outOfMemory(env, "H5Pget_filter: namelent malloc failed"); + return -1; + } /* end if */ + flagsArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: flags array not pinned"); + return -1; + } /* end if */ + cd_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned"); + return -1; + } /* end if */ + cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + unsigned int filter_config; + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, filter, &filter_config); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR filter); + HDfree(filter); + if (str == NULL) { + h5JNIFatalError(env, "H5Pget_filter: return string not pinned"); + } /* end if */ + else { + /* SetObjectArrayElement may throw exceptiosn */ + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_driver + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1driver(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = H5Pget_driver((hid_t) plist); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_cache + * Signature: (JIJJD)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1cache(JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts, + jlong rdcc_nbytes, jdouble rdcc_w0) +{ + herr_t retVal = -1; + + retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts, + (size_t)rdcc_nbytes, (double) rdcc_w0); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_cache + * Signature: (J[I[J[J[D)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1cache(JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts, + jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) +{ + herr_t status = -1; + jint mode; + jdouble *w0Array; + jlong *rdcc_nelmtsArray; + jlong *nbytesArray; + jboolean isCopy; + + if (rdcc_w0 == NULL) { + w0Array = (jdouble *)NULL; + } /* end if */ + else { + w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy); + if (w0Array == NULL) { + h5JNIFatalError(env, "H5Pget_cache: w0_array array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + if (rdcc_nelmts == NULL) { + rdcc_nelmtsArray = (jlong *) NULL; + } /* end if */ + else { + rdcc_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nelmts, &isCopy); + if (rdcc_nelmtsArray == NULL) { + /* exception -- out of memory */ + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } + h5JNIFatalError(env, "H5Pget_cache: rdcc_nelmts array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + if (rdcc_nbytes == NULL) { + nbytesArray = (jlong *) NULL; + } /* end if */ + else { + nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy); + if (nbytesArray == NULL) { + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + if (rdcc_nelmtsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_cache: nbytesArray array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long rdcc_nelmts_temp = *(rdcc_nelmtsArray); + size_t rdcc_nelmts_t = (size_t)rdcc_nelmts_temp; + long long nbytes_temp = *(nbytesArray); + size_t nbytes_t = (size_t)nbytes_temp; + + status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t, + &nbytes_t, (double *)w0Array); + + *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t; + *nbytesArray = (jlong)nbytes_t; + } /* end direct cast special */ + + + if (status < 0) { + mode = JNI_ABORT; + } /* end if */ + else { + mode = 0; /* commit and free */ + } /* end else */ + + if (rdcc_nelmtsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, mode); + } /* end if */ + + if (nbytesArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode); + } /* end if */ + + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode); + } /* end if */ + + if (status < 0) { + h5libraryError(env); + } /* end if */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer + * Signature: (JJ[B[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1buffer(JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg) +{ + h5unimplemented(env, "H5Pset_buffer: not implemented"); + return -1; +#ifdef notdef + +/* DON'T IMPLEMENT THIS!!! */ + jint status = -1; + jbyte *tconvP; + jbyte *bkgP; + jboolean isCopy; + + if (tconv == NULL) + tconvP = (jbyte *)NULL; + else { + tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy); + if (tconvP == NULL) { + h5JNIFatalError(env, "H5Pset_buffer: tconv not pinned"); + return -1; + } + } + if (bkg == NULL) + bkgP = (jbyte *)NULL; + else { + bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy); + if (bkgP == NULL) { + h5JNIFatalError(env, "H5Pset_buffer: bkg not pinned"); + return -1; + } + } + + status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP); + if (status < 0) { + if (tconv != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT); + if (bkg != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT); + h5libraryError(env); + return -1; + } + + if (tconv != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0); + if (bkg != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0); + + return status; +#endif +} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer + * Signature: (J[B[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1buffer(JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg) +{ + h5unimplemented(env, "H5Pget_buffer: not implemented"); + return -1; +#ifdef notdef + +/* DON'T IMPLEMENT THIS!!! */ + jlong status = -1; + jbyte *tconvP; + jbyte *bkgP; + jboolean isCopy; + + if (tconv == NULL) { + h5nullArgument(env, "H5Pget_buffer: tconv input array is NULL"); + return -1; + } + tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy); + if (tconvP == NULL) { + h5JNIFatalError(env, "H5Pget_buffer: tconv not pinned"); + return -1; + } + if (bkg == NULL) { + h5nullArgument(env, "H5Pget_buffer: bkg array is NULL"); + return -1; + } + bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy); + if (bkgP == NULL) { + h5JNIFatalError(env, "H5Pget_buffer: bkg not pinned"); + return -1; + } + + status = H5Pget_buffer((hid_t)plist, tconvP, bkgP); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT); + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT); + h5libraryError(env); + return -1; + } + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0); + + return status; +#endif +} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size(JNIEnv *env, jclass clss, jlong plist) +{ + size_t size = 0; + + size = H5Pget_buffer((hid_t)plist, NULL, NULL); + if (size == 0) + h5libraryError(env); + + return (jlong)size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_preserve + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1preserve(JNIEnv *env, jclass clss, jlong plist, jboolean status) +{ + hbool_t st; + herr_t retVal = -1; + + if (status == JNI_TRUE) { + st = TRUE; + } /* end if */ + else if (status == JNI_FALSE) { + st = false; + } /* end else if */ + else { + h5badArgument(env, "H5Pset_preserve: status not TRUE or FALSE"); + return -1; + } /* end else */ + + retVal = H5Pset_preserve((hid_t)plist, st); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_preserve + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1preserve(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pget_preserve((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_deflate + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1deflate(JNIEnv *env, jclass clss, jlong plist, jint level) +{ + herr_t retVal = -1; + + retVal = H5Pset_deflate((hid_t)plist, (unsigned)level); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_gc_references + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref) +{ + herr_t retVal = -1; + unsigned gc_ref_val; + + if (gc_ref == JNI_TRUE) + gc_ref_val = 1; + else + gc_ref_val = 0; + + retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_gc_references + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id) +{ + unsigned gc_ref_val = 0; + jboolean bval = JNI_FALSE; + + if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0) { + h5libraryError(env); + } /* end if */ + else { + if (gc_ref_val == 1) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_btree_ratios + * Signature: (JDDD)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right) +{ + herr_t status = -1; + + status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right); + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_btree_ratios + * Signature: (J[D[D[D)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left, + jdoubleArray middle, jdoubleArray right) +{ + herr_t status = -1; + jdouble *leftP; + jdouble *middleP; + jdouble *rightP; + jboolean isCopy; + + if (left == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: left input array is NULL"); + } /* end if */ + else if (middle == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: middle input array is NULL"); + } /* end else if */ + else if (right == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: right input array is NULL"); + } /* end else if */ + else { + leftP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR left, &isCopy); + if (leftP == NULL) { + h5JNIFatalError(env, "H5Pget_btree_ratios: left not pinned"); + } /* end if */ + else { + middleP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR middle, &isCopy); + if (middleP == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); + } /* end if */ + else { + rightP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR right, &isCopy); + if (rightP == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); + } /* end if */ + else { + status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP, + (double *)middleP, (double *)rightP); + if (status < 0) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_small_data_block_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + long sz = (long)size; + herr_t retVal = -1; + + retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_small_data_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist) +{ + hsize_t s; + + if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alloc_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jint alloc_time) +{ + herr_t retVal = -1; + + retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alloc_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_alloc_time_t time; + + if (alloc_time == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_alloc_time: alloc_time is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR alloc_time, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_alloc_time: alloc_time not pinned"); + } /* end if */ + else { + retVal = H5Pget_alloc_time((hid_t)plist, &time); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = time; + ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jint fill_time) +{ + herr_t retVal = -1; + + retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jintArray fill_time) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_fill_time_t time; + + if (fill_time == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_fill_time: fill_time is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR fill_time, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_fill_time: fill_time not pinned"); + } /* end if */ + else { + retVal = H5Pget_fill_time((hid_t)plist, &time); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jint)time; + ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pfill_value_defined + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined(JNIEnv *env, jclass clss, jlong plist, jintArray status) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_fill_value_t value; + + if (status == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pfill_value_defined: status is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR status, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pfill_value_defined: status not pinned"); + } /* end if */ + else { + retVal = H5Pfill_value_defined((hid_t)plist, &value); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = value; + ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fletcher32 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fletcher32(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pset_fletcher32((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_edc_check + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1edc_1check(JNIEnv *env, jclass clss, jlong plist, jint check) +{ + herr_t retVal = -1; + + retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_edc_check + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1edc_1check(JNIEnv *env, jclass clss, jlong plist) +{ + H5Z_EDC_t retVal = -1; + + retVal = H5Pget_edc_check((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shuffle + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shuffle(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pset_shuffle((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_szip + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1szip(JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block) +{ + herr_t retVal = -1; + + retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_hyper_vector_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlong vector_size) +{ + herr_t retVal = -1; + + retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_hyper_vector_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size) +{ + herr_t retVal = -1; + jlong *theArray; + size_t size; + jboolean isCopy; + + if (vector_size == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_hyper_vector_size: vector_size is NULL"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR vector_size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_hyper_vector_size: vector_size not pinned"); + } /* end if */ + else { + retVal = H5Pget_hyper_vector_size((hid_t)plist, &size); + if (retVal < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)size; + ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pall_filters_avail + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Pall_filters_avail((hid_t)dcpl_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pmodify_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pmodify_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, + jint flags, jlong cd_nelmts, jintArray cd_values) +{ + herr_t status = -1; + jint *cd_valuesP; + jboolean isCopy; + + if (cd_values == NULL) { + h5nullArgument(env, "H5Pmodify_filter: cd_values is NULL"); + } /* end if */ + else { + cd_valuesP = ENVPTR->GetIntArrayElements(ENVPAR cd_values,&isCopy); + if (cd_valuesP == NULL) { + h5JNIFatalError(env, "H5Pmodify_filter: cd_values not pinned"); + } /* end if */ + else { + status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter,(const unsigned int)flags, + (size_t)cd_nelmts, (unsigned int *)cd_valuesP); + + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id(JNIEnv *env, jclass clss, jlong plist, jint filter, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name) +{ + jboolean isCopy; + herr_t status = -1; + jint *cd_valuesArray; + jint *flagsArray; + jlong *cd_nelmtsArray; + jstring str; + char *aName; + int i = 0; + int rank; + long bs; + + bs = (long)namelen; + if (bs <= 0) { + h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL"); + } /* end else if */ + else if (name == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: name is NULL"); + } /* end else if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed"); + return -1; + } /* end if */ + + flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + + cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned"); + return -1; + } /* end if */ + + cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + rank = ENVPTR->GetArrayLength(ENVPAR cd_values); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int."); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + unsigned int filter_config; + + status = H5Pget_filter_by_id2( (hid_t)plist, (H5Z_filter_t)filter, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, (char *)aName, &filter_config); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + + HDfree(aName); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fclose_degree + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist, jint fc_degree) +{ + herr_t retVal = -1; + + retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fclose_degree + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist) +{ + H5F_close_degree_t degree; + + if (H5Pget_fclose_degree((hid_t)plist, °ree) < 0) + h5libraryError(env); + + return (jint)degree; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */ + + +/********************************************************************** + * * + * File access properties * + * * + **********************************************************************/ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_family + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family(JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist) +{ + long ms = (long)memb_size; + herr_t retVal = -1; + + retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_family + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family(JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist) +{ + herr_t status = -1; + jlong *sizeArray; + jlong *plistArray; + jboolean isCopy; + hsize_t *sa; + size_t i; + size_t rank; + + if (memb_size == NULL) { + h5nullArgument(env, "H5Pget_family: memb_size is NULL"); + } /* end if */ + else if (memb_plist == NULL) { + h5nullArgument(env, "H5Pget_family: memb_plist is NULL"); + } /* end else if */ + else { + sizeArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_size, &isCopy); + if (sizeArray == NULL) { + h5JNIFatalError(env, "H5Pget_family: sizeArray not pinned"); + return -1; + } /* end if */ + rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size); + sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy); + if (plistArray == NULL) { + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_family: plistArray not pinned"); + return -1; + } /* end if */ + + status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray); + + if (status < 0) { + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + sizeArray[i] = (jlong)sa[i]; + } /* end for */ + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_core + * Signature: (JJZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_core + * Signature: (J[J[Z)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store) +{ + herr_t status = -1; + jlong *incArray; + jboolean *backArray; + jboolean isCopy; + + if (increment == NULL) { + h5nullArgument(env, "H5Pget_fapl_core: increment is NULL"); + } /* end if */ + else if (backing_store == NULL) { + h5nullArgument(env, "H5Pget_fapl_core: backing_store is NULL"); + } /* end else if */ + else { + incArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR increment, &isCopy); + if (incArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_core: incArray not pinned"); + return -1; + } /* end if */ + + backArray = (jboolean *)ENVPTR->GetBooleanArrayElements(ENVPAR backing_store, &isCopy); + if (backArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_core: backArray not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long inc_temp = *(incArray); + size_t inc_t = (size_t)inc_temp; + + status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray); + + *incArray = (jlong)inc_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT); + ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, 0); + ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_family_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id, jlong offset) +{ + herr_t retVal = -1; + + retVal = H5Pset_family_offset ((hid_t)fapl_id, (hsize_t)offset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_family_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id) +{ + hsize_t offset = 0; + herr_t retVal = -1; + + retVal = H5Pget_family_offset ((hid_t)fapl_id, &offset); + if (retVal < 0) + h5libraryError(env); + + return (jlong)offset; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_log + * Signature: (JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log(JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size) +{ + herr_t retVal = -1; + const char *pLogfile; + + PIN_JAVA_STRING0(logfile, pLogfile); + + retVal = H5Pset_fapl_log( (hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size ); + + UNPIN_JAVA_STRING(logfile, pLogfile); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove_filter + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5P1remove_1filter(JNIEnv *env, jclass clss, jlong obj_id, jint filter) +{ + herr_t status = -1; + + status = H5Premove_filter ((hid_t)obj_id, (H5Z_filter_t)filter); + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset + * Signature: (JLjava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *env, jclass clss, jlong plid, jstring name, jint val) +{ + hid_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pset((hid_t)plid, cstr, &val); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pexist + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + hid_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pexist((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pexist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_size + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1size(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + hid_t retVal = -1; + const char *cstr; + size_t size; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pget_size((hid_t)plid, cstr, &size); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nprops + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nprops(JNIEnv *env, jclass clss, jlong plid) +{ + size_t nprops; + + if (H5Pget_nprops((hid_t)plid, &nprops) < 0) + h5libraryError(env); + + return (jlong)nprops; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nprops */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class_1name(JNIEnv *env, jclass clss, jlong plid) +{ + char *c_str; + jstring j_str; + + c_str = H5Pget_class_name((hid_t)plid); + if (c_str == NULL) { + h5libraryError(env); + } /* end if */ + else { + j_str = ENVPTR->NewStringUTF(ENVPAR c_str); + H5free_memory(c_str); + + if (j_str == NULL) + h5JNIFatalError(env,"H5Pget_class_name: return string failed"); + } /* end else */ + return j_str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_parent + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class_1parent(JNIEnv *env, jclass clss, jlong plid) +{ + hid_t retVal = -1; + + retVal = H5Pget_class_parent((hid_t)plid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1parent */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pisa_class + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pisa_1class(JNIEnv *env, jclass clss, jlong plid, jlong pcls) +{ + htri_t retVal = -1; + + retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pisa_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + jint val; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pget((hid_t)plid, cstr, &val); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)val; +} /* end Java_hdf_hdf5lib_H5_H5Pget */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pequal + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pequal(JNIEnv *env, jclass clss, jlong plid1, jlong plid2) +{ + htri_t retVal = -1; + + retVal = H5Pequal((hid_t)plid1, (hid_t)plid2); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pequal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy_prop + * Signature: (JJLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pcopy_1prop(JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Premove(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Premove((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Premove */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Punregister + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Punregister(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Punregister((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Punregister */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pclose_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *env, jclass clss, jlong plid) +{ + herr_t retVal = -1; + + retVal = H5Pclose_class((hid_t)plid); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter2(JNIEnv *env, jclass clss, jlong plist, jint filter_number, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, + jobjectArray name, jintArray filter_config) +{ + herr_t status = -1; + jint *flagsArray; + jlong *cd_nelmtsArray; + jint *cd_valuesArray; + jint *filter_configArray; + jboolean isCopy; + char *filter; + jstring str; + + if (namelen <= 0) { + h5badArgument(env, "H5Pget_filter: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5badArgument(env, "H5Pget_filter: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL"); + } /* end else if */ + else if (filter_config == NULL) { + h5badArgument(env, "H5Pget_filter: filter_config is NULL"); + } /* end else if */ + else { + filter = (char*)HDmalloc(sizeof(char)*(size_t)namelen); + if (filter == NULL) { + h5outOfMemory(env, "H5Pget_filter: namelent malloc failed"); + return -1; + } /* end if */ + flagsArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: flags array not pinned"); + return -1; + } /* end if */ + + cd_nelmtsArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned"); + return -1; + } /* end if */ + filter_configArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy); + if (filter_configArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: filter_config array not pinned"); + return -1; + } /* end if */ + + if (*cd_nelmtsArray == 0 && cd_values == NULL) { + /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = 0; + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, NULL, + (size_t)namelen, filter, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end if */ + else { + if (cd_values == NULL) { + h5badArgument(env, "H5Pget_filter: cd_values is NULL"); + return -1; + } /* end if */ + cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, filter, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + } /* end else */ + + if (status < 0) { + if (cd_values) + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5libraryError(env); + } /* end if */ + else { + if (cd_values) + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR filter); + HDfree(filter); + if (str == NULL) + h5JNIFatalError(env, "H5Pget_filter: return string not pinned"); + else + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2(JNIEnv *env, jclass clss, jlong plist, jint filter, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config) +{ + herr_t status = -1; + int i = 0; + jint *cd_valuesArray; + jint *flagsArray; + jint *filter_configArray; + jlong *cd_nelmtsArray; + jboolean isCopy; + long bs; + char *aName; + jstring str; + + bs = (long)namelen; + if (bs <= 0) { + h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL"); + } /* end else if */ + else if (name == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: name is NULL"); + } /* end else if */ + else if (filter_config == NULL) { + h5badArgument(env, "H5Pget_filter_by_id: filter_config is NULL"); + } /* end else if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed"); + return -1; + } /* end if */ + flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags,&isCopy); + if (flagsArray == NULL) { + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned"); + return -1; + } /* end if */ + cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int."); + return -1; + } /* end if */ + filter_configArray = ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy); + if (filter_configArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special handling */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + HDfree(aName); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nlinks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id) +{ + size_t nlinks; + if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0) + h5libraryError(env); + + return (jlong) nlinks; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nlinks + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks) +{ + herr_t retVal = -1; + + if (nlinks <= 0) { + h5badArgument(env, "H5Pset_1nlinks: nlinks_l <= 0"); + } /* end if */ + else { + retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_libver_bounds + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver) +{ + herr_t retVal = -1; + H5F_libver_t *theArray = NULL; + jboolean isCopy; + + if (libver == NULL) { + h5nullArgument(env, "H5Pget_libver_bounds: libversion bounds is NULL"); + } /* end if */ + else { + theArray = (H5F_libver_t*)ENVPTR->GetIntArrayElements(ENVPAR libver, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_libver_bounds: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_libver_bounds((hid_t)fapl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_libver_bounds + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high) +{ + herr_t retVal = -1; + + if ((H5F_libver_t)high != H5F_LIBVER_LATEST) { + h5badArgument(env, "H5Pset_libver_bounds: invalid high library version bound"); + } /* end if */ + else if(((H5F_libver_t)low !=H5F_LIBVER_EARLIEST) && ((H5F_libver_t)low != H5F_LIBVER_LATEST)) { + h5badArgument(env, "H5Pset_libver_bounds: invalid low library version bound"); + } /* end else if */ + else { + retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id) +{ + unsigned crt_order_flags; + + if(H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0) + h5libraryError(env); + + return (jint)crt_order_flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags) +{ + herr_t retVal = -1; + + retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id) +{ + unsigned crt_order_flags; + + if(H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0) + h5libraryError(env); + + return (jint)crt_order_flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags) +{ + herr_t retVal = -1; + + retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_copy_object + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options) +{ + herr_t retVal = -1; + + retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options); + if(retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_copy_object + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id) +{ + unsigned copy_options; + + if(H5Pget_copy_object((hid_t)ocp_plist_id, ©_options) < 0) + h5libraryError(env); + + return (jint)copy_options; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_create_intermediate_group + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group) +{ + herr_t retVal = -1; + + retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_create_intermediate_group + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id) +{ + unsigned crt_intermed_group; + + if(H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0) + h5libraryError(env); + + return (jboolean)crt_intermed_group; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_data_transform + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jstring expression) +{ + herr_t retVal = -1; + const char *express; + + PIN_JAVA_STRING(expression, express, -1); + + retVal = H5Pset_data_transform((hid_t)plist_id, express); + + UNPIN_JAVA_STRING(expression, express); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_data_transform + * Signature: (J[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size) +{ + size_t buf_size; + char *express; + jlong express_size = -1; + jstring str = NULL; + + if (size <= 0) { + h5badArgument(env, "H5Pget_data_transform: size <= 0"); + } /* end if */ + else { + express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, (char*)NULL, (size_t)size); + if(express_size < 0) { + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)express_size + 1;/* add extra space for the null terminator */ + express = (char*)HDmalloc(sizeof(char) * buf_size); + if (express == NULL) { + h5outOfMemory(env, "H5Pget_data_transform: malloc failed "); + } /* end if */ + else { + express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, express, (size_t)size); + if (express_size < 0) { + HDfree(express); + h5libraryError(env); + } + else { + str = ENVPTR->NewStringUTF(ENVPAR express); + HDfree(express); + if (str == NULL) + h5JNIFatalError(env, "H5Pget_data_transform: return string not created"); + else + ENVPTR->SetObjectArrayElement(ENVPAR expression, 0, str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return express_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_acc_flags + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id) +{ + unsigned flags; + + if(H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0) + h5libraryError(env); + + return (jint)flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_acc_flags + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id, jint flags) +{ + herr_t retVal = -1; + + if (((unsigned) flags != H5F_ACC_RDWR) && + ((unsigned) flags != H5F_ACC_RDONLY) && + ((unsigned) flags != H5F_ACC_DEFAULT)) { + h5badArgument(env, "H5Pset_elink_acc_flags: invalid flags value"); + } /* end if */ + else { + retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); + if (retVal < 0) + h5libraryError(env); + } /* end else */ + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change(JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense) +{ + herr_t retVal = -1; + + if(max_compact < min_dense) { + h5badArgument(env, "H5Pset_link_phase_change: max compact value must be >= min dense value"); + } /* end if */ + else if(max_compact > 65535) { + h5badArgument(env, "H5Pset_link_phase_change: max compact value must be < 65536"); + } /* end else if */ + else if(min_dense > 65535) { + h5badArgument(env, "H5Pset_link_phase_change: min dense value must be < 65536"); + } /* end else if */ + else { + retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (links == NULL) { + h5nullArgument( env, "H5Pget_link_phase_change: links is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR links, &isCopy); + if (theArray == NULL) { + h5JNIFatalError( env, "H5Pget_link_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_link_phase_change((hid_t)gcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (attributes == NULL) { + h5nullArgument(env, "H5Pget_attr_phase_change: attributes is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR attributes, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_attr_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_phase_change + * Signature: (JII)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense) +{ + herr_t retVal = -1; + + retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense); + if(retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_shared_mesg_phase_change: size is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_shared_mesg_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree) +{ + herr_t retVal = -1; + + /* Check that values are sensible. The min_btree value must be no greater + * than the max list plus one. + * + * Range check to make certain they will fit into encoded form. + */ + + if(max_list + 1 < min_btree) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value"); + } /* end if */ + else if(max_list > H5O_SHMESG_MAX_LIST_SIZE) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE"); + } /* end else if */ + else if(min_btree > H5O_SHMESG_MAX_LIST_SIZE) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE"); + } /* end else if */ + else { + retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_nindexes + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong fcpl_id) +{ + unsigned nindexes; + + if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) + h5libraryError(env); + + return (jint)nindexes; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_nindexes + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong plist_id, jint nindexes) +{ + herr_t retVal = -1; + + if (nindexes > H5O_SHMESG_MAX_NINDEXES) { + h5badArgument(env, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES"); + } /* end if */ + else { + retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_index + * Signature: (JIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, + jint mesg_type_flags, jint min_mesg_size) +{ + herr_t retVal = -1; + unsigned nindexes;/* Number of SOHM indexes */ + + /* Check arguments */ + if(mesg_type_flags > H5O_SHMESG_ALL_FLAG) { + h5badArgument(env, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags"); + } /* end if */ + else if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) { /* Read the current number of indexes */ + h5libraryError(env); + } /* end else if */ + else { + /* Range check */ + if((unsigned)index_num >= nindexes) { + h5badArgument(env, "H5Pset_shared_mesg_index: index_num is too large; no such index"); + } /* end if */ + else { + retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_index + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info) +{ + herr_t retVal = -1; + unsigned nindexes;/* Number of SOHM indexes */ + unsigned *theArray = NULL; + jboolean isCopy; + + /* Read the current number of indexes */ + if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes)<0) { + h5libraryError(env); + } /* end if */ + else { + /* Range check */ + if((unsigned)index_num >= nindexes) { + h5badArgument(env, "H5Pget_shared_mesg_index: index_num is too large; no such index"); + } /* end if */ + else if (mesg_info == NULL) { + h5nullArgument(env, "H5Pget_shared_mesg_index: mesg_info is NULL"); + } /* end else if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR mesg_info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_shared_mesg_index: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_local_heap_size_hint + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint) +{ + herr_t retVal = -1; + + retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_local_heap_size_hint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id) +{ + size_t size_hint; + + if(H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0) + h5libraryError(env); + + return (jlong)size_hint; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nbit + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1nbit(JNIEnv *env, jclass clss, jlong plist_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_nbit((hid_t)plist_id); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_scaleoffset + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset(JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor) +{ + herr_t retVal = -1; + + /* Check arguments */ + if(scale_factor < 0) { + h5badArgument(env, "H5Pset_scaleoffset: scale factor must be > 0"); + } /* end if */ + else { + if(scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT){ + h5badArgument(env, "H5Pset_scaleoffset: invalid scale type"); + } /* end if */ + else { + retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_est_link_info + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len) +{ + herr_t retVal = -1; + + /* Range check values */ + if((est_num_entries > 65535) || (est_name_len > 65535)) { + h5badArgument(env, "H5Pset_est_link_info: est. name length or number of entries must be < 65536"); + } /* end if */ + else { + retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_est_link_info + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (link_info == NULL) { + h5nullArgument(env, "H5Pget_est_link_info: link_info is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR link_info,&isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_est_link_info: input not pinned"); + } /* end if */ + else { + retVal= H5Pget_est_link_info((hid_t)gcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_fapl + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pget_elink_fapl + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id) +{ + hid_t retVal = -1; + + retVal = H5Pget_elink_fapl((hid_t)lapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_prefix + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName, -1); + + retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_prefix + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix) +{ + size_t size = 0; + char *pre; + jlong prefix_size; + jstring str = NULL; + + if (prefix == NULL) { + h5nullArgument(env, "H5Pget_elink_prefix: prefix is NULL"); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_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_elink_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)pre, size); + + if (prefix_size < 0) { + HDfree(pre); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) { + h5JNIFatalError(env, "H5Pget_elink_prefix: return string not created"); + } /* end if */ + else + ENVPTR->SetObjectArrayElement(ENVPAR prefix, 0, str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return prefix_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_direct + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment, + jlong block_size, jlong cbuf_size) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_DIRECT + retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size); +#endif + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_direct + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_DIRECT + size_t alignment = 0; + size_t block_size = 0; + size_t cbuf_size = 0; + jlong *theArray; + jboolean isCopy; + if (info == NULL) { + h5nullArgument(env, "H5Pget_fapl_direct: info input array is NULL"); + } /* end if */ + else { + if (ENVPTR->GetArrayLength(ENVPAR info) < 3) { + h5badArgument( env, "H5Pget_fapl_direct: info input array < 4"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_direct: info not pinned"); + } /* end if */ + else { + retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size); + if(retVal < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)alignment; + theArray[1] = (jlong)block_size; + theArray[2] = (jlong)cbuf_size; + ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ +#else + if (retVal < 0) + h5libraryError(env); +#endif + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_sec2 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_sec2((hid_t) fapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_stdio + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_stdio((hid_t) fapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_windows + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_WINDOWS + retVal = H5Pset_fapl_windows((hid_t) fapl_id); +#endif + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jintArray memb_map, + jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr) +{ + herr_t status = -1; + int i; + jint *themapArray = NULL; + jlong *thefaplArray = NULL; + jlong *theaddrArray = NULL; + char **mName = NULL; + jstring str; + jboolean isCopy; + int relax = 0; + + if (memb_map) { + themapArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy); + if (themapArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_fapl) { + thefaplArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy); + if (thefaplArray == NULL) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_addr) { + theaddrArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy); + if (theaddrArray == NULL) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_name) + mName = (char**)HDcalloc(H5FD_MEM_NTYPES, sizeof (*mName)); + + status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t*)themapArray, (hid_t*)thefaplArray, mName, (haddr_t*)theaddrArray, (hbool_t*)&relax); + + if (status < 0) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT); + if (memb_name) h5str_array_free(mName, H5FD_MEM_NTYPES); + h5libraryError(env); + } /* end if */ + else { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0); + + if (memb_name) { + if (mName) { + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + if (*(mName + i)) { + str = ENVPTR->NewStringUTF(ENVPAR *(mName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)str); + } /* end if */ + } /* for (i=0; iGetIntArrayElements(ENVPAR memb_map, &isCopy); + if (themapArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned"); + return; + } /* end if */ + } /* end if */ + + if (memb_fapl) { + thefaplArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy); + if (thefaplArray == NULL) { + if (memb_map) + ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned"); + return; + } /* end if */ + } /* end if */ + + if (memb_addr) { + theaddrArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy); + if (theaddrArray == NULL) { + if (memb_map) + ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned"); + return; + } /* end if */ + } /* end if */ + + HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char*)); + if (memb_name) { + int i; + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) memb_name, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + member_name[i] = (char*)HDmalloc(strlen(utf8) + 1); + if (member_name[i]) { + strcpy(member_name[i], utf8); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for */ + mName = (const char **)member_name; + } /* end if */ + + status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray, mName, (const haddr_t *)theaddrArray, (hbool_t)relax); + + if (status < 0) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT); + if (memb_name) { + int i; + for (i = 0; i < H5FD_MEM_NTYPES; i++) + HDfree(member_name[i]); + } /* end if */ + h5libraryError(env); + } /* end if */ + else { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0); + if (memb_name) { + if (mName != NULL) { + int i; + Sjc = ENVPTR->FindClass(ENVPAR "java/lang/String"); + if (Sjc != NULL) { + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + rstring = ENVPTR->NewStringUTF(ENVPAR member_name[i]); + o = ENVPTR->GetObjectArrayElement(ENVPAR memb_name, i); + if (o != NULL) { + bb = ENVPTR->IsInstanceOf(ENVPAR o, Sjc); + if (bb == JNI_TRUE) { + ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)rstring); + } /* end if */ + ENVPTR->DeleteLocalRef(ENVPAR o); + } /* end if */ + HDfree(member_name[i]); + } /* end for */ + } /* end if */ + } /* end if */ + } /* end if */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_split + * Signature: (JLjava/lang/String;JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split(JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id) +{ + herr_t retVal = -1; + const char *mstr; + const char *rstr; + + PIN_JAVA_STRING_TWO0(metaext, mstr, rawext, rstr); + + retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id); + + UNPIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_meta_block_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + long sz = (long)size; + + if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_meta_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist) +{ + hsize_t s; + + if (H5Pget_meta_block_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sieve_buf_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + size_t sz = (size_t)size; + + if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sieve_buf_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist) +{ + size_t s; + + if ( H5Pget_sieve_buf_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist, jint size) +{ + unsigned sz = (unsigned)size; + + if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist) +{ + unsigned s; + + if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jint)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_mdc_config + * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *env, jclass clss, jlong plist) +{ + H5AC_cache_config_t cacheinfo; + herr_t status = -1; + jvalue args[30]; + jstring j_str = NULL; + jobject ret_obj = NULL; + + HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); + cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION; + + status = H5Pget_mdc_config((hid_t)plist, &cacheinfo); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = cacheinfo.version; + args[1].z = cacheinfo.rpt_fcn_enabled; + args[2].z = cacheinfo.open_trace_file; + args[3].z = cacheinfo.close_trace_file; + if (cacheinfo.trace_file_name != NULL) { + j_str = ENVPTR->NewStringUTF(ENVPAR cacheinfo.trace_file_name); + } /* end if */ + args[4].l = j_str; + args[5].z = cacheinfo.evictions_enabled; + args[6].z = cacheinfo.set_initial_size; + args[7].j = (jlong)cacheinfo.initial_size; + args[8].d = cacheinfo.min_clean_fraction; + args[9].j = (jlong)cacheinfo.max_size; + args[10].j = (jlong)cacheinfo.min_size; + args[11].j = cacheinfo.epoch_length; + args[12].i = cacheinfo.incr_mode; + args[13].d = cacheinfo.lower_hr_threshold; + args[14].d = cacheinfo.increment; + args[15].z = cacheinfo.apply_max_increment; + args[16].j = (jlong)cacheinfo.max_increment; + args[17].i = cacheinfo.flash_incr_mode; + args[18].d = cacheinfo.flash_multiple; + args[19].d = cacheinfo.flash_threshold; + args[20].i = cacheinfo.decr_mode; + args[21].d = cacheinfo.upper_hr_threshold; + args[22].d = cacheinfo.decrement; + args[23].z = cacheinfo.apply_max_decrement; + args[24].j = (jlong)cacheinfo.max_decrement; + args[25].i = cacheinfo.epochs_before_eviction; + args[26].z = cacheinfo.apply_empty_reserve; + args[27].d = cacheinfo.empty_reserve; + args[28].j = (jlong)cacheinfo.dirty_bytes_threshold; + args[29].i = cacheinfo.metadata_write_strategy; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_mdc_config + * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *env, jclass clss, jlong plist, jobject cache_config) +{ + herr_t status = -1; + jclass cls; + jfieldID fid; + jstring j_str; + const char *str; + H5AC_cache_config_t cacheinfo; + + cls = ENVPTR->GetObjectClass(ENVPAR cache_config); + fid = ENVPTR->GetFieldID(ENVPAR cls, "version", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: version"); + return; + } /* end if */ + cacheinfo.version = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading version failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "rpt_fcn_enabled", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: rpt_fcn_enabled"); + return; + } /* end if */ + cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading rpt_fcn_enabled failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "open_trace_file", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: open_trace_file"); + return; + } /* end if */ + cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading open_trace_file failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "close_trace_file", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: close_trace_file"); + return; + } /* end if */ + cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading close_trace_file failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "trace_file_name", "Ljava/lang/String;"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: trace_file_name"); + return; + } /* end if */ + j_str = (jstring)ENVPTR->GetObjectField(ENVPAR cache_config, fid); + str = ENVPTR->GetStringUTFChars(ENVPAR j_str, NULL); + if (str == NULL) { + h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name"); + return; + } /* end if */ + strncpy(cacheinfo.trace_file_name, str, 1025); + ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "evictions_enabled", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: evictions_enabled"); + return; + } /* end if */ + cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading evictions_enabled failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "set_initial_size", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: set_initial_size"); + return; + } /* end if */ + cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading set_initial_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "initial_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: initial_size"); + return; + } /* end if */ + cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading initial_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "min_clean_fraction", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: min_clean_fraction"); + return; + } /* end if */ + cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading min_clean_fraction failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_size"); + return; + } /* end if */ + cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "min_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: min_size"); + return; + } /* end if */ + cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading min_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "epoch_length", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: epoch_length"); + return; + } + cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading epoch_length failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "incr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: incr_mode"); + return; + } /* end if */ + cacheinfo.incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_incr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading incr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "lower_hr_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: lower_hr_threshold"); + return; + } /* end if */ + cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading lower_hr_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "increment", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: increment"); + return; + } /* end if */ + cacheinfo.increment = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_increment", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_max_increment"); + return; + } /* end if */ + cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_increment", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_increment"); + return; + } /* end if */ + cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_incr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_incr_mode"); + return; + } /* end if */ + cacheinfo.flash_incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_incr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_multiple", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_multiple"); + return; + } /* end if */ + cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_multiple failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_threshold"); + return; + } /* end if */ + cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "decr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: decr_mode"); + return; + } /* end if */ + cacheinfo.decr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_decr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading decr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "upper_hr_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: upper_hr_threshold"); + return; + } /* end if */ + cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading upper_hr_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "decrement", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: decrement"); + return; + } /* end if */ + cacheinfo.decrement = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_decrement", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_max_decrement"); + return; + } /* end if */ + cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_decrement", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_decrement"); + return; + } /* end if */ + cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "epochs_before_eviction", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: epochs_before_eviction"); + return; + } /* end if */ + cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading epochs_before_eviction failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_empty_reserve", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_empty_reserve"); + return; + } /* end if */ + cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_empty_reserve failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "empty_reserve", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: empty_reserve"); + return; + } /* end if */ + cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading empty_reserve failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "dirty_bytes_threshold", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: dirty_bytes_threshold"); + return; + } /* end if */ + cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading dirty_bytes_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "metadata_write_strategy", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: metadata_write_strategy"); + return; + } /* end if */ + cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading metadata_write_strategy failed"); + return; + } /* end if */ + + status = H5Pset_mdc_config((hid_t)plist, &cacheinfo); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_cache + * Signature: (JJJD)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots, + jlong rdcc_nbytes, jdouble rdcc_w0) +{ + if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_cache + * Signature: (J[J[J[D)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots, + jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) +{ + herr_t status = -1; + jint mode; + jdouble *w0Array; + jlong *rdcc_nslotsArray; + jlong *nbytesArray; + jboolean isCopy; + + if (rdcc_w0 == NULL) { + w0Array = (jdouble *)NULL; + } /* end if */ + else { + w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy); + if (w0Array == NULL) { + h5JNIFatalError(env, "H5Pget_chunk_cache: w0_array array not pinned"); + return; + } /* end if */ + } /* end else */ + + if (rdcc_nslots == NULL) { + rdcc_nslotsArray = (jlong *)NULL; + } /* end if */ + else { + rdcc_nslotsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nslots, &isCopy); + if (rdcc_nslotsArray == NULL) { + /* exception -- out of memory */ + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_chunk_cache: rdcc_nslots array not pinned"); + return; + } /* end if */ + } /* end else */ + + if (rdcc_nbytes == NULL) { + nbytesArray = (jlong *)NULL; + } /* end if */ + else { + nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy); + if (nbytesArray == NULL) { + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + if (rdcc_nslotsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_chunk_cache: nbytesArray array not pinned"); + return; + } /* end if */ + } /* end else */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long rdcc_nslots_temp = *(rdcc_nslotsArray); + size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp; + long long nbytes_temp = *(nbytesArray); + size_t nbytes_t = (size_t)nbytes_temp; + + status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array); + + *rdcc_nslotsArray = (jlong)rdcc_nslots_t; + *nbytesArray = (jlong)nbytes_t; + } /* end direct cast special handling */ + + if (status < 0) { + mode = JNI_ABORT; + } /* end if */ + else { + mode = 0; /* commit and free */ + } /* end else */ + + if (rdcc_nslotsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, mode); + } + /* end if */ + if (nbytesArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode); + } /* end if */ + + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode); + } /* end if */ + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_obj_track_times + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid) +{ + hbool_t track_times; + + if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0) { + h5libraryError(env); + return JNI_FALSE; + } /* end if */ + if (track_times == 1) { + return JNI_TRUE; + } /* end if */ + return JNI_FALSE; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_obj_track_times + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid, jboolean track_times) +{ + hbool_t track; + + if (track_times == JNI_TRUE) { + track = 1; + } /* end if */ + else { + track = 0; + } /* end else */ + + if (H5Pset_obj_track_times((hid_t)objplid, track) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_char_encoding + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl) +{ + H5T_cset_t encoding; + + if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0) + h5libraryError(env); + + return encoding; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_char_encoding + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl, jint encoding) +{ + if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual + * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual(JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id, + jstring src_file_name, jstring src_dset_name, jlong src_space_id) +{ + herr_t retVal = -1; + const char *fstr; + const char *dstr; + + PIN_JAVA_STRING_TWO0(src_file_name, fstr, src_dset_name, dstr); + + retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id); + + UNPIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_count + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + size_t s; + + if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_vspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + hid_t space_id = -1; + + space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index); + if (space_id < 0) + h5libraryError(env); + + return (jlong)space_id; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_srcspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + hid_t space_id = -1; + + space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index); + if (space_id < 0) + h5libraryError(env); + + return (jlong)space_id; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_filename + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + char *fname; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the filename */ + buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Pget_virtual_filename: buf_size < 0"); + } /* end if */ + else if (buf_size >= 0) { + buf_size++; /* add extra space for the null terminator */ + fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (fname == NULL) { + h5outOfMemory( env, "H5Pget_virtual_filename: malloc failed"); + } /* end if */ + else { + status = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size); + + if (status >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR fname); + HDfree(fname); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_filename: return string not allocated"); + } /* end if */ + else { + HDfree(fname); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else if */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_dsetname + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + char *dname; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the filename */ + buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Pget_virtual_dsetname: buf_size < 0"); + } /* end if */ + else if (buf_size > 0) { + buf_size++; /* add extra space for the null terminator */ + dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (dname == NULL) { + h5outOfMemory( env, "H5Pget_virtual_dsetname: malloc failed"); + } /* end if */ + else { + status = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size); + + if (status >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR dname); + HDfree(dname); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_dsetname: return string not allocated"); + } /* end if */ + else { + HDfree(dname); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else if */ + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_view + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id) +{ + H5D_vds_view_t virtual_view; + + if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0) + h5libraryError(env); + + return (jint)virtual_view; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_view + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id, jint view) +{ + if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_printf_gap + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id) +{ + hsize_t gap_size; + + if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0) + h5libraryError(env); + + return (jlong)gap_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_printf_gap + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size) +{ + if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_file_space + * Signature: (J[I[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1file_1space(JNIEnv *env, jclass clss, jlong fcpl_id, jintArray strategy, jlongArray threshold) +{ + herr_t status = -1; + jint *thestrategyArray = NULL; + jlong *thethresholdArray = NULL; + jboolean isCopy; + + if (strategy) { + thestrategyArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR strategy, &isCopy); + if (thestrategyArray == NULL) { + h5JNIFatalError(env, "H5Pget_file_space: strategy not pinned"); + return; + } + } + + if (threshold) { + thethresholdArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR threshold, &isCopy); + if (thethresholdArray == NULL) { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_file_space: threshold not pinned"); + return; + } /* end if */ + } /* end if */ + + status = H5Pget_file_space((hid_t)fcpl_id, (H5F_file_space_type_t*)thestrategyArray, (hsize_t*)thethresholdArray); + + if (status < 0) { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT); + if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, 0); + if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, 0); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_space + * Signature: (JIJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1file_1space(JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jlong threshold) +{ + if (H5Pset_file_space((hid_t)fcpl_id, (H5F_file_space_type_t)strategy, (hsize_t)threshold) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1space */ + + +static herr_t +H5P_cls_create_cb(hid_t prop_id, void *create_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I"); + if (mid != 0) { + /* fprintf(stderr, "JNI H5P_cls_create_func_cb execute\n"); fflush(stderr); */ + status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, prop_id, create_data); + /* fprintf(stderr, "\nJNI H5P_cls_create_func_cb status: %d\n", status); fflush(stderr); */ + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_create_cb */ + +static herr_t +H5P_cls_copy_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, new_prop_id, old_prop_id, copy_data); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_ccopy_cb */ + +static herr_t +H5P_cls_close_cb(hid_t prop_id, void *close_data) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, prop_id, close_data); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_close_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class_nocb + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb(JNIEnv *env, jclass clss, jlong parent_class, jstring name) +{ + hid_t class_id = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + + if (class_id < 0) + h5libraryError(env); + + return (jlong)class_id; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate_1class(JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op, + jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data) +{ + hid_t class_id = -1; + const char *cstr; + copy_callback = copy_op; + close_callback = close_op; + create_callback = create_op; + + PIN_JAVA_STRING(name, cstr, -1); + + class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void*) create_data, + (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void*) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void*) close_data); + + UNPIN_JAVA_STRING(name, cstr); + + if (class_id < 0) + h5libraryError(env); + + return (jlong)class_id; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */ + +static herr_t +H5P_prp_create_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_create_cb */ + +static herr_t +H5P_prp_copy_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_copy_cb */ + +static herr_t +H5P_prp_close_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_close_cb */ + +static int +H5P_prp_compare_cb(void *value1, void *value2, size_t size) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR compare_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([B[BJ)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR compare_callback, mid, value1, value2, size); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_compare_cb */ + +static herr_t +H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR get_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR get_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_get_cb */ + +static herr_t +H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR set_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR set_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_set_cb */ + +static herr_t +H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR delete_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR delete_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_delete_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pregister2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pregister2: buf not pinned"); + } /* end if */ + else { + status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pregister2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, + jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete, + jobject prp_copy, jobject prp_cmp, jobject prp_close) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + copy_callback = prp_copy; + close_callback = prp_close; + create_callback = prp_create; + compare_callback = prp_cmp; + set_callback = prp_set; + get_callback = prp_get; + delete_callback = prp_delete; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pregister2: buf not pinned"); + } /* end if */ + else { + status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, (H5P_prp_create_func_t)H5P_prp_create_cb, + (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb, + (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pinsert2: buf not pinned"); + } /* end if */ + else { + status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pinsert2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, + jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete, + jobject prp_copy, jobject prp_cmp, jobject prp_close) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + copy_callback = prp_copy; + close_callback = prp_close; + compare_callback = prp_cmp; + set_callback = prp_set; + get_callback = prp_get; + delete_callback = prp_delete; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pinsert2: buf not pinned"); + } /* end if */ + else { + status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, + (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb, + (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */ + +static herr_t +H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + + /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */ + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: AttachCurrentThread failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetObjectClass failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I"); + if (mid == 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetMethodID failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + /* fprintf(stderr, "JNI H5P_iterate_cb execute\n"); fflush(stderr); */ + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, prop_id, str, op_data); + /* fprintf(stderr, "\nJNI H5P_iterate_cb status: %d\n", status); fflush(stderr); */ + } /* end else */ + } /* end else */ + } /* end else */ + + JVMPTR->DetachCurrentThread(JVMPAR); + /* fprintf(stderr, "\nJNI H5P_iterate_cb leave\n"); fflush(stderr); */ + + return status; +} /* end H5P_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Piterate + * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Piterate(JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + jint *theArray = NULL; + jboolean isCopy; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Piterate: op_data is NULL"); + } /* end if */ + else if (callback_op == NULL) { + h5nullArgument(env, "H5Piterate: callback_op is NULL"); + } /* end else if */ + else { + if (idx == NULL) { + status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Piterate: idx not pinned"); + return -1; + } /* end if */ + status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + } /* end else */ + + if (status < 0) { + if(idx) + ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else if (idx) + ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, 0); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Piterate */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h new file mode 100644 index 00000000000..ea1ee528aa5 --- /dev/null +++ b/java/src/jni/h5pImp.h @@ -0,0 +1,1313 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5P */ + +#ifndef _Included_hdf_hdf5lib_H5_H5P +#define _Included_hdf_hdf5lib_H5_H5P + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcreate + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcopy +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_version + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1version +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_userblock + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1userblock +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_userblock + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1userblock +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sizes + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sizes +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sizes + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sizes +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sym_k + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sym_1k +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sym_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sym_1k +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_istore_k + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1istore_1k +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_istore_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1istore_1k +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_layout + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1layout +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_layout + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1layout +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk +(JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk + * Signature: (JI[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk +(JNIEnv *, jclass, jlong, jint, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alignment + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alignment +(JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alignment + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alignment +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_external + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1external +(JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external_count + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external_1count +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external + * Signature: (JIJ[Ljava/lang/String;[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external +(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1value +(JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1value +(JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1filter +(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nfilters + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nfilters +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_driver + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1driver +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_cache + * Signature: (JIJJD)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1cache +(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_cache + * Signature: (J[I[J[J[D)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1cache +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer + * Signature: (JJ[B[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer +(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer + * Signature: (J[B[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer +(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_preserve + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1preserve +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_preserve + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1preserve +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_deflate + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1deflate +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_gc_references + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1gc_1references +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_gc_references + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1gc_1references +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_btree_ratios + * Signature: (JDDD)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios +(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_btree_ratios + * Signature: (J[D[D[D)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios +(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_small_data_block_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_small_data_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alloc_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alloc_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1time +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1time +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pfill_value_defined + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fletcher32 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_edc_check + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1edc_1check +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_edc_check + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1edc_1check +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shuffle + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shuffle +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_szip + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1szip +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_hyper_vector_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_hyper_vector_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pall_filters_avail + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pmodify_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter +(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fclose_degree + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fclose_degree + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_family + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family +(JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_family + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family +(JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_core + * Signature: (JJZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core +(JNIEnv *, jclass, jlong, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_core + * Signature: (J[J[Z)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core +(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_family_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1family_1offset +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_family_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1family_1offset +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_log + * Signature: (JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log +(JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove_filter + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5P1remove_1filter +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset + * Signature: (JLjava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pset +(JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pexist + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pexist +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_size + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1size +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nprops + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nprops +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1name +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_parent + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1parent +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pisa_class + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pisa_1class +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pequal + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pequal +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy_prop + * Signature: (JJLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pcopy_1prop +(JNIEnv *, jclass, jlong, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Premove +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Punregister + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Punregister +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pclose_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose_1class +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter2 +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nlinks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nlinks +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nlinks + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nlinks +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_libver_bounds + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_libver_bounds + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_copy_object + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1copy_1object +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_copy_object + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1copy_1object +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_create_intermediate_group + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_create_intermediate_group + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_data_transform + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1data_1transform +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_data_transform + * Signature: (J[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1data_1transform +(JNIEnv *, jclass, jlong, jobjectArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_acc_flags + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_acc_flags + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_phase_change + * Signature: (JII)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_nindexes + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_nindexes + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_index + * Signature: (JIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index +(JNIEnv *, jclass, jlong, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_index + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index +(JNIEnv *, jclass, jlong, jint, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_local_heap_size_hint + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_local_heap_size_hint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nbit + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nbit +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_scaleoffset + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_est_link_info + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_est_link_info + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_fapl + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pget_elink_fapl + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_prefix + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_prefix + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix +(JNIEnv *, jclass, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_direct + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct +(JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_direct + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_sec2 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_stdio + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_windows + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[JZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_split + * Signature: (JLjava/lang/String;JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split +(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_meta_block_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_meta_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sieve_buf_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sieve_buf_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size +(JNIEnv *, jclass, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_mdc_config + * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_mdc_config + * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_cache + * Signature: (JJJD)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache +(JNIEnv *, jclass, jlong, jlong, jlong, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_cache + * Signature: (J[J[J[D)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache +(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_obj_track_times + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_obj_track_times + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_char_encoding + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_char_encoding + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual + * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual +(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_count + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_vspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_srcspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_filename + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_dsetname + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_view + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_view + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_printf_gap + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_printf_gap + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_file_space + * Signature: (J[I[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space +(JNIEnv *, jclass, jlong, jintArray, jlongArray); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_space + * Signature: (JIJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1space +(JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class_nocb + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb + (JNIEnv*, jclass, jlong, jstring); +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class + (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2_1nocb + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2 + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2 + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Piterate + * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Piterate + (JNIEnv*, jclass, jlong, jintArray, jobject, jobject); + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5P */ diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c new file mode 100644 index 00000000000..9b19bfbe102 --- /dev/null +++ b/java/src/jni/h5rImp.c @@ -0,0 +1,324 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5rImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate + * Signature: ([BJLjava/lang/String;IJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id) +{ + const char *rName; + herr_t status = -1; + jbyte *refP; + jboolean isCopy2; + + PIN_JAVA_STRING(name, rName, -1); + + if (ref == NULL) { + UNPIN_JAVA_STRING(name, rName); + h5nullArgument( env, "H5Rcreate: ref is NULL"); + } /* end if */ + else { + if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end if */ + else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else if ((ref_type != H5R_OBJECT) && (ref_type != H5R_DATASET_REGION)) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: ref_type unknown type "); + } /* end else if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2); + if (refP == NULL) { + UNPIN_JAVA_STRING(name, rName); + h5JNIFatalError(env, "H5Rcreate: ref not pinned"); + } /* end if */ + else { + status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id); + + UNPIN_JAVA_STRING(name, rName); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Rcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Rdereference + * Signature: (JJI[B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Rdereference(JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refP; + hid_t retVal = -1; + + if (ref == NULL) { + h5nullArgument( env, "H5Rdereference: ref is NULL"); + } /* end if */ + else if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + h5badArgument( env, "H5Rdereference: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end else if */ + else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument( env, "H5Rdereference: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rderefernce: ref not pinned"); + } /* end if */ + else { + retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Rdereference */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_region + * Signature: (JI[B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Rget_1region(JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref) +{ + hid_t retVal = -1; + jboolean isCopy; + jbyte *refP; + + if (ref_type != H5R_DATASET_REGION) { + h5badArgument( env, "H5Rget_region: bad ref_type "); + } /* end if */ + else if (ref == NULL) { + h5nullArgument( env, "H5Rget_region: ref is NULL"); + } /* end if */ + else if ( ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument( env, "H5Rget_region: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_region: ref not pinned"); + } /* end if */ + else { + retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Rget_1region */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5G_obj_t H5Rget_obj_type + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref) +{ + int retVal =-1; + jboolean isCopy; + jbyte *refP; + H5O_type_t object_info; + + + if (ref == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref is NULL"); + } /* end if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); + } /* end if */ + else { + retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, &object_info); + if(retVal >= 0) + retVal = object_info; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: int H5Rget_obj_type2 + * Signature: (JI[B[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj) +{ + + jint status; + jboolean isCopy; + jbyte *refP; + jint *ref_objP; + int retVal = -1; + + + if (ref == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref is NULL"); + } /* end if */ + else if (ref_obj == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref_obj is NULL"); + } /* end else if */ + else { + refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); + } /* end if */ + else { + ref_objP = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ref_obj, &isCopy); + if (ref_objP == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref,refP,0); + h5JNIFatalError(env, "H5Rget_object_type: ref_obj not pinned"); + } /* end if */ + else { + status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, (H5O_type_t*)ref_objP); + retVal = ref_objP[0]; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj,ref_objP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj, ref_objP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_name + * Signature: (JI[B[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size) +{ + jlong ret_val = -1; + jbyte *refP; + jboolean isCopy; + char *aName = NULL; + jstring str; + size_t bs; + + bs = (size_t)size; + if (bs <= 0) { + h5badArgument(env, "H5Rget_name: size <= 0"); + } /* end if */ + else if (ref == NULL) { + h5nullArgument(env, "H5Rget_name: ref is NULL"); + } /* end else if */ + else { + if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + h5badArgument(env, "H5Rget_name: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end if */ + else if ((ref_type == H5R_DATASET_REGION) + && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument(env, "H5Rget_name: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else { + refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_name: ref not pinned"); + } /* end if */ + else { + aName = (char*)HDmalloc(sizeof(char)*bs); + if (aName == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + h5outOfMemory(env, "H5Rget_name: malloc failed"); + } /* end if */ + else { + ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refP, aName, bs) ; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + if (ret_val < 0) { + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str); + + HDfree(aName); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1name */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h new file mode 100644 index 00000000000..2afb3457602 --- /dev/null +++ b/java/src/jni/h5rImp.h @@ -0,0 +1,78 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5R */ + +#ifndef _Included_hdf_hdf5lib_H5_H5R +#define _Included_hdf_hdf5lib_H5_H5R + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate + * Signature: ([BJLjava/lang/String;IJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rcreate + (JNIEnv *, jclass, jbyteArray, jlong, jstring, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Rdereference + * Signature: (JJI[B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rdereference + (JNIEnv *, jclass, jlong, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_region + * Signature: (JI[B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rget_1region + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5G_obj_t H5Rget_obj_type + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: int H5Rget_obj_type2 + * Signature: (JI[B[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 + (JNIEnv *, jclass, jlong, jint, jbyteArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_name + * Signature: (JI[B[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name + (JNIEnv *, jclass, jlong, jint, jbyteArray, jobjectArray, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5R */ diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c new file mode 100644 index 00000000000..2aad3d0d102 --- /dev/null +++ b/java/src/jni/h5sImp.c @@ -0,0 +1,1408 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5sImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Screate(JNIEnv *env, jclass clss, jint type) +{ + hid_t retVal = -1; + + retVal = H5Screate((H5S_class_t) type); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Screate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate_simple + * Signature: (I[J[J)G + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, + jlongArray dims, jlongArray maxdims) +{ + hid_t retVal = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa = NULL; + hsize_t *msa = NULL; + int i; + int drank, mrank; + hsize_t *lp; + jlong *jlp; + + if (rank < 0) { + h5badArgument(env, "H5Screate_simple: rank is invalid"); + } /* end if */ + else if (dims == NULL) { + h5nullArgument(env, "H5Screate_simple: dims is NULL"); + } /* end else if */ + else { + drank = (int)ENVPTR->GetArrayLength(ENVPAR dims); + if (drank != rank) { + h5badArgument(env, "H5Screate_simple: dims rank is invalid"); + return -1; + } /* end if */ + if (maxdims != NULL) { + mrank = (int)ENVPTR->GetArrayLength(ENVPAR maxdims); + if (mrank != rank) { + h5badArgument(env, "H5Screate_simple: maxdims rank is invalid"); + return -1; + } /* end if */ + } /* end if */ + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Screate_simple: dims not pinned"); + return -1; + } /* end if */ + + sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) dimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *)maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Screate_simple: maxdims not pinned"); + return -1; + } /* end if */ + msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *)maxdimsP; + for (i = 0; i < mrank; i++) { + *lp = (hsize_t)*jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa); + + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + if (msa) + HDfree(msa); + } /* end if */ + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + if (sa) + HDfree(sa); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Screate_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Scopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Scopy(JNIEnv *env, jclass clss, jlong space_id) +{ + hid_t retVal = -1; + + retVal = H5Scopy(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* 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.... +/* + * Note: the argument coord is actually long coord[][], which has been + * flattened by the caller. + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coord) +{ + herr_t status = -1; + jint i; + jlong *P; + jboolean isCopy; + hssize_t *sa; + int rank; + + if (coord == NULL) { + h5nullArgument( env, "H5Sselect_elements: coord is NULL"); + return -1; + } /* end if */ + + P = ENVPTR->GetLongArrayElements(ENVPAR env,coord,&isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Sselect_elements: coord not pinned"); + return -1; + } /* end if */ + sa = (hssize_t *)HDmalloc( (size_t)num_elems * 2 * sizeof(hssize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR env,coord,P,JNI_ABORT); + h5JNIFatalError(env, "H5Sselect_elements: coord array not converted to hssize_t"); + return -1; + } /* end if */ + for (i= 0; i < (num_elsms * 2); i++) { + sa[i] = P[i]; + } /* end for */ + + status = H5Sselect_elements (space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR env, coord, P, JNI_ABORT); + HDfree(sa); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */ +#endif + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, + jint num_elemn, jbyteArray coord) +{ + int ii; + hsize_t *lp = NULL; + hsize_t *llp; + jlong *jlp; + herr_t status = -1; + jbyte *P; + jboolean isCopy; + jsize size; + int nlongs; + + if (coord == NULL) { + h5nullArgument(env, "H5Sselect_elements: coord is NULL"); + } /* end if */ + else { + P = ENVPTR->GetByteArrayElements(ENVPAR coord, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Sselect_elements: coord not pinned"); + } /* end if */ + else { + size = (int)ENVPTR->GetArrayLength(ENVPAR coord); + nlongs = (int)((size_t)size / sizeof(jlong)); + lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t)); + jlp = (jlong *) P; + llp = lp; + for (ii = 0; ii < nlongs; ii++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + + status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp); + + ENVPTR->ReleaseByteArrayElements(ENVPAR coord, P, JNI_ABORT); + + if (llp) + HDfree(llp); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_all + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1all(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sselect_all(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1none(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sselect_none(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1valid(JNIEnv *env, jclass clss, jlong space_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sselect_valid(space_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1valid */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints(JNIEnv *env, jclass clss, jlong space_id) +{ + hssize_t retVal = H5Sget_simple_extent_npoints(space_id); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints(JNIEnv *env, jclass clss, jlong space_id) +{ + hssize_t retVal = H5Sget_select_npoints(space_id); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1type(JNIEnv *env, jclass clss, jlong space_id) +{ + int retVal = -1; + + retVal = H5Sget_select_type(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims(JNIEnv *env, jclass clss, jlong space_id) +{ + int retVal = -1; + + retVal = H5Sget_simple_extent_ndims(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_dims + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong space_id, + jlongArray dims, jlongArray maxdims) +{ + int status = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa; + hsize_t *msa; + int i; + int rank = -1; + int mrank; + + if (dims == NULL) { + dimsP = NULL; + sa = (hsize_t *) dimsP; + } /* end if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Pget_simple_extent_dims: dims not pinned"); + return -1; + } /* end if */ + rank = (int)ENVPTR->GetArrayLength(ENVPAR dims); + sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: dims not converted to hsize_t"); + return -1; + } /* end if */ + } /* end else */ + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *) maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + h5JNIFatalError(env, "H5Pget_simple_extent_dims: maxdims not pinned"); + return -1; + } /* end if */ + mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims); + if (rank < 0) + rank = mrank; + else if (mrank != rank) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); + return -1; + } /* end else if */ + msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims not converted to hsize_t"); + return -1; + } /* end if */ + } /* end else */ + + status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa); + + if (status < 0) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(msa); + } /* end if */ + h5libraryError(env); + return -1; + } /* end if */ + + if (dimsP != NULL) { + for (i = 0; i < rank; i++) { + dimsP[i] = (jlong)sa[i]; + } /* end for */ + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + } /* end if */ + if (maxdimsP != NULL) { + for (i = 0; i < rank; i++) { + maxdimsP[i] = (jlong)msa[i]; + } /* end for */ + HDfree(msa); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, 0); + } /* end if */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type(JNIEnv *env, jclass clss, jlong space_id) +{ + H5S_class_t retVal = H5S_NO_CLASS; + + if (space_id < 0) + h5libraryError(env); + + retVal = H5Sget_simple_extent_type(space_id); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_simple + * Signature: (JI[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space_id, + jint rank, jlongArray dims, jlongArray maxdims) +{ + herr_t status = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa; + hsize_t *msa; + int i; + int drank, mrank; + hsize_t *lp; + jlong *jlp; + + if (dims == NULL) { + h5nullArgument(env, "H5Sset_simple_extent: dims is NULL"); + return -1; + } /* end if */ + drank = (int) ENVPTR->GetArrayLength(ENVPAR dims); + if (drank != rank) { + h5badArgument(env, "H5Screate_simple: dims rank is invalid"); + return -1; + } /* end if */ + if (maxdims != NULL) { + mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims); + if (mrank != rank) { + h5badArgument(env, "H5Screate_simple: maxdims rank is invalid"); + return -1; + } /* end if */ + } /* end if */ + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned"); + return -1; + } /* end if */ + sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) dimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *) maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Pset_simple_extent: maxdims not pinned"); + return -1; + } /* end if */ + msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Sset_simple_extent: maxdims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) maxdimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa); + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(msa); + } /* end if */ + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end v */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_simple + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sis_1simple(JNIEnv *env, jclass clss, jlong space_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sis_simple(space_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sis_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Soffset_simple + * Signature: (J[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset) +{ + herr_t status; + jbyte *P = NULL; + jboolean isCopy; + hssize_t *sa; + size_t rank; + size_t i; + hssize_t *lp; + jlong *jlp; + + if (offset != NULL) { + P = ENVPTR->GetByteArrayElements(ENVPAR offset, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Soffset_simple: offset not pinned"); + return -1; + } /* end if */ + i = (size_t)ENVPTR->GetArrayLength(ENVPAR offset); + rank = i / sizeof(jlong); + sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t)); + if (sa == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT); + h5JNIFatalError(env, "H5Soffset_simple: offset not converted to hssize_t"); + return -1; + } /* end if */ + jlp = (jlong *) P; + for (i = 0; i < rank; i++) { + *lp = (hssize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end if */ + else { + P = NULL; + sa = (hssize_t *) P; + } /* end else */ + + status = H5Soffset_simple(space_id, sa); + if (P != NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT); + HDfree(sa); + } /* end if */ + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Soffset_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_copy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sextent_1copy(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +{ + herr_t retVal = -1; + + retVal = H5Sextent_copy(space_id, src_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sextent_1copy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_equal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sextent_1equal(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sextent_equal(space_id, src_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sextent_1equal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sset_1extent_1none(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sset_extent_none(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1none */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_hyperslab + * Signature: (JI[J[J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jint op, + jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +{ + herr_t status = -1; + jlong *startP, *strideP, *countP, *blockP; + jboolean isCopy; + hsize_t *strt; + hsize_t *strd; + hsize_t *cnt; + hsize_t *blk; + int rank; + int i; + hsize_t *lp; + jlong *jlp; + + if (start == NULL) { + h5nullArgument(env, "H5Sselect_hyperslab: start is NULL"); + } /* end if */ + else if (count == NULL) { + h5nullArgument(env, "H5Sselect_hyperslab: count is NULL"); + } /* end if */ + else { + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + if (rank != ENVPTR->GetArrayLength(ENVPAR count)) { + h5badArgument(env, "H5Sselect_hyperslab: count and start have different rank!"); + return -1; + } /* end if */ + + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sselect_hyperslab: start not pinned"); + return -1; + } /* end if */ + strt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sselect_hyperslab: start not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) startP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + + countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy); + if (countP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: count not pinned"); + return -1; + } /* end if */ + cnt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (cnt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: count not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) countP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + if (stride == NULL) { + strideP = NULL; + strd = (hsize_t *) strideP; + } /* end if */ + else { + strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy); + if (strideP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5badArgument(env, "H5Sselect_hyperslab: stride not pinned"); + return -1; + } /* end if */ + strd = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strd == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: stride not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) strideP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + } /* end if */ + if (block == NULL) { + blockP = NULL; + blk = (hsize_t *) blockP; + } /* end if */ + else { + blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy); + if (blockP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + if (strd != NULL) + free(strd); + + h5JNIFatalError(env, "H5Sselect_hyperslab: block not pinned"); + return -1; + } /* end if */ + blk = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (blk == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + if (strd != NULL) + free(strd); + + h5JNIFatalError(env, "H5Sget_simple_extent: block not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) blockP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd, + (const hsize_t *) cnt, (const hsize_t *) blk); + + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + HDfree(cnt); + if (strideP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(strd); + } /* end if */ + if (blockP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(blk); + } /* end if */ + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Sclose(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sclose(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Sclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_nblocks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks(JNIEnv *env, jclass clss, jlong spaceid) +{ + hssize_t retVal = -1; + + retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints(JNIEnv *env, jclass clss, jlong spaceid) +{ + hssize_t retVal = -1; + + retVal = H5Sget_select_elem_npoints((hid_t) spaceid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_blocklist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, + jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf) +{ + herr_t status = -1; + jlong *bufP; + jboolean isCopy; + hsize_t *ba; + int i; + int rank; + hsize_t st; + hsize_t nb; + + st = (hsize_t) startblock; + nb = (hsize_t) numblocks; + + if (buf == NULL) { + h5nullArgument(env, "H5Sget_select_hyper_blocklist: buf is NULL"); + } /* end if */ + else { + rank = H5Sget_simple_extent_ndims(spaceid); + if (rank <= 0) + rank = 1; + if (ENVPTR->GetArrayLength(ENVPAR buf) < (numblocks * rank)) { + h5badArgument(env, "H5Sget_select_hyper_blocklist: buf input array too small"); + } /* end if */ + else { + bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned"); + } /* end if */ + else { + ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); + if (ba == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t"); + } /* end if */ + else { + status = H5Sget_select_hyper_blocklist((hid_t)spaceid, st, nb, (hsize_t *)ba); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + free(ba); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (numblocks * 2 * rank); i++) { + bufP[i] = (jlong)ba[i]; + } /* end for */ + free(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_pointlist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jlong spaceid, + jlong startpoint, jlong numpoints, jlongArray buf) +{ + herr_t status = -1; + jlong *bufP; + jboolean isCopy; + hsize_t *ba; + int i; + int rank; + + if (buf == NULL) { + h5nullArgument(env, "H5Sget_select_elem_pointlist: buf is NULL"); + } /* end if */ + else { + rank = H5Sget_simple_extent_ndims(spaceid); + if (rank <= 0) + rank = 1; + if (ENVPTR->GetArrayLength(ENVPAR buf) < (numpoints * rank)) { + h5badArgument(env, "H5Sget_select_elem_pointlist: buf input array too small"); + } /* end if */ + else { + bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not pinned"); + } /* end if */ + else { + ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)); + if (ba == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not converted to hsize_t"); + } /* end if */ + else { + status = H5Sget_select_elem_pointlist((hid_t) spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba); + + if (status < 0) { + HDfree(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (numpoints * rank); i++) { + bufP[i] = (jlong)ba[i]; + } /* end for */ + HDfree(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end if */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_bounds + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong spaceid, + jlongArray start, jlongArray end) +{ + herr_t status = -1; + jlong *startP, *endP; + jboolean isCopy; + hsize_t *strt; + hsize_t *en; + int rank; + int i; + + if (start == NULL) { + h5nullArgument(env, "H5Sget_select_bounds: start is NULL"); + } /* end if */ + else if (end == NULL) { + h5nullArgument(env, "H5Sget_select_bounds: end is NULL"); + } /* end else if */ + else { + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sget_select_bounds: start not pinned"); + return -1; + } /* end if */ + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t"); + return -1; + } /* end if */ + + endP = ENVPTR->GetLongArrayElements(ENVPAR end, &isCopy); + if (endP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + free(strt); + h5JNIFatalError(env, "H5Sget_select_bounds: end not pinned"); + return -1; + } /* end if */ + en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (en == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_simple_extent: dims not converted to hsize_t"); + return -1; + } /* end if */ + + status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT); + HDfree(strt); + HDfree(en); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + startP[i] = (jlong)strt[i]; + endP[i] = (jlong)en[i]; + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, 0); + HDfree(strt); + HDfree(en); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sencode + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass cls, jlong obj_id) +{ + herr_t status = -1; + unsigned char *bufPtr; + size_t buf_size = 0; + jbyteArray returnedArray = NULL; + + if (obj_id < 0) { + h5badArgument(env, "H5Sencode: invalid argument"); + } /* end if */ + else { + status = H5Sencode(obj_id, NULL, &buf_size); + + if (status < 0) { + h5libraryError(env); + } /* end else if */ + else if (buf_size < 0) { + h5badArgument(env, "H5Sencode: buf_size < 0"); + } /* end if */ + else { + bufPtr = (unsigned char*)HDcalloc((size_t) 1, buf_size); + if (bufPtr == NULL) { + h5outOfMemory(env, "H5Sencode: calloc failed"); + } /* end if */ + else { + status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size); + + if (status < 0) { + HDfree(bufPtr); + h5libraryError(env); + } /* end if */ + else { + returnedArray = ENVPTR->NewByteArray(ENVPAR (jsize)buf_size); + ENVPTR->SetByteArrayRegion(ENVPAR returnedArray, 0, (jsize)buf_size, (jbyte*) bufPtr); + HDfree(bufPtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return returnedArray; +} /* end Java_hdf_hdf5lib_H5_H5Sencode */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sdecode + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sdecode(JNIEnv *env, jclass cls, jbyteArray buf) +{ + hid_t sid = -1; + jbyte *bufP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument(env, "H5Sdecode: buf is NULL"); + } /* end if */ + else { + bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError( env, "H5Sdecode: buf not pinned"); + } /* end if */ + else { + sid = H5Sdecode(bufP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, JNI_ABORT); + + if (sid < 0) + h5libraryError(env); + } /* end else if */ + } /* end else if */ + + return (jlong)sid; +} /* end Java_hdf_hdf5lib_H5_H5Sdecode */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_regular_hyperslab + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab(JNIEnv *env, jclass cls, jlong obj_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sis_regular_hyperslab((hid_t)obj_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_regular_hyperslab + * Signature: (J[J[J[J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, + jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +{ + herr_t status; + jlong *startP, *strideP, *countP, *blockP; + jboolean isCopy; + hsize_t *strt; + hsize_t *strd; + hsize_t *cnt; + hsize_t *blk; + int rank; + int i; + + if (start == NULL) { + h5nullArgument(env, "H5Sget_regular_hyperslab: start is NULL"); + } /* end if */ + else if (count == NULL) { + h5nullArgument(env, "H5Sget_regular_hyperslab: count is NULL"); + } /* end else if */ + else { + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + if (rank != ENVPTR->GetArrayLength(ENVPAR count)) { + h5badArgument(env, "H5Sget_regular_hyperslab: count and start have different rank!"); + return; + } /* end if */ + + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not pinned"); + return; + } /* end if */ + strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not converted to hsize_t"); + return; + } /* end if */ + + countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy); + if (countP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not pinned"); + return; + } /* end if */ + cnt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (cnt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not converted to hsize_t"); + return; + } /* end if */ + + strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy); + if (strideP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5badArgument(env, "H5Sget_regular_hyperslab: stride not pinned"); + return; + } /* end if */ + strd = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strd == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: stride not converted to hsize_t"); + return; + } /* end if */ + + blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy); + if (blockP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + HDfree(strd); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not pinned"); + return; + } /* end if */ + blk = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (blk == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + HDfree(strd); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not converted to hsize_t"); + return; + } /* end if */ + + status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(strt); + HDfree(cnt); + HDfree(strd); + HDfree(blk); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (rank); i++) { + startP[i] = (jlong)strt[i]; + countP[i] = (jlong)cnt[i]; + strideP[i] = (jlong)strd[i]; + blockP[i] = (jlong)blk[i]; + } /* end for */ + HDfree(strt); + HDfree(cnt); + HDfree(strd); + HDfree(blk); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h new file mode 100644 index 00000000000..007b9a723a6 --- /dev/null +++ b/java/src/jni/h5sImp.h @@ -0,0 +1,288 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5S */ + +#ifndef _Included_hdf_hdf5lib_H5_H5S +#define _Included_hdf_hdf5lib_H5_H5S + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate( + JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate_simple + * Signature: (I[J[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate_1simple( + JNIEnv *, jclass, jint, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Scopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL 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.... +/* + * Note: the argument coord is actually long coord[][], which has been + * flattened by the caller. + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements +(JNIEnv *, jclass, jlong, jint, jint, jlongArray); +#endif + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements( + JNIEnv *, jclass, jlong, jint, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_all + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1all( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1none( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1valid( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1type( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_dims + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims( + JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_simple + * Signature: (JI[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple( + JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_simple + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1simple( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Soffset_simple + * Signature: (J[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Soffset_1simple( + JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_copy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1copy( + JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_equal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1equal + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1none( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_hyperslab + * Signature: (JI[J[J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab( + JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Sclose( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_nblocks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_blocklist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist( + JNIEnv *, jclass, jlong, jlong, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_pointlist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist( + JNIEnv *, jclass, jlong, jlong, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_bounds + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds( + JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sencode + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Sencode + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sdecode + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sdecode + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_regular_hyperslab + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_regular_hyperslab + * Signature: (J[J[J[J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab( + JNIEnv *, jclass, jlong, jlongArray, jlongArray, jlongArray, jlongArray); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5S */ diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c new file mode 100644 index 00000000000..83882a09283 --- /dev/null +++ b/java/src/jni/h5tImp.c @@ -0,0 +1,1588 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5tImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Topen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Topen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) +{ + hid_t status; + const char *tName; + + PIN_JAVA_STRING(name, tName, -1); + + status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, tName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Topen2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommitted + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tcommitted(JNIEnv *env, jclass clss, jlong type_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tcommitted(type_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tcommitted */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcreate + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tcreate(JNIEnv *env, jclass clss, jint dclass, jlong size) +{ + hid_t retVal = -1; + + retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tcopy(JNIEnv *env, jclass clss, jlong type_id) +{ + hid_t retVal = -1; + + retVal = H5Tcopy((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tequal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tequal(JNIEnv *env, jclass clss, jlong type_id1, jlong type_id2) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tequal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tlock + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tlock(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tlock((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tlock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1class(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_class_t retVal = H5T_NO_CLASS; + + retVal = H5Tget_class((hid_t)type_id); + if (retVal == H5T_NO_CLASS) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1size(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_size((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1size*/ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1size(JNIEnv *env, jclass clss, jlong type_id, jlong size) +{ + size_t tsize = (size_t)size; + herr_t retVal = -1; + + retVal = H5Tset_size((hid_t)type_id, tsize); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end ifJava_hdf_hdf5lib_H5_H5Tset_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1order(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_order_t retVal = H5T_ORDER_ERROR; + + retVal = H5Tget_order((hid_t)type_id); + if (retVal == H5T_ORDER_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1order(JNIEnv *env, jclass clss, jlong type_id, jint order) +{ + herr_t retVal = -1; + + retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1precision(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_precision((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1precision_1long(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_precision((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_precision + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1precision(JNIEnv *env, jclass clss, jlong type_id, jlong precision) +{ + herr_t retVal = -1; + + retVal = H5Tset_precision((hid_t)type_id, (size_t)precision); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1precision */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_offset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1offset(JNIEnv *env, jclass clss, jlong type_id) +{ + int retVal = -1; + + retVal = H5Tget_offset((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1offset(JNIEnv *env, jclass clss, jlong type_id, jlong offset) +{ + herr_t retVal = -1; + + retVal = H5Tset_offset((hid_t)type_id, (size_t)offset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_pad + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1pad(JNIEnv *env, jclass clss, jlong type_id, jintArray pad) +{ + herr_t status = -1; + jboolean isCopy; + jint *P; + + if (pad == NULL) { + h5nullArgument(env, "H5Tget_pad: pad is NULL"); + } /* end if */ + else { + P = ENVPTR->GetIntArrayElements(ENVPAR pad, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Tget_pad: pad not pinned"); + } /* end if */ + else { + status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1pad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_pad + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1pad(JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb) +{ + herr_t retVal = -1; + + retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1pad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_sign + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1sign(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_sign_t retVal = H5T_SGN_ERROR; + + retVal = H5Tget_sign((hid_t)type_id); + if (retVal == H5T_SGN_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1sign */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_sign + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1sign(JNIEnv *env, jclass clss, jlong type_id, jint sign) +{ + herr_t retVal = -1; + + retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1sign */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields_int + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray fields) +{ + herr_t status; + jboolean isCopy; + jint *P; + + if (fields == NULL) { + h5nullArgument(env, "H5Tget_fields: fields is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) { + h5badArgument(env, "H5Tget_fields: fields input array < order 5"); + } /* end else if */ + else { + P = ENVPTR->GetIntArrayElements(ENVPAR fields, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Tget_fields: fields not pinned"); + } /* end if */ + else { + status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1fields(JNIEnv *env, jclass clss, jlong type_id, jlongArray fields) +{ + herr_t status; + jboolean isCopy; + jlong *fieldsArray; + + if (fields == NULL) { + h5nullArgument(env, "H5Tget_fields: fields is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) { + h5badArgument(env, "H5Tget_fields: fields input array < order 5"); + } /* end else if */ + else { + fieldsArray = ENVPTR->GetLongArrayElements(ENVPAR fields, &isCopy); + if (fieldsArray == NULL) { + h5JNIFatalError(env, "H5Tget_fields: fields not pinned"); + } /* end if */ + else { + { /* direct cast (size_t *)variable fails on 32-bit environment */ + size_t spos_t = 0; + size_t epos_t = 0; + size_t esize_t = 0; + size_t mpos_t = 0; + size_t msize_t = 0; + long long fields_temp = *(&fieldsArray[0]); + spos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[1]); + epos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[2]); + esize_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[3]); + mpos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[4]); + msize_t = (size_t)fields_temp; + + status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t); + + *(&fieldsArray[0]) = (jlong)spos_t; + *(&fieldsArray[1]) = (jlong)epos_t; + *(&fieldsArray[2]) = (jlong)esize_t; + *(&fieldsArray[3]) = (jlong)mpos_t; + *(&fieldsArray[4]) = (jlong)msize_t; + } /* end direct cast special handling */ + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_fields + * Signature: (JJJJJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1fields(JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos, + jlong esize, jlong mpos, jlong msize) +{ + if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos, (size_t)msize) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Tset_1fields */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1ebias(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_ebias((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_ebias((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_ebias + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1ebias(JNIEnv *env, jclass clss, jlong type_id, jlong ebias) +{ + herr_t retVal = -1; + + retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1ebias */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_norm + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1norm(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_norm_t retVal = H5T_NORM_ERROR; + + retVal = H5Tget_norm((hid_t)type_id); + if (retVal == H5T_NORM_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1norm */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_norm + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1norm(JNIEnv *env, jclass clss, jlong type_id, jint norm) +{ + herr_t retVal = -1; + + retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1norm */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_inpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1inpad(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_pad_t retVal = H5T_PAD_ERROR; + + retVal = H5Tget_inpad((hid_t)type_id ); + if (retVal == H5T_PAD_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1inpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_inpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1inpad(JNIEnv *env, jclass clss, jlong type_id, jint inpad) +{ + herr_t retVal = -1; + + retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1inpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_cset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1cset(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_cset_t retVal = H5T_CSET_ERROR; + + retVal = H5Tget_cset((hid_t)type_id); + if (retVal == H5T_CSET_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1cset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_cset + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1cset(JNIEnv *env, jclass clss, jlong type_id, jint cset) +{ + herr_t retVal = -1; + + retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1cset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_strpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1strpad(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_str_t retVal = H5T_STR_ERROR; + + retVal = H5Tget_strpad((hid_t)type_id); + if (retVal == H5T_STR_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1strpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_strpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1strpad(JNIEnv *env, jclass clss, jlong type_id, jint strpad) +{ + herr_t retVal = -1; + + retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1strpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_nmembers + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1nmembers(JNIEnv *env, jclass clss, jlong type_id) +{ + int retVal = -1; + + retVal = H5Tget_nmembers((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1nmembers */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_name + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1name(JNIEnv *env, jclass clss, jlong type_id, jint field_idx) +{ + char *name; + jstring str = NULL; + + name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx); + if (name != NULL) { + str = ENVPTR->NewStringUTF(ENVPAR name); + H5free_memory(name); + + if (str == NULL) + h5JNIFatalError(env, "H5Tget_member_name: returned string not created"); + } /* end if */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_index + * Signature: (JLjava/lang/String)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1index(JNIEnv *env, jclass clss, jlong type_id, jstring field_name) +{ + const char *tName; + int index = -1; + + PIN_JAVA_STRING(field_name, tName, -1); + + index = H5Tget_member_index((hid_t)type_id, tName); + + UNPIN_JAVA_STRING(field_name, tName); + + if (index < 0) + h5libraryError(env); + + return (jint)index; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_type + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1member_1type(JNIEnv *env, jclass clss, jlong type_id, jint field_idx) +{ + hid_t retVal = -1; + + retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1member_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_offset + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1offset(JNIEnv *env, jclass clss, jlong type_id, jint memno) +{ + return (jlong)H5Tget_member_offset((hid_t)type_id, (unsigned)memno); +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_class + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1class(JNIEnv *env, jclass clss, jlong type_id, jint memno) +{ + int retVal = -1; + + retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tinsert + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tinsert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset, jlong field_id) +{ + herr_t status; + const char *tName; + long off = (long)offset; + + PIN_JAVA_STRING(name, tName, -1); + + status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id); + + UNPIN_JAVA_STRING(name,tName); + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tinsert */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tpack + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tpack(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tpack((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tpack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Tclose(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tclose((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tvlen_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tvlen_1create(JNIEnv *env, jclass clss, jlong base_id) +{ + hid_t retVal = -1; + + retVal = H5Tvlen_create((hid_t)base_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tvlen_1create */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_tag + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1tag(JNIEnv *env, jclass clss, jlong type, jstring tag) +{ + herr_t status = -1; + const char *tagP; + + PIN_JAVA_STRING(tag, tagP, -1); + + status = H5Tset_tag((hid_t)type, tagP); + + UNPIN_JAVA_STRING(tag,tagP); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1tag */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_tag + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1tag(JNIEnv *env, jclass clss, jlong type) +{ + jstring str = NULL; + char *tag; + + tag = H5Tget_tag((hid_t)type); + if (tag != NULL) { + str = ENVPTR->NewStringUTF(ENVPAR tag); + H5free_memory(tag); + + if (str == NULL) + h5JNIFatalError(env, "H5Tget_tag: returned string not created"); + } /* end if */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1tag */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_super + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1super(JNIEnv *env, jclass clss, jlong type_id) +{ + hid_t retVal = -1; + + retVal = H5Tget_super((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1super */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tenum_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tenum_1create(JNIEnv *env, jclass clss, jlong base_id) +{ + hid_t retVal = -1; + + retVal = H5Tenum_create((hid_t)base_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tenum_1create */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value) +{ + herr_t status = -1; + jint *intP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL ) { + h5nullArgument(env, "H5Tenum_insert: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, nameP, -1); + + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2); + if (intP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_insert: value not pinned"); + return -1; + } /* end if */ + else { + status = H5Tenum_insert((hid_t)type_id, nameP, intP); + + UNPIN_JAVA_STRING(name, nameP); + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1insert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_insert: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING0(name, nameP); + + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2); + if (byteP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_insert: value not pinned"); + } /* end if */ + else { + status = H5Tenum_insert((hid_t)type_id, nameP, byteP); + + UNPIN_JAVA_STRING(name, nameP); + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof_int + * Signature: (J[I[Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray value, jobjectArray name, + jint size) +{ + herr_t status = -1; + jint *intP; + char *nameP; + jboolean isCopy; + jstring str; + + if (size <= 0) { + h5badArgument(env, "H5Tenum_nameof: name size < 0"); + } /* end if */ + else if (value == NULL) { + h5nullArgument(env, "H5Tenum_nameof: value is NULL"); + } /* end if */ + else { + nameP = (char*)HDmalloc(sizeof(char) * (size_t)size); + if (nameP == NULL) { + /* exception -- out of memory */ + h5outOfMemory(env, "H5Tenum_nameof: malloc name size"); + } /* end if */ + else { + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy); + if (intP == NULL) { + HDfree(nameP); + h5JNIFatalError(env, "H5Tenum_nameof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size); + + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + + if (status < 0) { + HDfree(nameP); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR nameP); + HDfree(nameP); + if (str == NULL) { + h5JNIFatalError(env, "H5Tenum_nameof: return array not created"); + } /* end if */ + else + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof + * Signature: (J[BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1nameof(JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size) +{ + herr_t status = -1; + jbyte *byteP; + char *nameP; + jboolean isCopy; + jstring str = NULL; + + if (size <= 0) { + h5badArgument(env, "H5Tenum_nameof: name size < 0"); + } /* end if */ + else if (value == NULL ) { + h5nullArgument(env, "H5Tenum_nameof: value is NULL"); + } /* end if */ + else { + nameP = (char*)HDmalloc(sizeof(char) * (size_t)size); + if (nameP == NULL) { + h5outOfMemory(env, "H5Tenum_nameof: malloc name size"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + HDfree(nameP); + h5JNIFatalError(env, "H5Tenum_nameof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size); + + /* free the buffer without copying back */ + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) { + HDfree(nameP); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR nameP); + HDfree(nameP); + if (str == NULL) { + h5JNIFatalError(env, "H5Tenum_nameof: return array not created"); + } /* end if */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value) +{ + herr_t status = -1; + jint *intP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_valueof: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, nameP, -1); + + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2); + if (intP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_valueof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_valueof((hid_t)type_id, nameP, intP); + + UNPIN_JAVA_STRING(name, nameP); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1valueof(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_valueof: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING0(name, nameP); + + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2); + if (byteP == NULL) { + UNPIN_JAVA_STRING(name,nameP); + h5JNIFatalError(env, "H5Tenum_valueof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_valueof((hid_t)type_id, nameP, byteP); + + UNPIN_JAVA_STRING(name, nameP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value_int + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int(JNIEnv *env, jclass clss, jlong type_id, jint membno, jintArray value) +{ + herr_t status = -1; + jint *intP; + jboolean isCopy; + + if (value == NULL) { + h5nullArgument(env, "H5Tget_member_value: value is NULL"); + } /* end if */ + else { + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy); + if (intP == NULL) { + h5JNIFatalError(env, "H5Tget_member_value: value not pinned"); + } /* end if */ + else { + status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP); + + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value + * Signature: (JI[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1value(JNIEnv *env, jclass clss, jlong type_id, jint membno, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value == NULL) { + h5nullArgument( env, "H5Tget_member_value: value is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value,&isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Tget_member_value: value not pinned"); + } /* end if */ + else { + status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims(JNIEnv *env, jclass clss, jlong type_id) +{ + int ndims = -1; + + ndims = H5Tget_array_ndims((hid_t)type_id); + if (ndims < 0) + h5libraryError(env); + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tarray_get_dims + * Signature: (J[I[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *env, jclass clss, jlong type_id, jintArray dims, jintArray perms) +{ + int ndims = -1; + int dlen; + int i; + jint *dimsP; + hsize_t *cdims = NULL; + jboolean isCopy; + + if (dims == NULL) { + h5nullArgument( env, "H5Tget_array_dims: value is NULL"); + } /* end if */ + else { + dimsP = ENVPTR->GetIntArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + + ndims = H5Tget_array_dims2((hid_t)type_id, cdims); + + if (ndims < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < dlen; i++) { + dimsP[i] = (jint) cdims[i]; + } /* end for */ + ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, 0); + + if (cdims) HDfree(cdims); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tis_variable_str + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tis_1variable_1str(JNIEnv *env, jclass clss, jlong type_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tis_variable_str((hid_t)type_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tis_1variable_1str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_native_type + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *env, jclass clss, jlong type_id, jint direction) +{ + hid_t native_tid = -1; + + native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction); + + if (native_tid < 0) + h5libraryError(env); + + return (jint)native_tid; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1native_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tdetect_class + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tdetect_1class(JNIEnv *env, jclass clss, jlong type_id, jint dtype_class) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tdetect_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommit + * Signature: (JLjava/lang/String;JJJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tcommit(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type, + jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + herr_t status = -1; + const char *tName; + + PIN_JAVA_STRING0(name, tName); + + status = H5Tcommit2((hid_t)loc_id, tName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id); + + UNPIN_JAVA_STRING(name, tName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Tcommit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tarray_create2 + * Signature: (JI[J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims) +{ + hid_t retVal = -1; + jlong *dimsP; + int dlen; + hsize_t *cdims = NULL; + jboolean isCopy; + int i; + + if (rank <= 0) { + h5badArgument(env, "H5Tarray_create: rank is < 1"); + } /* end if */ + else if (dims == NULL) { + h5nullArgument(env, "H5Tarray_create: dims is NULL"); + } /* end else if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError( env, "H5Tarray_create: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + if (dlen != rank) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + } /* end if */ + else { + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + for (i = 0; i < dlen; i++) { + cdims[i] = (hsize_t)dimsP[i]; + } /* end for */ + + retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t*)cdims); + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + + HDfree(cdims); + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tarray_1create2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tarray_get_dims2 + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *env, jclass clss, jlong type_id, jlongArray dims) +{ + int ndims = -1; + int dlen; + int i; + jlong *dimsP; + hsize_t *cdims=NULL; + jboolean isCopy; + + if (dims == NULL) { + h5nullArgument(env, "H5Tget_array_dims: value is NULL"); + } /* end if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims,&isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + + ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims); + + if (ndims < 0) { + if (cdims) + free(cdims); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < dlen; i++) { + dimsP[i] = (jlong) cdims[i]; + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + + if (cdims) + HDfree(cdims); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tconvert + * Signature: (JJJ[B[BJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tconvert(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts, + jbyteArray buf, jbyteArray background, jlong plist_id) +{ + herr_t status; + jbyte *bufP; + jbyte *bgP = NULL; + jboolean isCopy; + + if (nelmts <= 0) { + h5badArgument(env, "H5Tconvert: name nelmts < 0"); + } /* end if */ + else { + bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Tconvert: value not pinned"); + } /* end if */ + else { + if (background) + bgP = ENVPTR->GetByteArrayElements(ENVPAR background, &isCopy); + + status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id) ; + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, 0); + + if (bgP) + ENVPTR->ReleaseByteArrayElements(ENVPAR background, bgP, 0); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tconvert */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h new file mode 100644 index 00000000000..f9e6985bef2 --- /dev/null +++ b/java/src/jni/h5tImp.h @@ -0,0 +1,550 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5T */ + +#ifndef _Included_hdf_hdf5lib_H5_H5T +#define _Included_hdf_hdf5lib_H5_H5T + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Topen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Topen2 + (JNIEnv *, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommitted + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tcommitted + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcreate + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcreate + (JNIEnv *, jclass, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcopy + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tequal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tequal + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tlock + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tlock + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1class + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1size + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1size + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1order + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1order + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision_1long + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_precision + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1precision + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_offset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1offset + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1offset + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_pad + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1pad + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_pad + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1pad + (JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_sign + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1sign + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_sign + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1sign + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields_int + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields_1int + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_fields + * Signature: (JJJJJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tset_1fields + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_ebias + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1ebias + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_norm + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1norm + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_norm + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1norm + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_inpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1inpad + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_inpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1inpad + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_cset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1cset + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_cset + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1cset + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_strpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1strpad + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_strpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1strpad + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_nmembers + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1nmembers + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_name + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1name + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_index + * Signature: (JLjava/lang/String)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1index + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_type + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1member_1type + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_offset + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1offset + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_class + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1class + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tinsert + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tinsert + (JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tpack + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tpack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tclose + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tvlen_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tvlen_1create + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_tag + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1tag + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_tag + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1tag + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_super + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1super + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tenum_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tenum_1create + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int + (JNIEnv *, jclass, jlong, jstring, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert + (JNIEnv *, jclass, jlong, jstring, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof_int + * Signature: (J[I[Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int + (JNIEnv *, jclass, jlong, jintArray, jobjectArray, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof + * Signature: (J[BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int + (JNIEnv *, jclass, jlong, jstring, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof + (JNIEnv *, jclass, jlong, jstring, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value_int + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int + (JNIEnv *, jclass, jlong, jint, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value + * Signature: (JI[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims + * Signature: (J[I[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims + (JNIEnv *, jclass, jlong, jintArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tis_variable_str + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tis_1variable_1str + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_native_type + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tdetect_class + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tdetect_1class + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommit + * Signature: (JLjava/lang/String;JJJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tcommit + (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tarray_create2 + * Signature: (JI[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tarray_1create2 + (JNIEnv *, jclass, jlong, jint, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims2 + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tconvert + * Signature: (JJJ[B[BJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tconvert + (JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray, jbyteArray, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5T */ diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c new file mode 100644 index 00000000000..90c8ad21d06 --- /dev/null +++ b/java/src/jni/h5util.c @@ -0,0 +1,2592 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" + +/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ +hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ +int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ + +JavaVM *jvm; +jobject visit_callback; +jobject copy_callback; +jobject close_callback; +jobject create_callback; +jobject compare_callback; +jobject get_callback; +jobject set_callback; +jobject delete_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static int h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_obj); +static int h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_obj); +static int h5str_is_zero(const void *_mem, size_t size); +static hid_t h5str_get_native_type(hid_t type); +static hid_t h5str_get_little_endian_type(hid_t type); +static hid_t h5str_get_big_endian_type(hid_t type); +static htri_t h5str_detect_vlen(hid_t tid); +static htri_t h5str_detect_vlen_str(hid_t tid); +static int h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts); +static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts); +static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); +static int render_bin_output_region_blocks(FILE *stream, hid_t region_space, + hid_t region_id, hid_t container); +static int render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); +static int render_bin_output_region_points(FILE *stream, hid_t region_space, + hid_t region_id, hid_t container); + +/** frees memory held by array of strings */ +void +h5str_array_free(char **strs, size_t len) { + size_t i; + + if (!strs || len <= 0) + return; + + for (i = 0; i < len; i++) { + if (*(strs + i)) + HDfree(*(strs + i)); + } /* for (i=0; i 0) { + str->s = (char *)HDmalloc(len); + str->max = len; + str->s[0] = '\0'; + } /* end if */ +} /* end h5str_new */ + +/** free string memory */ +void +h5str_free(h5str_t *str) { + if (str && str->max > 0) { + HDfree(str->s); + HDmemset(str, 0, sizeof(h5str_t)); + } /* end if */ +} /* end h5str_free */ + +/** reset the max size of the string */ +void +h5str_resize(h5str_t *str, size_t new_len) { + char *new_str; + + if (!str || new_len <= 0 || str->max == new_len) + return; + + new_str = (char *)HDmalloc(new_len); + if (new_len > str->max) /* increase memory */ + HDstrcpy(new_str, str->s); + else + HDstrncpy(new_str, str->s, new_len - 1); + + HDfree(str->s); + str->s = new_str; + str->max = new_len; +} /* end h5str_resize */ + +/* appends a copy of the string pointed to by cstr to the h5str. + Return Value: + the char string point to str->s + */ +char* +h5str_append(h5str_t *str, const char* cstr) { + size_t len; + + if (!str) + return NULL; + else if (!cstr) + return str->s; + + len = HDstrlen(str->s) + HDstrlen(cstr); + while (len >= str->max) /* not enough to hold the new string, double the space */ + { + h5str_resize(str, str->max * 2); + } + + return HDstrcat(str->s, cstr); +} /* end h5str_append */ + +/** print value of a data point into string. + Return Value: + On success, the total number of characters printed is returned. + On error, a negative number is returned. + */ +size_t +h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *ptr, int expand_data) { + unsigned char tmp_uchar = 0; + char tmp_char = 0; + unsigned short tmp_ushort = 0; + short tmp_short = 0; + unsigned int tmp_uint = 0; + int tmp_int = 0; + unsigned long tmp_ulong = 0; + long tmp_long = 0; + unsigned long long tmp_ullong = 0; + long long tmp_llong = 0; + float tmp_float = 0.0; + double tmp_double = 0.0; + long double tmp_ldouble = 0.0; + static char fmt_llong[8], fmt_ullong[8]; + + hid_t mtid = -1; + size_t offset; + size_t nll; + char *this_str; + size_t this_strlen; + int n; + int len; + hvl_t *vlptr; + char *cptr = (char*) ptr; + unsigned char *ucptr = (unsigned char*) ptr; + H5T_class_t tclass = H5Tget_class(tid); + size_t size = H5Tget_size(tid); + H5T_sign_t nsign = H5Tget_sign(tid); + int bdata_print = 0; + + if (!str || !ptr) + return 0; + + /* Build default formats for long long types */ + if (!fmt_llong[0]) { + sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); + sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); + } /* end if */ + + this_str = NULL; + this_strlen = 0; + + switch (tclass) { + case H5T_FLOAT: + if (sizeof(float) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */ + HDmemcpy(&tmp_float, ptr, sizeof(float)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, "%g", tmp_float); + } + else if (sizeof(double) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */ + HDmemcpy(&tmp_double, ptr, sizeof(double)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, "%g", tmp_double); + } +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if (sizeof(long double) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */ + HDmemcpy(&tmp_ldouble, ptr, sizeof(long double)); + this_str = (char*)HDmalloc(27); + sprintf(this_str, "%Lf", tmp_ldouble); + } +#endif + break; + case H5T_STRING: + { + char *tmp_str; + size = 0; + + if (H5Tis_variable_str(tid)) { + tmp_str = *(char**) ptr; + if (tmp_str != NULL) + size = HDstrlen(tmp_str); + } + else { + tmp_str = cptr; + } + + /* Check for NULL pointer for string */ + if (tmp_str == NULL) { + this_str = (char *)HDmalloc(5); + HDstrncpy(this_str, "NULL", 4); + } + else { + if (size > 0) { + this_str = (char *)HDmalloc(size+1); + HDstrncpy(this_str, tmp_str, size); + } + } + } + break; + case H5T_INTEGER: + if (sizeof(char) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */ + HDmemcpy(&tmp_uchar, ptr, sizeof(unsigned char)); + this_str = (char*)HDmalloc(7); + sprintf(this_str, "%u", tmp_uchar); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */ + HDmemcpy(&tmp_char, ptr, sizeof(char)); + this_str = (char*)HDmalloc(7); + sprintf(this_str, "%hhd", tmp_char); + } + } + else if (sizeof(int) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_UINT)) */ + HDmemcpy(&tmp_uint, ptr, sizeof(unsigned int)); + this_str = (char*)HDmalloc(14); + sprintf(this_str, "%u", tmp_uint); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_INT)) */ + HDmemcpy(&tmp_int, ptr, sizeof(int)); + this_str = (char*)HDmalloc(14); + sprintf(this_str, "%d", tmp_int); + } + } + else if (sizeof(short) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */ + HDmemcpy(&tmp_ushort, ptr, sizeof(unsigned short)); + this_str = (char*)HDmalloc(9); + sprintf(this_str, "%u", tmp_ushort); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */ + HDmemcpy(&tmp_short, ptr, sizeof(short)); + this_str = (char*)HDmalloc(9); + sprintf(this_str, "%d", tmp_short); + } + } + else if (sizeof(long) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */ + HDmemcpy(&tmp_ulong, ptr, sizeof(unsigned long)); + this_str = (char*)HDmalloc(23); + sprintf(this_str, "%lu", tmp_ulong); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_LONG)) */ + HDmemcpy(&tmp_long, ptr, sizeof(long)); + this_str = (char*)HDmalloc(23); + sprintf(this_str, "%ld", tmp_long); + } + } + else if (sizeof(long long) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */ + HDmemcpy(&tmp_ullong, ptr, sizeof(unsigned long long)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, fmt_ullong, tmp_ullong); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */ + HDmemcpy(&tmp_llong, ptr, sizeof(long long)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, fmt_llong, tmp_llong); + } + } + break; + case H5T_COMPOUND: + { + unsigned i; + n = H5Tget_nmembers(tid); + h5str_append(str, " {"); + + for (i = 0; i < n; i++) { + offset = H5Tget_member_offset(tid, i); + mtid = H5Tget_member_type(tid, i); + h5str_sprintf(str, container, mtid, cptr + offset, expand_data); + if (i < n - 1) + h5str_append(str, ", "); + H5Tclose(mtid); + } + h5str_append(str, "} "); + } + break; + case H5T_ENUM: + { + char enum_name[1024]; + if (H5Tenum_nameof(tid, ptr, enum_name, sizeof enum_name) >= 0) { + h5str_append(str, enum_name); + } + else { + size_t i; + nll = H5Tget_size(tid); + this_str = (char*)HDmalloc(4 * (nll + 1)); + + if (1 == nll) { + sprintf(this_str, "0x%02x", ucptr[0]); + } + else { + for (i = 0; i < (int)nll; i++) + sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]); + } + } + } + break; + case H5T_REFERENCE: + if (h5str_is_zero(ptr, size)) { + h5str_append(str, "NULL"); + } + else { + if (H5R_DSET_REG_REF_BUF_SIZE == size) { + /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */ + /* + * Dataset region reference -- + * show the type and the referenced object + */ + char ref_name[1024]; + hid_t region_obj; + hid_t region; + H5S_sel_type region_type; + + /* get name of the dataset the region reference points to using H5Rget_name */ + region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, ptr); + if (region_obj >= 0) { + region = H5Rget_region(container, H5R_DATASET_REGION, ptr); + if (region >= 0) { + if(expand_data) { + region_type = H5Sget_select_type(region); + if(region_type==H5S_SEL_POINTS) { + h5str_dump_region_points_data(str, region, region_obj); + } + else { + h5str_dump_region_blocks_data(str, region, region_obj); + } + } + else { + if(H5Rget_name(region_obj, H5R_DATASET_REGION, ptr, (char*)ref_name, 1024) >= 0) { + h5str_append(str, ref_name); + } + + region_type = H5Sget_select_type(region); + + if(region_type==H5S_SEL_POINTS) { + h5str_append(str, " REGION_TYPE POINT"); + h5str_dump_region_points(str, region, region_obj); + } + else { + h5str_append(str, " REGION_TYPE BLOCK"); + h5str_dump_region_blocks(str, region, region_obj); + } + } + + H5Sclose(region); + } + H5Dclose(region_obj); + } + } + else if (H5R_OBJ_REF_BUF_SIZE == size) { + /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */ + /* + * Object references -- show the type and OID of the referenced + * object. + */ + H5O_info_t oi; + hid_t obj; + + this_str = (char*)HDmalloc(64); + obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, ptr); + H5Oget_info(obj, &oi); + + /* Print object data and close object */ + sprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr); + H5Oclose(obj); + } + } + break; + case H5T_ARRAY: + { + int rank = 0; + hsize_t i, dims[H5S_MAX_RANK], total_elmts; + h5str_append(str, "[ "); + + mtid = H5Tget_super(tid); + size = H5Tget_size(mtid); + rank = H5Tget_array_ndims(tid); + + H5Tget_array_dims2(tid, dims); + + total_elmts = 1; + for (i = 0; i < rank; i++) + total_elmts *= dims[i]; + + for (i = 0; i < total_elmts; i++) { + h5str_sprintf(str, container, mtid, cptr + i * size, expand_data); + if (i < total_elmts - 1) + h5str_append(str, ", "); + } + H5Tclose(mtid); + h5str_append(str, "] "); + } + break; + case H5T_VLEN: + { + unsigned int i; + mtid = H5Tget_super(tid); + size = H5Tget_size(mtid); + + vlptr = (hvl_t *) cptr; + + nll = vlptr->len; + for (i = 0; i < (int)nll; i++) { + h5str_sprintf(str, container, mtid, ((char *) (vlptr->p)) + i * size, expand_data); + if (i < (int)nll - 1) + h5str_append(str, ", "); + } + H5Tclose(mtid); + } + break; + + default: + { + /* All other types get printed as hexadecimal */ + size_t i; + nll = H5Tget_size(tid); + this_str = (char*)HDmalloc(4 * (nll + 1)); + + if (1 == nll) { + sprintf(this_str, "0x%02x", ucptr[0]); + } + else { + for (i = 0; i < (int)nll; i++) + sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]); + } + } + break; + } /* end switch */ + + if (this_str) { + h5str_append(str, this_str); + this_strlen = HDstrlen(str->s); + HDfree(this_str); + } /* end if */ + + return this_strlen; +} /* end h5str_sprintf */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + *------------------------------------------------------------------------- + */ +static int +h5str_print_region_data_blocks(hid_t region_id, + h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t blkndx; + hsize_t total_size[H5S_MAX_RANK]; + unsigned int region_flags; /* buffer extent flags */ + hsize_t numelem; + hsize_t numindex; + size_t jndx; + unsigned indx; + size_t type_size; + int ret_value = SUCCEED; + hid_t mem_space = -1; + hid_t sid1 = -1; + void *region_buf = NULL; + + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) >= 0) { + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } /* end for */ + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) { + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) { + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + for (blkndx = 0; blkndx < nblocks; blkndx++) { + for (indx = 0; indx < ndims; indx++) { + start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2]; + count[indx] = dims1[indx]; + } /* end for */ + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) { + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + for (numindex = 0; numindex < numelem; numindex++) { + h5str_sprintf(str, region_id, type_id, ((char*)region_buf + numindex * type_size), 1); + + if (numindex + 1 < numelem) + h5str_append(str, ", "); + } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */ + } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */ + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + HDfree(count); + } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + HDfree(start); + } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */ + else + ret_value = -1; + + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + if(H5Sclose(sid1) < 0) + ret_value = -1; + } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_print_region_data_blocks */ + +int +h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata; + hid_t dtype = -1; + hid_t type_id = -1; + char tmp_str[256]; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have blocks. + */ + H5E_BEGIN_TRY { + nblocks = H5Sget_select_hyper_nblocks(region); + } H5E_END_TRY; + + /* Print block information */ + if (nblocks > 0) { + int i; + + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_hyper_blocklist(region, (hsize_t) 0, + (hsize_t) nblocks, ptdata); + + + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + + h5str_print_region_data_blocks(region_id, str, ndims, type_id, nblocks, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + HDfree(ptdata); + } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ + } /* if (nblocks > 0) */ + + return ret_value; +} /* end h5str_dump_region_blocks_data */ + +static int +h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata; + hid_t dtype = -1; + hid_t type_id = -1; + char tmp_str[256]; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have blocks. + */ + H5E_BEGIN_TRY { + nblocks = H5Sget_select_hyper_nblocks(region); + } H5E_END_TRY; + + /* Print block information */ + if (nblocks > 0) { + int i; + + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_hyper_blocklist(region, (hsize_t) 0, + (hsize_t) nblocks, ptdata); + + h5str_append(str, " {"); + for (i = 0; i < nblocks; i++) { + int j; + + h5str_append(str, " "); + + /* Start coordinates and opposite corner */ + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : "(", + (unsigned long) ptdata[i * 2 * ndims + j]); + h5str_append(str, tmp_str); + } + + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : ")-(", + (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + h5str_append(str, tmp_str); + } + h5str_append(str, ") "); + tmp_str[0] = '\0'; + } + h5str_append(str, " }"); + + HDfree(ptdata); + } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ + } /* if (nblocks > 0) */ + + return ret_value; +} /* end h5str_dump_region_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + *------------------------------------------------------------------------- + */ +static int +h5str_print_region_data_points(hid_t region_space, hid_t region_id, + h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t total_size[H5S_MAX_RANK]; + size_t jndx; + unsigned indx; + size_t type_size; + int ret_value = SUCCEED; + unsigned int region_flags; /* buffer extent flags */ + hid_t mem_space = -1; + void *region_buf = NULL; + char tmp_str[256]; + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + + dims1[0] = (hsize_t)npoints; + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) { + + if((type_size = H5Tget_size(type_id)) > 0) { + + if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) { + + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) { + + for (jndx = 0; jndx < npoints; jndx++) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + + h5str_sprintf(str, region_id, type_id, ((char*)region_buf + jndx * type_size), 1); + + if (jndx + 1 < npoints) + h5str_append(str, ", "); + + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ + } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */ + else + ret_value = -1; + + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */ + else + ret_value = -1; + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_print_region_data_points */ + +int +h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + char tmp_str[256]; + hid_t dtype = -1; + hid_t type_id = -1; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have points. + */ + H5E_BEGIN_TRY { + npoints = H5Sget_select_elem_npoints(region); + } H5E_END_TRY; + + /* Print point information */ + if (npoints > 0) { + int i; + + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_elem_pointlist(region, (hsize_t) 0, + (hsize_t) npoints, ptdata); + + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + + h5str_print_region_data_points(region, region_id, + str, ndims, type_id, npoints, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + HDfree(ptdata); + } + } + + return ret_value; +} /* end h5str_dump_region_points_data */ + +static int +h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + char tmp_str[256]; + hid_t dtype = -1; + hid_t type_id = -1; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have points. + */ + H5E_BEGIN_TRY { + npoints = H5Sget_select_elem_npoints(region); + } H5E_END_TRY; + + /* Print point information */ + if (npoints > 0) { + int i; + + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_elem_pointlist(region, (hsize_t) 0, + (hsize_t) npoints, ptdata); + + h5str_append(str, " {"); + for (i = 0; i < npoints; i++) { + int j; + + h5str_append(str, " "); + + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : "(", + (unsigned long) (ptdata[i * ndims + j])); + h5str_append(str, tmp_str); + } /* end for (j = 0; j < ndims; j++) */ + + h5str_append(str, ") "); + } /* end for (i = 0; i < npoints; i++) */ + h5str_append(str, " }"); + + HDfree(ptdata); + } /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */ + } /* end if (npoints > 0) */ + + return ret_value; +} /* end h5str_dump_region_points */ + +static int +h5str_is_zero(const void *_mem, size_t size) { + const unsigned char *mem = (const unsigned char *) _mem; + + while (size-- > 0) + if (mem[size]) + return 0; + + return 1; +} /* end h5str_is_zero */ + +/*------------------------------------------------------------------------- + * Function: h5str_detect_vlen_str + * + * Purpose: Recursive check for variable length string of a datatype. + * + * Return: + * TRUE : type conatains any variable length string + * FALSE : type doesn't contain any variable length string + * Negative value: error occur + * + *------------------------------------------------------------------------- + */ +static htri_t +h5str_detect_vlen_str(hid_t tid) +{ + H5T_class_t tclass = H5T_NO_CLASS; + htri_t ret = 0; + + ret = H5Tis_variable_str(tid); + if((ret == 1) || (ret < 0)) + goto done; + + tclass = H5Tget_class(tid); + if(tclass == H5T_ARRAY || tclass == H5T_VLEN) { + hid_t btid = H5Tget_super(tid); + + if(btid < 0) { + ret = (htri_t)btid; + goto done; + } /* end if */ + ret = h5str_detect_vlen_str(btid); + if((ret == 1) || (ret < 0)) { + H5Tclose(btid); + goto done; + } /* end if */ + } /* end if */ + else if(tclass == H5T_COMPOUND) { + unsigned i = 0; + int n = H5Tget_nmembers(tid); + + if(n < 0) { + n = ret; + goto done; + } /* end if */ + + for(i = 0; i < n; i++) { + hid_t mtid = H5Tget_member_type(tid, i); + + ret = h5str_detect_vlen_str(mtid); + if((ret == 1) || (ret < 0)) { + H5Tclose(mtid); + goto done; + } + H5Tclose(mtid); + } /* end for */ + } /* end else */ + +done: + return ret; +} /* end h5str_detect_vlen_str */ + +/*------------------------------------------------------------------------- + * Function: h5str_get_native_type + * + * Purpose: Wrapper around H5Tget_native_type() to work around + * Problems with bitfields. + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_native_type(hid_t type) +{ + hid_t p_type; + H5T_class_t type_class; + + type_class = H5Tget_class(type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(type); + else + p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + + return(p_type); +} /* end h5str_get_native_type */ + + +/*------------------------------------------------------------------------- + * Function: h5str_get_little_endian_type + * + * Purpose: Get a little endian type from a file type + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_little_endian_type(hid_t tid) +{ + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8LE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16LE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32LE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64LE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8LE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16LE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32LE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64LE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32LE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64LE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + return(p_type); +} /* end h5str_get_little_endian_type */ + +/*------------------------------------------------------------------------- + * Function: h5str_get_big_endian_type + * + * Purpose: Get a big endian type from a file type + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_big_endian_type(hid_t tid) +{ + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8BE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16BE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32BE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64BE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8BE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16BE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32BE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64BE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32BE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64BE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + return(p_type); +} /* end h5str_get_big_endian_type */ + +/*------------------------------------------------------------------------- + * Function: h5str_detect_vlen + * + * Purpose: Recursive check for any variable length data in given type. + * + * Return: + * 1 : type conatains any variable length data + * 0 : type doesn't contain any variable length data + * Negative value: error occur + *------------------------------------------------------------------------- + */ +static htri_t +h5str_detect_vlen(hid_t tid) +{ + htri_t ret; + + /* recursive detect any vlen data values in type (compound, array ...) */ + ret = H5Tdetect_class(tid, H5T_VLEN); + if((ret == 1) || (ret < 0)) + goto done; + + /* recursive detect any vlen string in type (compound, array ...) */ + ret = h5str_detect_vlen_str(tid); + if((ret == 1) || (ret < 0)) + goto done; + +done: + return ret; +} /* end h5str_detect_vlen */ + +/*------------------------------------------------------------------------- + * Function: render_bin_output + * + * Purpose: Write one element of memory buffer to a binary file stream + * + * Return: Success: SUCCEED + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static int +h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts) +{ + int ret_value = 0; + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + hsize_t block_index; + H5T_class_t type_class; + + if((size = H5Tget_size(tid)) > 0) { + + if((type_class = H5Tget_class(tid)) >= 0) { + + switch (type_class) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_ENUM: + block_index = block_nelmts * size; + while(block_index > 0) { + size_t bytes_in = 0; /* # of bytes to write */ + size_t bytes_wrote = 0; /* # of bytes written */ + size_t item_size = size; /* size of items in bytes */ + + if(block_index > sizeof(size_t)) + bytes_in = sizeof(size_t); + else + bytes_in = (size_t)block_index; + + bytes_wrote = fwrite(mem, 1, bytes_in, stream); + + if(bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) { + ret_value = -1; + break; + } + + block_index -= (hsize_t)bytes_wrote; + mem = mem + bytes_wrote; + } + break; + case H5T_STRING: + { + unsigned int i; + H5T_str_t pad; + char *s; + unsigned char tempuchar; + + pad = H5Tget_strpad(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + + if (H5Tis_variable_str(tid)) { + s = *(char**) mem; + if (s != NULL) + size = strlen(s); + } + else { + s = (char *) mem; + } + for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { + HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); + if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) { + ret_value = -1; + break; + } + } /* i */ + if(ret_value < 0) + break; + } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ + } + break; + case H5T_COMPOUND: + { + unsigned j; + hid_t memb; + unsigned nmembs; + size_t offset; + + nmembs = (unsigned)H5Tget_nmembers(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + for (j = 0; j < nmembs; j++) { + offset = H5Tget_member_offset(tid, j); + memb = H5Tget_member_type(tid, j); + + if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) { + H5Tclose(memb); + ret_value = -1; + break; + } + + H5Tclose(memb); + } + if(ret_value < 0) + break; + } + } + break; + case H5T_ARRAY: + { + int k, ndims; + hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hid_t memb; + + /* get the array's base datatype for each element */ + memb = H5Tget_super(tid); + ndims = H5Tget_array_ndims(tid); + H5Tget_array_dims2(tid, dims); + + /* calculate the number of array elements */ + for (k = 0, nelmts = 1; k < ndims; k++) { + temp_nelmts = nelmts; + temp_nelmts *= dims[k]; + nelmts = (size_t) temp_nelmts; + } + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* dump the array element */ + if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) { + ret_value = -1; + break; + } + } + H5Tclose(memb); + } + break; + case H5T_VLEN: + { + unsigned int i; + hsize_t nelmts; + hid_t memb; + + /* get the VL sequences's base datatype for each element */ + memb = H5Tget_super(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* Get the number of sequence elements */ + nelmts = ((hvl_t *) mem)->len; + + /* dump the array element */ + if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + ret_value = -1; + break; + } + } + H5Tclose(memb); + } + break; + case H5T_REFERENCE: + { + if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + /* region data */ + hid_t region_id, region_space; + H5S_sel_type region_type; + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem); + if (region_id >= 0) { + region_space = H5Rget_region(container, H5R_DATASET_REGION, mem); + if (region_space >= 0) { + 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); + } /* end if (region_id >= 0) */ + if(ret_value < 0) + break; + } + } + else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { + ; + } + } + break; + default: + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + if (size != fwrite(mem, sizeof(char), size, stream)) { + ret_value = -1; + break; + } + } + break; + } + } /* end if((type_class = H5Tget_class(tid)) >= 0) */ + else + ret_value = -1; + } /* end if((size = H5Tget_size(tid)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_render_bin_output */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t numelem; + hsize_t numindex; + hsize_t total_size[H5S_MAX_RANK]; + int jndx; + size_t type_size; + hid_t mem_space = -1; + void *region_buf = NULL; + int blkndx; + hid_t sid1 = -1; + int ret_value = SUCCEED; + + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) >= 0) { + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) { + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) { + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + for (blkndx = 0; blkndx < nblocks; blkndx++) { + for (jndx = 0; jndx < ndims; jndx++) { + start[jndx] = ptdata[jndx + blkndx * ndims * 2]; + count[jndx] = dims1[jndx]; + } + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) { + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, numelem); + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + else { + ret_value = -1; + break; + } + } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */ + else { + ret_value = -1; + break; + } + } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */ + else { + ret_value = -1; + break; + } + /* Render the region data element end */ + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + HDfree(count); + } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(start); + } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */ + else + ret_value = -1; + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + if(H5Sclose(sid1) < 0) + ret_value = -1; + } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_data_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print some values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to dump a region reference using blocks. + * + * Return: + * The function returns False if ERROR, otherwise True + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_blocks(FILE *stream, hid_t region_space, hid_t region_id, hid_t container) +{ + int ret_value = SUCCEED; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata = NULL; + int ndims; + hid_t dtype; + hid_t type_id; + + if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) { + /* Print block information */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) { + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if((ptdata = (hsize_t*)HDmalloc((size_t)alloc_size)) != NULL) { + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) >= 0) { + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + ret_value = render_bin_output_region_data_blocks(stream, region_id, container, ndims, + type_id, nblocks, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + } /* end if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) >= 0) */ + else + ret_value = -1; + + HDfree(ptdata); + } /* end if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) != NULL) */ + else + ret_value = -1; + } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */ + else + ret_value = -1; + } /* end if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + int jndx; + size_t type_size; + hid_t mem_space = -1; + void *region_buf = NULL; + int ret_value = SUCCEED; + + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) { + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + dims1[0] = (hsize_t)npoints; + if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) { + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) { + ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, (hsize_t)npoints); + } /* end if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) */ + else + ret_value = -1; + } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */ + else + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */ + else + ret_value = -1; + + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(region_buf); + } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_data_points */ + +/*------------------------------------------------------------------------- + * Purpose: Print some values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to dump a region reference using points. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container) +{ + int ret_value = SUCCEED; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + int ndims; + hid_t dtype; + hid_t type_id; + + if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) { + /* Allocate space for the dimension array */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) { + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) { + if(H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) >= 0) { + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + ret_value = render_bin_output_region_data_points(stream, region_space, region_id, + container, ndims, type_id, npoints, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + } /* end if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) >= 0) */ + else + ret_value = -1; + + HDfree(ptdata); + } /* end if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) */ + else + ret_value = -1; + } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */ + else + ret_value = -1; + + } /* end if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_points */ + +int +h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order) +{ + int ret_value = SUCCEED; + hid_t f_space = -1; /* file data space */ + hsize_t elmtno; /* counter */ + size_t i; /* counter */ + int ndims; + int carry; /* counter carry value */ + hsize_t zero[8]; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + + /* Print info */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t p_nelmts; /* total selected elmts */ + + /* Stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space = -1; /* stripmine data space */ + + /* Hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts; /* elements in request */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + hid_t p_type = -1; + hid_t f_type = -1; + + if(dset < 0) return -1; + f_type = H5Dget_type(dset); + if (binary_order == 1) + p_type = h5str_get_native_type(f_type); + else if (binary_order == 2) + p_type = h5str_get_little_endian_type(f_type); + else if (binary_order == 3) + p_type = h5str_get_big_endian_type(f_type); + else + p_type = H5Tcopy(f_type); + + H5Tclose(f_type); + + if (p_type >= 0) { + if((f_space = H5Dget_space(dset)) >= 0) { + ndims = H5Sget_simple_extent_ndims(f_space); + + if ((size_t)ndims <= (sizeof(sm_size)/sizeof(sm_size[0]))) { + H5Sget_simple_extent_dims(f_space, total_size, NULL); + + /* calculate the number of elements we're going to print */ + p_nelmts = 1; + + if (ndims > 0) { + for (i = 0; i < ndims; i++) + p_nelmts *= total_size[i]; + } /* end if */ + + if (p_nelmts > 0) { + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(p_type) != 0) + vl_data = 1; + + /* + * Determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes = H5Tget_size(p_type); + + if (ndims > 0) { + for (i = (size_t)ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size)); + sm_nbytes *= sm_size[i - 1]; + } + } + + if(sm_nbytes > 0) { + sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + /* The stripmine loop */ + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { + /* Calculate the hyperslab size */ + if (ndims > 0) { + for (i = 0, hs_nelmts = 1; i < ndims; i++) { + hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i])); + hs_nelmts *= hs_size[i]; + } + + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); + } + else { + H5Sselect_all(f_space); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } + + /* Read the data */ + if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) { + + if (binary_order == 99) + ret_value = h5tools_dump_simple_data(stream, dset, p_type, sm_buf, hs_nelmts); + else + ret_value = h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + } + else { + ret_value = -1; + break; + } + + if(ret_value < 0) break; + + /* Calculate the next hyperslab offset */ + for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) { + hs_offset[i - 1] += hs_size[i - 1]; + + if (hs_offset[i - 1] == total_size[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } + } + + if(sm_buf) + HDfree(sm_buf); + } + if(sm_space >= 0 && H5Sclose(sm_space) < 0) + ret_value = -1; + } + } + if(f_space >= 0 && H5Sclose(f_space) < 0) + ret_value = -1; + } /* end if((f_space = H5Dget_space(dset)) >= 0) */ + else + ret_value = -1; + + if (p_type >= 0) + H5Tclose(p_type); + } + return ret_value; +} /* end h5str_dump_simple_dset */ + +static int +h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) +{ + int ret_value = 0; + int line_count; + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + H5T_class_t type_class; + hsize_t i; /*element counter */ + h5str_t buffer; /*string into which to render */ + + if((size = H5Tget_size(type)) > 0) { + for (i = 0, line_count = 0; i < nelmts; i++, line_count++) { + size_t bytes_in = 0; /* # of bytes to write */ + size_t bytes_wrote = 0; /* # of bytes written */ + void* memref = mem + i * size; + + /* Render the data element*/ + h5str_new(&buffer, 32 * size); + bytes_in = h5str_sprintf(&buffer, container, type, memref, 1); + if(i > 0) { + HDfprintf(stream, ", "); + if (line_count >= H5TOOLS_TEXT_BLOCK) { + line_count = 0; + HDfprintf(stream, "\n"); + } + } + HDfprintf(stream, "%s", buffer.s); + h5str_free(&buffer); + } /* end for (i = 0; i < nelmts... */ + HDfprintf(stream, "\n"); + } /* end if((size = H5Tget_size(tid)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5tools_dump_simple_data */ + +/* + * Utility Java APIs + * Functions designed to workaround issues with the Java-C interface + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AwriteVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + char **wdata; + jsize size; + jint i; + + size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + + wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*)); + if (!wdata) { + h5JNIFatalError(env, "H5AwriteVL: cannot allocate buffer"); + } /* end if */ + else { + HDmemset(wdata, 0, (size_t)size * sizeof(char*)); + for (i = 0; i < size; ++i) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + wdata[i] = (char*)HDmalloc((size_t)length + 1); + if (wdata[i]) { + HDmemset(wdata[i], 0, ((size_t)length + 1)); + HDstrncpy(wdata[i], utf8, (size_t)length); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for (i = 0; i < size; ++i) */ + + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, wdata); + + for (i = 0; i < size; i++) { + if(wdata[i]) { + HDfree(wdata[i]); + } /* end if */ + } /* end for */ + HDfree(wdata); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5AwriteVL */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AreadVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + jstring jstr; + char **strs; + int i, n; + hid_t sid; + hsize_t dims[H5S_MAX_RANK]; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + + strs =(char **)HDmalloc((size_t)n * sizeof(char *)); + if (strs == NULL) { + h5JNIFatalError( env, "H5AreadVL: failed to allocate buff for read variable length strings"); + } /* end if */ + else { + status = H5Aread(attr_id, mem_type_id, strs); + if (status < 0) { + dims[0] = (hsize_t)n; + sid = H5Screate_simple(1, dims, NULL); + H5Dvlen_reclaim(mem_type_id, sid, H5P_DEFAULT, strs); + H5Sclose(sid); + HDfree(strs); + h5JNIFatalError(env, "H5AreadVL: failed to read variable length strings"); + } /* end if */ + else { + for (i=0; iNewStringUTF(ENVPAR strs[i]); + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + HDfree (strs[i]); + } /* end for */ + + /* + for repeatedly reading an attribute with a large number of strs (e.g., 1,000,000 strings, + H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + free space in time. Instead, use "free(strs[i])" to free individual strings + after it is done. + H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs); + */ + + HDfree(strs); + } /* end else */ + } /* end else */ + return status; +} /* end Java_hdf_hdf5lib_H5_H5AreadVL */ + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Acopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id) +{ + jbyte *buf; + herr_t retVal = -1; + hid_t src_did = (hid_t)src_id; + hid_t dst_did = (hid_t)dst_id; + hid_t tid = -1; + hid_t sid = -1; + hsize_t total_size = 0; + + + sid = H5Aget_space(src_did); + if (sid < 0) { + h5libraryError(env); + } /* end if */ + else { + tid = H5Aget_type(src_did); + if (tid < 0) { + H5Sclose(sid); + h5libraryError(env); + } /* end if */ + else { + total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid); + + H5Sclose(sid); + + buf = (jbyte *)HDmalloc( (size_t)total_size * sizeof(jbyte)); + if (buf == NULL) { + H5Tclose(tid); + h5outOfMemory( env, "H5Acopy: malloc failed"); + } /* end if */ + else { + retVal = H5Aread(src_did, tid, buf); + H5Tclose(tid); + + if (retVal < 0) { + HDfree(buf); + h5libraryError(env); + } /* end if */ + else { + tid = H5Aget_type(dst_did); + if (tid < 0) { + HDfree(buf); + h5libraryError(env); + } /* end if */ + else { + retVal = H5Awrite(dst_did, tid, buf); + + H5Tclose(tid); + HDfree(buf); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Acopy */ + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Dcopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id) +{ + jbyte *buf; + herr_t retVal = -1; + hid_t src_did = (hid_t)src_id; + hid_t dst_did = (hid_t)dst_id; + hid_t tid = -1; + hid_t sid = -1; + hsize_t total_size = 0, total_allocated_size; + + total_allocated_size = H5Dget_storage_size(src_did); + if (total_allocated_size <=0) + return 0; // nothing to write; + + sid = H5Dget_space(src_did); + if (sid < 0) { + h5libraryError(env); + return -1; + } /* end if */ + + tid = H5Dget_type(src_did); + if (tid < 0) { + H5Sclose(sid); + h5libraryError(env); + return -1; + } /* end if */ + + total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid); + + H5Sclose(sid); + + buf = (jbyte*)HDmalloc((size_t)total_size * sizeof(jbyte)); + if (buf == NULL) { + H5Tclose(tid); + h5outOfMemory(env, "H5Dcopy: malloc failed"); + return -1; + } /* end if */ + + retVal = H5Dread(src_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Tclose(tid); + + if (retVal < 0) { + HDfree(buf); + h5libraryError(env); + return (jint)retVal; + } /* end if */ + + tid = H5Dget_type(dst_did); + if (tid < 0) { + HDfree(buf); + h5libraryError(env); + return -1; + } /* end if */ + retVal = H5Dwrite(dst_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Tclose(tid); + HDfree(buf); + + if (retVal < 0) { + h5libraryError(env); + } /* end if */ + + return (jint)retVal; +} /* 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 object 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); + herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); + int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); +#else + static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + static int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); + static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); +#endif + +typedef struct info_all +{ + char **objname; + int *otype; + int *ltype; + unsigned long *objno; + unsigned long *fno; + unsigned long idxnum; + int count; +} info_all_t; + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_full + * Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *env, jclass clss, jlong loc_id, jstring group_name, + jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo, + jlongArray oRef, jint n, jint indx_type, jint indx_order) +{ + herr_t ret_val = -1; + const char *gName = NULL; + char **oName = NULL; + jboolean isCopy; + jstring str; + jint *otarr; + jint *ltarr; + jlong *refP; + jlong *fnoP; + unsigned long *refs=NULL; + unsigned long *fnos=NULL; + hid_t gid = (hid_t)loc_id; + int i; + int indexType = indx_type; + int indexOrder = indx_order; + + if (oType == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: oType is NULL"); + } + else if (lType == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: lType is NULL"); + } + else if (oRef == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: oRef is NULL"); + } + else if (fNo == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: fNo is NULL"); + } + else { + otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy); + if (otarr == NULL) { + h5JNIFatalError(env, "H5Gget_obj_info_full: otype not pinned"); + return -1; + } /* end if */ + ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy); + if (ltarr == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: ltype not pinned"); + return -1; + } /* end if */ + refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy); + if (refP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: oRef not pinned"); + return -1; + } /* end if */ + fnoP = ENVPTR->GetLongArrayElements(ENVPAR fNo, &isCopy); + if (fnoP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: fNo not pinned"); + return -1; + } /* end if */ + oName = (char **)HDcalloc((size_t)n, sizeof(*oName)); + if (!oName) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: oName not allocated"); + return -1; + } /* end if */ + + refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + if (!refs || !fnos) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + if (refs) + HDfree(refs); + if (fnos) + HDfree(fnos); + h5JNIFatalError(env, "H5Gget_obj_info_full: result arrays not allocated"); + return -1; + } /* end if */ + + if (group_name != NULL) { + gid = -1; + gName = ENVPTR->GetStringUTFChars(ENVPAR group_name, &isCopy); + if (gName != NULL) { + gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT); + + ENVPTR->ReleaseStringUTFChars(ENVPAR group_name, gName); + } /* end if */ + if(gid < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + HDfree(fnos); + h5JNIFatalError(env, "H5Gget_obj_info_full: could not get group identifier"); + return -1; + } /* end if */ + } /* end if */ + + ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder); + + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0); + + if (group_name != NULL) + H5Gclose(gid); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + HDfree(fnos); + h5libraryError(env); + } /* end if */ + else { + for (i=0; iReleaseLongArrayElements(ENVPAR oRef, refP, 0); + + for (i=0; iReleaseLongArrayElements(ENVPAR fNo, fnoP, 0); + + for (i=0; iNewStringUTF(ENVPAR *(oName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str); + } /* end if */ + } /* for (i=0; iGetIntArrayElements(ENVPAR oType, &isCopy); + if (otarr == NULL) { + h5JNIFatalError(env, "H5Gget_obj_info_max: otype not pinned"); + return -1; + } /* end if */ + + ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy); + if (ltarr == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: ltype not pinned"); + return -1; + } /* end if */ + + refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy); + if (refP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: oRef not pinned"); + return -1; + } /* end if */ + + oName = (char **)HDcalloc((size_t)n, sizeof(*oName)); + if (!oName) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: oName not allocated"); + return -1; + } /* end if */ + refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + if (!refs) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + h5JNIFatalError(env, "H5Gget_obj_info_max: result array not allocated"); + return -1; + } /* end if */ + + ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int*)otarr, (int*)ltarr, refs, maxnum ); + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + h5libraryError(env); + } /* end if */ + else { + for (i=0; iReleaseLongArrayElements(ENVPAR oRef, refP, 0); + + for (i=0; iNewStringUTF(ENVPAR *(oName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str); + } + } /* for (i=0; iotype+datainfo->count) = -1; + *(datainfo->ltype+datainfo->count) = -1; + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1); + HDstrcpy(*(datainfo->objname+datainfo->count), name); + *(datainfo->objno+datainfo->count) = (unsigned long)-1; + } /* end if */ + else { + *(datainfo->otype+datainfo->count) = object_info.type; + *(datainfo->ltype+datainfo->count) = info->type; + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); + HDstrcpy(*(datainfo->objname+datainfo->count), name); + + *(datainfo->fno+datainfo->count) = object_info.fileno; + *(datainfo->objno+datainfo->count) = (unsigned long)object_info.addr; + /* + if(info->type==H5L_TYPE_HARD) + *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address; + else + *(datainfo->objno+datainfo->count) = info->u.val_size; + */ + } /* end else */ + + datainfo->count++; + + return 0; +} /* end obj_info_all */ + +herr_t +obj_info_max(hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data) +{ + int type = -1; + herr_t retVal = 0; + info_all_t *datainfo = (info_all_t*)op_data; + H5O_info_t object_info; + + retVal = H5Oget_info(loc_id, &object_info); + if (retVal < 0) { + *(datainfo->otype+datainfo->count) = -1; + *(datainfo->ltype+datainfo->count) = -1; + *(datainfo->objname+datainfo->count) = NULL; + *(datainfo->objno+datainfo->count) = (unsigned long)-1; + return 1; + } /* end if */ + else { + *(datainfo->otype+datainfo->count) = object_info.type; + *(datainfo->ltype+datainfo->count) = info->type; + /* this will be freed by h5str_array_free(oName, n)*/ + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); + strcpy(*(datainfo->objname+datainfo->count), name); + if(info->type==H5L_TYPE_HARD) + *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address; + else + *(datainfo->objno+datainfo->count) = info->u.val_size; + } /* end else */ + datainfo->count++; + if(datainfo->count < (int)datainfo->idxnum) + return 0; + else + return 1; +} /* end obj_info_max */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_dataset + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) +{ + herr_t status = -1; + herr_t ret_val = -1; + hid_t file_id = -1; + hid_t dataset_id = -1; + FILE *stream; + const char *file_export; + const char *object_name; + const char *fileName; + jboolean isCopy2; + + if (file_export_name == NULL) { + h5nullArgument(env, "HDF5Library_export_data: file_export_name is NULL"); + } /* end if */ + else if (object_path == NULL) { + h5nullArgument(env, "HDF5Library_export_data: object_path is NULL"); + } /* end else if */ + else { + PIN_JAVA_STRING0(file_name, fileName); + + file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT); + + UNPIN_JAVA_STRING(file_name, fileName); + + if (file_id < 0) { + /* throw exception */ + h5libraryError(env); + } /* end if */ + else { + object_name = ENVPTR->GetStringUTFChars(ENVPAR object_path, &isCopy2); + if (object_name == NULL) { + h5JNIFatalError( env, "H5Dopen: object name not pinned"); + } /* end if */ + else { + dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT); + + ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name); + + if (dataset_id < 0) { + H5Fclose(file_id); + h5libraryError(env); + } /* end if */ + else { + file_export = ENVPTR->GetStringUTFChars(ENVPAR file_export_name, 0); + stream = HDfopen(file_export, "w+"); + ENVPTR->ReleaseStringUTFChars(ENVPAR file_export_name, file_export); + + ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order); + + if (stream) + HDfclose(stream); + + H5Dclose(dataset_id); + + H5Fclose(file_id); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */ + +#ifdef __cplusplus +} +#endif diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h new file mode 100644 index 00000000000..fcf343d8797 --- /dev/null +++ b/java/src/jni/h5util.h @@ -0,0 +1,108 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifndef H5UTIL_H__ +#define H5UTIL_H__ + +#include "h5jni.h" + +#ifndef SUCCEED +#define SUCCEED 0 +#endif + +#ifndef FAIL +#define FAIL (-1) +#endif + +typedef struct h5str_t { + char *s; + size_t max; /* the allocated size of the string */ +} h5str_t; + +extern void h5str_new (h5str_t *str, size_t len); +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_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int expand_data); +extern void h5str_array_free(char **strs, size_t len); +extern int h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order); +extern int h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_obj); +extern int h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_obj); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AwriteVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AwriteVL + (JNIEnv *, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AreadVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL + (JNIEnv *, jclass, jlong, jlong, jobjectArray); + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Acopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Acopy + (JNIEnv *, jclass, jlong, jlong); + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Dcopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dcopy + (JNIEnv*, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_full + * Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full + (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jlongArray, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_max + * Signature: (J[Ljava/lang/String;[I[I[JJI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max + (JNIEnv*, jclass, jlong, jobjectArray, jintArray, jintArray, jlongArray, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_dataset + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset + (JNIEnv*, jclass, jstring, jstring, jstring, jint); + +#endif /* H5UTIL_H__ */ diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c new file mode 100644 index 00000000000..a60854ddb4a --- /dev/null +++ b/java/src/jni/h5zImp.c @@ -0,0 +1,84 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5zImp.h" + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zunregister + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zunregister(JNIEnv *env, jclass clss, jint filter) +{ + herr_t retValue = H5Zunregister((H5Z_filter_t)filter); + + if (retValue < 0) + h5libraryError(env); + + return (jint)retValue; +} /* end Java_hdf_hdf5lib_H5_H5Zunregister */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zfilter_avail + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zfilter_1avail(JNIEnv *env, jclass clss, jint filter) +{ + herr_t retValue = H5Zfilter_avail((H5Z_filter_t)filter); + + if (retValue < 0) + h5libraryError(env); + + return (jint)retValue; +} /* end Java_hdf_hdf5lib_H5_H5Zfilter_1avail */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zget_filter_info + * Signature: (I)I + */ + +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *env, jclass clss, jint filter) +{ + unsigned int flags = 0; + + if (H5Zget_filter_info ((H5Z_filter_t) filter, (unsigned *) &flags) < 0) + h5libraryError(env); + + return (jint)flags; +} /* end Java_hdf_hdf5lib_H5_H5Zget_1filter_1info */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h new file mode 100644 index 00000000000..de0d6e6ef81 --- /dev/null +++ b/java/src/jni/h5zImp.h @@ -0,0 +1,55 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5Z */ + +#ifndef _Included_hdf_hdf5lib_H5_H5Z +#define _Included_hdf_hdf5lib_H5_H5Z + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zunregister + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zunregister + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zfilter_avail + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zfilter_1avail + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zget_filter_info + * Signature: (I)I + */ + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zget_1filter_1info + (JNIEnv *, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5Z */ diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c new file mode 100644 index 00000000000..da86e097873 --- /dev/null +++ b/java/src/jni/nativeData.c @@ -0,0 +1,1195 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ +/* + * This module contains the implementation of all the native methods + * used for number conversion. This is represented by the Java + * class HDFNativeData. + * + * These routines convert one dimensional arrays of bytes into + * one-D arrays of other types (int, float, etc) and vice versa. + * + * These routines are called from the Java parts of the Java-C + * interface. + * + * ***Important notes: + * + * 1. These routines are designed to be portable--they use the + * C compiler to do the required native data manipulation. + * 2. These routines copy the data at least once -- a serious + * but unavoidable performance hit. + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "nativeData.h" + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jintArray rarray = NULL; + int blen; + jint *iarray; + jboolean bb; + char *bp; + jint *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToInt: bdata is NULL?"); + } /* end if */ + else { + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToInt: pin failed"); + } /* end if */ + else { + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jint); + rarray = ENVPTR->NewIntArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToInt" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: pin iarray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jint *)bp; + iap++; + bp += sizeof(jint); + } /* end for */ + + ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0); + } /* end else */ + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + } /* end else */ + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B */ + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jfloatArray rarray; + int blen; + jfloat *farray; + jboolean bb; + char *bp; + jfloat *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToFloat: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToFloat: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jfloat); + rarray = ENVPTR->NewFloatArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToFloat" ); + return NULL; + } /* end if */ + farray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb); + if (farray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToFloat: pin farray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = farray; + for (ii = 0; ii < len; ii++) { + *iap = *(jfloat *)bp; + iap++; + bp += sizeof(jfloat); + } /* end for */ + + ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,farray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */ + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jshortArray rarray; + int blen; + jshort *sarray; + jboolean bb; + char *bp; + jshort *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToShort: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToShort: pin failed"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jshort); + rarray = ENVPTR->NewShortArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToShort" ); + return NULL; + } /* end if */ + + sarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb); + if (sarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToShort: pin sarray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = sarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jshort *)bp; + iap++; + bp += sizeof(jshort); + } /* end for */ + + ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,sarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B */ + + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jlongArray rarray; + int blen; + jlong *larray; + jboolean bb; + char *bp; + jlong *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToLong: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToLong: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jlong); + rarray = ENVPTR->NewLongArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToLong" ); + return NULL; + } /* end if */ + + larray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb); + if (larray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToLong: pin larray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = larray; + for (ii = 0; ii < len; ii++) { + *iap = *(jlong *)bp; + iap++; + bp += sizeof(jlong); + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,larray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B */ + + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jdoubleArray rarray; + int blen; + jdouble *darray; + jboolean bb; + char *bp; + jdouble *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToDouble: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToDouble: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jdouble); + rarray = ENVPTR->NewDoubleArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToDouble" ); + return NULL; + } /* end if */ + + darray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb); + if (darray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToDouble: pin darray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = darray; + for (ii = 0; ii < len; ii++) { + *iap = *(jdouble *)bp; + iap++; + bp += sizeof(jdouble); + } /* end for */ + + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,darray,0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B */ + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jintArray rarray; + int blen; + jint *iarray; + jint *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToInt: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToInt: pin failed"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jint))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: getLen failed"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewIntArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToInt" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: pin iarray failed"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jint *)bp; + iap++; + bp += sizeof(jint); + } /* end for */ + + ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B */ + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jshortArray rarray; + int blen; + jshort *iarray; + jshort *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToShort: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToShort: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jshort))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToShort: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewShortArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToShort" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToShort: getShort failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jshort *)bp; + iap++; + bp += sizeof(jshort); + } /* end for */ + + ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B */ + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jfloatArray rarray; + int blen; + jfloat *iarray; + jfloat *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToFloat: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToFloat: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jfloat))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToFloat: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewFloatArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToFloat" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToFloat: getFloat failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jfloat *)bp; + iap++; + bp += sizeof(jfloat); + } /* end for */ + + ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */ + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jlongArray rarray; + int blen; + jlong *iarray; + jlong *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToLong: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToLong: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jlong))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToLong: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewLongArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToLong" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToLong: getLong failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + + *iap = *(jlong *)bp; + iap++; + bp += sizeof(jlong); + } /* end for */ + + ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */ + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jdoubleArray rarray; + int blen; + jdouble *iarray; + jdouble *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToDouble: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToDouble: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jdouble))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToDouble: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewDoubleArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToDouble" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToDouble: getDouble failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jdouble *)bp; + iap++; + bp += sizeof(jdouble); + } /* end for */ + + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I(JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */ +{ + jint *ip; + jint *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + int ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "intToByte: idata is NULL?"); + return NULL; + } /* end if */ + + iarr = ENVPTR->GetIntArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "intToByte: getInt failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "intToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jint); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "intToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "intToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jint); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S(JNIEnv *env, jclass clss, jint start, jint len, jshortArray idata) /* IN: array of short */ +{ + jshort *ip; + jshort *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + short ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "shortToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetShortArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "shortToByte: getShort failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "shortToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jshort); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "shortToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "shortToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jshort); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F(JNIEnv *env, jclass clss, jint start, jint len, jfloatArray idata) /* IN: array of float */ +{ + jfloat *ip; + jfloat *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + float ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "floatToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetFloatArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "floatToByte: getFloat failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "floatToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jfloat); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "floatToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "floatToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jfloat); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D(JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray idata) /* IN: array of double */ +{ + jdouble *ip; + jdouble *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + double ival; + char bytes[8]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "doubleToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetDoubleArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "doubleToByte: getDouble failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "doubleToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jdouble); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "doubleToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "doubleToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jdouble); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J(JNIEnv *env, jclass clss, jint start, jint len, jlongArray idata) /* IN: array of long */ +{ + jlong *ip; + jlong *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + jlong ival; + char bytes[8]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "longToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetLongArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "longToByte: getLong failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "longToByte: start or len is out of bounds?\n"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jlong); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "longToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "longToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jlong); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_intToByte__I(JNIEnv *env, jclass clss, jint idata) /* IN: int */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + int ij; + jboolean bb; + union things { + int ival; + char bytes[sizeof(int)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jint)); + if (rarray == NULL) { + h5outOfMemory( env, "intToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "intToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jint); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__I */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_floatToByte__F(JNIEnv *env, jclass clss, jfloat idata) /* IN: int */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + float ival; + char bytes[sizeof(float)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jfloat)); + if (rarray == NULL) { + h5outOfMemory( env, "floatToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "floatToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jfloat); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__F */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_shortToByte__S(JNIEnv *env, jclass clss, jshort idata) /* IN: short */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + short ival; + char bytes[sizeof(short)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jshort)); + if (rarray == NULL) { + h5outOfMemory( env, "shortToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "shortToByte: getShort failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jshort); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__S */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D(JNIEnv *env, jclass clss, jdouble idata) /* IN: double */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + double ival; + char bytes[sizeof(double)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jdouble)); + if (rarray == NULL) { + h5outOfMemory( env, "doubleToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "doubleToByte: getDouble failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jdouble); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_longToByte__J(JNIEnv *env, jclass clss, jlong idata) /* IN: array of long */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + jlong ival; + char bytes[sizeof(jlong)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jlong)); + if (rarray == NULL) { + h5outOfMemory( env, "longToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "longToByte: getLong failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jlong); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__J */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv *env, jclass clss, jbyte idata) /* IN: array of long */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + jbyte ival; + char bytes[sizeof(jbyte)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jbyte)); + if (rarray == NULL) { + h5outOfMemory( env, "byteToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "byteToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jbyte); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToByte__B */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h new file mode 100644 index 00000000000..1af06b43014 --- /dev/null +++ b/java/src/jni/nativeData.h @@ -0,0 +1,115 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_HDFNativeData */ + +#ifndef _Included_hdf_hdf5lib_HDFNativeData +#define _Included_hdf_hdf5lib_HDFNativeData + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns int [] */ +JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I +(JNIEnv *, jclass, jint, jint, jintArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S +(JNIEnv *, jclass, jint, jint, jshortArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F +(JNIEnv *, jclass, jint, jint, jfloatArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D +(JNIEnv *, jclass, jint, jint, jdoubleArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J +(JNIEnv *, jclass, jint, jint, jlongArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__I +(JNIEnv *, jclass, jint); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__F +(JNIEnv *, jclass, jfloat); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__S +(JNIEnv *, jclass, jshort); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D +(JNIEnv *env, jclass, jdouble); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__J +(JNIEnv *, jclass, jlong); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B +(JNIEnv *, jclass, jbyte); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_HDFNativeData */ diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt new file mode 100644 index 00000000000..2632b18719b --- /dev/null +++ b/java/test/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_TEST Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF5_JAVA_TEST_SRCS + TestH5.java + TestH5E.java + TestH5Edefault.java + TestH5Eregister.java + TestH5Fparams.java + TestH5Fbasic.java + TestH5F.java + TestH5Gbasic.java + TestH5G.java + TestH5Giterate.java + TestH5Sbasic.java + TestH5S.java + TestH5Tparams.java + TestH5Tbasic.java + TestH5T.java + TestH5Dparams.java + TestH5D.java + TestH5Dplist.java + TestH5Lparams.java + TestH5Lbasic.java + TestH5Lcreate.java + TestH5R.java + TestH5P.java + TestH5PData.java + TestH5Pfapl.java + TestH5Pvirtual.java + TestH5Plist.java + TestH5A.java + TestH5Oparams.java + TestH5Obasic.java + TestH5Ocreate.java + TestH5Ocopy.java + TestH5PL.java + TestH5Z.java + TestAll.java +) + +file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt +"Main-Class: test.TestAll +" +) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LIB_DIR}/junit.jar;${HDF5_JAVA_LIB_DIR}/hamcrest-core.jar;${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_SIMPLE_JAR}") + +add_jar (${HDF5_JAVA_TEST_LIB_TARGET} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_TEST_SRCS}) + +get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET} JAR_FILE) +#install_jar (${HDF5_JAVA_TEST_LIB_TARGET} ${HJAVA_INSTALL_DATA_DIR}/tests tests) +#get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET} CLASSDIR) + +add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET} ${HDF5_JAVA_HDF5_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java) + +set (HDF_JAVA_TEST_FILES + h5ex_g_iterate.hdf + JUnit-interface.txt +) + +foreach (h5_file ${HDF_JAVA_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( + TARGET ${HDF5_JAVA_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +endforeach (h5_file ${HDF_JAVA_TEST_FILES}) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) +set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") +set (testfilter "OK (598 tests)") + +if (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") +endif(CMAKE_BUILD_TYPE MATCHES Debug) + +add_test ( + NAME JUnit-interface + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" + -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" + -D "TEST_PROGRAM=test.TestAll" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" + -D "TEST_OUTPUT=JUnit-interface.out" +# -D "TEST_LOG_LEVEL=trace" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=TRUE" + -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=JUnit-interface.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" +) diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt new file mode 100644 index 00000000000..f065dd40ca8 --- /dev/null +++ b/java/test/JUnit-interface.txt @@ -0,0 +1,652 @@ +JUnit version 4.11 +.testJ2C +.testIsSerializable +.testH5garbage_collect +.testH5error_off +.serializeToDisk +.testH5open +.testH5check_version +.testH5get_libversion +.testH5set_free_list_limits +.testH5Eregister_class_lib_name_null +.testH5Eregister_class_version_null +.testH5Eunregister_class_invalid_classid +.testH5Eregister_class +.testH5Eregister_class_cls_name_null +.testH5EprintInt +.testH5Eset_current_stack_invalid_stkid +.testH5Eset_current_stack +.testH5Eget_num +.testH5Eclear +.testH5Eprint +.testH5Epush_null_name +.testH5Eget_num_with_msg +.testH5Eclear2_with_msg +.testH5Epush_invalid_stkid +.testH5Eget_current_stack +.testH5Ecreate_stack +.testH5Eget_msg_invalid_msgid +.testH5Eauto_is_v2 +.testH5EclearInt +.testH5Eauto_is_v2_invalid_stkid +.testH5Eclose_msg_invalid_errid +.testH5Eclose_stack_invalid_stackid +.testH5Eget_class_name_invalid_classname +.testH5Eget_num_invalid_stkid +.testH5EprintInt_invalid_classid +.testH5Epop +.testH5Epop_invalid_stkid +.testH5Eget_current_stack_pop +.testH5Eget_class_name_invalid_classid +.testH5Ecreate_msg_invalid_errid +.testH5Eclear2_invalid_stkid +.testH5Eprint2_invalid_classid +.testH5EprintInt +.testH5Eget_msg_major +.testH5Eget_msg_minor +.testH5Eget_msg +.testH5Eget_num +.testH5Epush +.testH5Ewalk +.testH5Eget_class_name +.testH5Eget_num_with_msg +.testH5Eclear2 +.testH5Eprint2 +.testH5Ecreate_msg_major +.testH5Ecreate_msg_minor +.testH5Ecreate_stack +.testH5Ecreate_msg_name_null +.testH5Eauto_is_v2 +.testH5EclearInt +.testH5Epop +.testH5Fcreate_null +.testH5Fflush_local +.testH5Fget_info +.testH5Fmount_null +.testH5Fcreate +.testH5Fflush_global +.testH5Funmount_null +.testH5Fclose_negative +.testH5Fopen_null +.testH5Fis_hdf5_null +.testH5Fis_hdf5_text +.testH5Fget_mdc_size +.testH5Fget_mdc_hit_rate +.testH5Fis_hdf5 +.testH5Fget_freespace +.testH5Fclose +.testH5Fget_filesize +.testH5Fcreate_EXCL +.testH5Freopen_closed +.testH5Freset_mdc_hit_rate_stats +.testH5Fget_name +.testH5Fcreate +.testH5Fclear_elink_file_cache +.testH5Fclose_twice +.testH5Freopen +.testH5Fopen_read_only +.testH5Fget_access_plist +.testH5Fget_obj_ids +.testH5Fget_intent_rdwr +.testH5Fget_access_plist_closed +.testH5Fget_create_plist_closed +.testH5Fget_intent_rdonly +.testH5Fget_create_plist +.testH5Fget_obj_count +.testH5Gget_info_by_name_not_exists +.testH5Gget_info_by_idx_not_exists +.testH5Gget_info_by_name +.testH5Gget_create_plist +.testH5Gopen +.testH5Gget_info_by_idx_null +.testH5Gopen_not_exists +.testH5Gclose +.testH5Gcreate_anon +.testH5Gcreate_null +.testH5Gget_info_by_idx_fileid +.testH5Gclose_invalid +.testH5Gopen_invalid +.testH5Gget_info_invalid +.testH5Gcreate_invalid +.testH5Gcreate_exists +.testH5Gget_info_by_name_null +.testH5Gget_info_by_name_invalid +.testH5Gget_create_plist_invalid +.testH5Gcreate +.testH5Gget_info_by_name_fileid +.testH5Gget_info_by_idx_invalid +.testH5Gopen_null +.testH5Gget_info_by_idx +.testH5Gget_info +.testH5Gget_info_by_name +.testH5Gget_create_plist +.testH5Gopen +.testH5Gget_obj_info_all_gid2 +.testH5Gget_obj_info_all_byIndexType +.testH5Gget_obj_info_max_limit +.testH5Gget_obj_info_all +.testH5Gget_obj_info_max +.testH5Gget_obj_info_all_gid +.testH5Gget_info_by_idx +.testH5Gget_info +.testH5Gget_obj_info_all +.testH5Sclose_invalid +.testH5Screate_simple_max_default +.testH5Screate_simple_dims_null +.testH5Sdecode_null +.testH5Screate_simple_dims_exceed +.testH5Screate_simple_unlimted_1d +.testH5Screate_simple_dims_invalid +.testH5Screate_scalar +.testH5Screate_simple +.testH5Screate_simple_rank_invalid +.testH5Sget_simple_extent_type_invalid +.testH5Sencode_invalid +.testH5Screate_null +.testH5Screate_simple_extent +.testH5Screate_invalid +.testH5Screate_simple_unlimted +.testH5Sget_select_npoints +.testH5Sget_select_type +.testH5Sset_extent_simple +.testH5Sget_select_hyper +.testH5Sget_select_valid +.testH5Sget_select_elem_pointlist +.testH5Sset_extent_none +.testH5Sencode_decode_scalar_dataspace +.testH5Soffset_simple +.testH5Scopy +.testH5Sget_simple_extent_ndims +.testH5Sextent_equal +.testH5Sget_simple_extent_dims +.testH5Sget_simple_extent_type +.testH5Shyper_regular +.testH5Sget_select_bounds +.testH5Sget_select_elem_pointlist_invalid +.testH5Sget_simple_extent_npoints +.testH5Sextent_copy +.testH5Sencode_decode_null_dataspace +.testH5Sis_simple +.testH5Sget_simple_extent_dims_null +.testH5Sselect_none +.testH5Tget_member_type_invalid +.testH5Tenum_insert_null +.testH5Tget_offset_invalid +.testH5Tset_precision_invalid +.testH5Tget_inpad_invalid +.testH5Tenum_nameof_invalid +.testH5Tget_member_value_invalid +.testH5Tenum_nameof_value_null +.testH5Tcreate_invalid +.testH5Tget_strpad_invalid +.testH5Tenum_valueof_invalid +.testH5Tget_fields_null +.testH5Topen_null +.testH5Tpack_invalid +.testH5Tcommit_null +.testH5Tinsert_invalid +.testH5Tenum_valueof_null +.testH5Tset_norm_invalid +.testH5Tlock_invalid +.testH5Tarray_create_invalid +.testH5Tget_member_value_null +.testH5Tset_offset_invalid +.testH5Tget_fields_invalid +.testH5Tequal_invalid +.testH5Tget_ebias_long_invalid +.testH5Tget_cset_invalid +.testH5Tget_size_invalid +.testH5Tset_strpad_invalid +.testH5Tset_ebias_invalid +.testH5Tget_sign_invalid +.testH5Tget_member_index_invalid +.testH5Tget_precision_invalid +.testH5Tset_fields_invalid +.testH5Tcopy_invalid +.testH5Tget_pad_invalid +.testH5Tset_order_invalid +.testH5Tget_member_class_invalid +.testH5Tget_super_invalid +.testH5Tget_class_invalid +.testH5Topen_invalid +.testH5Tget_precision_long_invalid +.testH5Tget_ebias_invalid +.testH5Tget_native_type_invalid +.testH5Tget_fields_length_invalid +.testH5Tget_norm_invalid +.testH5Tenum_nameof_invalid_size +.testH5Tset_pad_invalid +.testH5Tget_pad_null +.testH5Tset_tag_null +.testH5Tget_order_invalid +.testH5Tcommit_invalid +.testH5Tget_array_ndims_invalid +.testH5Tset_tag_invalid +.testH5Tvlen_create_invalid +.testH5Tenum_create_invalid +.testH5Tinsert_null +.testH5Tset_inpad_invalid +.testH5Tenum_valueof_name_null +.testH5Tset_cset_invalid +.testH5Tclose_invalid +.testH5Tget_nmembers_invalid +.testH5Tarray_create_value_null +.testH5Tset_size_invalid +.testH5Tenum_insert_invalid +.testH5Tget_array_dims_null +.testH5Tget_member_index_null +.testH5Tset_sign_invalid +.testH5Tenum_insert_name_null +.testH5Tequal_not +.testH5Tcopy +.testH5Tequal +.testH5Torder_size +.testH5Tconvert +.testH5Tvlen_create +.testH5Tenum_create_functions +.testH5Tenum_functions +.testH5Tget_class +.testH5Tget_array_ndims +.testH5Tequal_type_error +.testH5Tget_array_dims +.testH5Tset_size +.testH5Tis_variable_str +.testH5Tcompound_functions +.testH5Tget_size +.testH5Tarray_create +.testH5Topaque_functions +.testH5Dget_space_status_invalid +.testH5Dget_access_plist_invalid +.testH5Dget_type_invalid +.testH5Dget_create_plist_invalid +.testH5Dget_offset_invalid +.testH5Dvlen_get_buf_size_invalid +.testH5Dcreate_null +.testH5Dset_extent_status_null +.testH5Dvlen_reclaim_null +.testH5Dcreate_invalid +.testH5Dcreate_anon_invalid +.testH5Dset_extent_status_invalid +.testH5Dvlen_reclaim_invalid +.testH5Dopen_invalid +.testH5Dclose_invalid +.testH5Dget_storage_size_invalid +.testH5Dget_space_invalid +.testH5Dopen_null +.testH5Dget_storage_size +.testH5Diterate_write +.testH5Dcreate +.testH5Dget_offset +.testH5Dget_type +.testH5Dfill +.testH5Dopen +.testH5Dcreate_anon +.testH5Dfill_null +.testH5Dget_storage_size_empty +.testH5Diterate +.testH5Dget_access_plist +.testH5Dvlen_read_invalid_buffer +.testH5Dvlen_get_buf_size +.testH5Dget_space_closed +.testH5Dget_space_status +.testH5Dvlen_write_read +.testH5Dget_space +.testH5Dget_type_closed +.testH5Dset_extent +.testH5Lcopy_invalid +.testH5Lget_value_by_idx_null +.testH5Lcreate_external_invalid +.testH5Lexists_null +.testH5Lget_info_invalid +.testH5Lget_name_by_idx_invalid +.testH5Lmove_null_current +.testH5Literate_by_name_nullname +.testH5Lvisit_by_name_nullname +.testH5Lvisit_null +.testH5Lget_name_by_idx_null +.testH5Lcreate_hard_null_dest +.testH5Lget_value_null +.testH5Lcreate_external_null_dest +.testH5Lcreate_external_null_file +.testH5Lcreate_external_null_current +.testH5Ldelete_null +.testH5Lexists_invalid +.testH5Lmove_invalid +.testH5Lcreate_hard_invalid +.testH5Lcopy_null_dest +.testH5Lcreate_soft_null_current +.testH5Lcopy_null_current +.testH5Lget_info_by_idx_null +.testH5Literate_null +.testH5Ldelete_invalid +.testH5Lvisit_by_name_null +.testH5Ldelete_by_idx_invalid +.testH5Lget_info_by_idx_invalid +.testH5Ldelete_by_idx_null +.testH5Lcreate_soft_invalid +.testH5Lcreate_hard_null_current +.testH5Lget_value_by_idx_invalid +.testH5Lmove_null_dest +.testH5Lget_info_null +.testH5Literate_by_name_null +.testH5Lcreate_soft_null_dest +.testH5Lget_value_invalid +.testH5Lget_info_by_idx_not_exist_name +.testH5Lget_name_by_idx_not_exist +.testH5Lvisit +.testH5Lget_name_by_idx_n0 +.testH5Lget_name_by_idx_n3 +.testH5Lvisit_by_name +.testH5Literate_by_name +.testH5Lget_info_hardlink +.testH5Literate +.testH5Lget_info_by_idx_n0 +.testH5Lget_info_by_idx_n3 +.testH5Lget_info_by_idx_name_not_exist_create +.testH5Lexists +.testH5Lget_info_by_idx_name_not_exist_name +.testH5Lget_info_by_idx_not_exist_create +.testH5Lget_info_not_exist +.testH5Lget_info_dataset +.testH5Lget_info_by_idx_n0_create +.testH5Ldelete_soft_link_dangle +.testH5Lget_value_by_idx_external_create +.testH5Ldelete_by_idx_not_exist_create +.testH5Lvisit_create +.testH5Lmove_dst_link_exists +.testH5Lcreate_soft_dangle +.testH5Literate_create +.testH5Lcopy_cur_not_exists +.testH5Lcopy +.testH5Lmove +.testH5Lget_value_by_idx_n2_create +.testH5Lget_value_soft +.testH5Ldelete_by_idx_n2_name +.testH5Lget_info_by_idx_n1_create +.testH5Lcreate_external +.testH5Lget_value_dangle +.testH5Lcreate_hard_dst_link_exists +.testH5Lget_value_by_idx_n2_name +.testH5Lcreate_soft_dst_link_exists +.testH5Lcreate_hard +.testH5Lcreate_soft +.testH5Lmove_cur_not_exists +.testH5Lcreate_hard_cur_not_exists +.testH5Lget_info_softlink_dangle +.testH5Ldelete_by_idx_n2_create +.testH5Ldelete_soft_link +.testH5Lget_info_externallink +.testH5Lcopy_dst_link_exists +.testH5Lget_value_by_idx_external_name +.testH5Ldelete_by_idx_not_exist_name +.testH5Lget_info_softlink +.testH5Lget_value_external +.testH5Lget_value_by_idx_not_exist_create +.testH5Lget_value_by_idx_not_exist_name +.testH5Ldelete_hard_link +.testH5Rgetregion_Nullreference +.testH5Rget_obj_type2_Invalidreftype +.testH5Rdereference +.testH5Rget_name +.testH5Rcreate_Invalidreftype +.testH5Rget_name_NULLreference +.testH5Rget_region +.testH5Rdereference_Nullreference +.testH5Rcreate_refobj +.testH5Rcreate_Invalidspace_id +.testH5Rdereference_Invalidreference +.testH5Rgetregion_Badreferencetype +.testH5Rcreate_regionrefobj +.testH5Rget_name_Invalidreftype +.testH5Rgetregion_Invalidreftype +.testH5Rget_obj_type2 +.testH5Rcreate_InvalidObjectName +.testH5Pset_nbit +.testH5Pset_shared_mesg_index_InvalidFlag +.testH5Pset_shared_mesg_phase_change +.testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue +.testH5P_layout +.testH5Pget_link_creation_order +.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes +.testH5Pget_shared_mesg_index_Invalid_indexnum +.testH5Pset_data_transform_NullExpression +.testH5Pset_elink_prefix_null +.testH5Pget_elink_prefix +.testH5Pget_nlinks +.testH5Pset_libver_bounds_invalidhigh +.testH5Pget_char_encoding +.testH5P_istore_k +.testH5Pget_link_phase_change +.testH5Pset_link_phase_change_max_compactLESSTHANmin_dense +.testH5Pget_shared_mesg_phase_change_EqualsSET +.testH5Pset_scaleoffset_Invalidscale_type +.testH5Pget_istore_k_null +.testH5Pset_libver_bounds_invalidlow +.testH5Pset_est_link_info +.testH5Pget_link_phase_change_Null +.testH5P_fill_time +.testH5Pget_userblock_null +.testH5Pset_link_creation_order_tracked +.testH5Pset_shared_mesg_index +.testH5Pset_copy_object +.testH5Pset_link_creation_order_trackedPLUSindexed +.testH5Pset_copy_object_invalidobject +.testH5Pset_est_link_info_InvalidValues +.testH5P_file_space +.testH5Pset_local_heap_size_hint +.testH5Pget_est_link_info +.testH5Pset_scaleoffset +.testH5Pset_create_intermediate_group_invalidobject +.testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue +.testH5Pset_create_intermediate_group +.testH5P_alloc_time +.testH5Pset_elink_acc_flags +.testH5Pset_link_phase_change_Highmax_Compact +.testH5P_chunk +.testH5P_sizes +.testH5Pset_link_creation_order_invalidvalue +.testH5P_sym_k +.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist +.testH5Pget_version_null +.testH5Pset_scaleoffset_Invalidscale_factor +.testH5Pget_elink_prefix_null +.testH5Pget_data_transform_IllegalSize +.testH5Pget_create_intermediate_group +.testH5Pset_shared_mesg_nindexes +.testH5Pset_attr_creation_order_trackedPLUSindexed +.testH5Pget_sym_k_null +.testH5Pset_nlinks +.testH5P_obj_track_times +.testH5P_userblock +.testH5Pget_local_heap_size_hint +.testH5Pset_shared_mesg_index_Invalid_indexnum +.testH5Pset_data_transform_InvalidExpression1 +.testH5Pset_data_transform_InvalidExpression2 +.testH5Pget_attr_phase_change +.testH5Pget_data_transform +.testH5Pget_create_intermediate_group_notcreated +.testH5Pset_elink_prefix +.testH5Pget_attr_creation_order +.testH5Pset_attr_creation_order_invalidvalue +.testH5Pget_shared_mesg_phase_change +.testH5Pget_shared_mesg_index +.testH5Pset_link_phase_change +.testH5Pget_shared_mesg_nindexes +.testH5Pget_version +.testH5Pset_elink_acc_flags_InvalidFlag1 +.testH5Pset_elink_acc_flags_InvalidFlag2 +.testH5Pget_link_phase_change_EqualsSet +.testH5Pget_elink_acc_flags +.testH5Pget_data_transform_ExpressionNotSet +.testH5P_fill_value +.testH5Pget_sizes_null +.testH5Pset_data_transform +.testH5Pset_attr_creation_order_tracked +.testH5P_buffer +.testH5Pdata_transform +.testH5P_elink_fapl +.testH5P_fapl_direct +.testH5P_alignment +.testH5P_fapl_family +.testH5P_chunk_cache +.testH5P_meta_block_size +.testH5Pget_elink_fapl +.testH5Pset_mdc_config +.testH5P_small_data_block_size +.testH5Pset_fapl_log +.testH5Pset_libver_bounds +.testH5P_sieve_buf_size +.testH5P_elink_file_cache_size +.testH5P_cache +.testH5Pget_mdc_config +.testH5P_fapl_muti_defaults +.testH5Pget_libver_bounds +.testH5P_btree_ratios +.testH5P_fapl_muti_nulls +.testH5Pset_fapl_sec2 +.testH5Pmulti_transform +.testH5Pset_elink_fapl_NegativeID +.testH5Pset_fapl_stdio +.testH5P_edc_check +.testH5Pset_elink_fapl +.testH5P_hyper_vector_size +.testH5P_gc_references +.testH5P_family_offset +.testH5P_fapl_core +.testH5P_fapl_muti +.testH5P_fapl_split +.testH5Pset_fapl_windows +.testH5P_fclose_degree +.testH5Pget_source_datasetname +.testH5Pvirtual_storage +.testH5Pget_selection_source_dataset +.testH5Pget_source_filename +.testH5Pget_virtual_count +.testH5Pset_get_virtual_view +.testH5Pget_mapping_parameters +.testH5P_genprop_basic_class +.testH5P_genprop_class_iter +.testH5P_genprop_basic_class_prop +.testH5P_genprop_basic_list_prop +.testH5Acreate2_nullname +.testH5Acreate_by_name +.testH5Aget_name_by_idx +.testH5Aget_storage_size +.testH5Aiterate +.testH5Aopen_by_idx +.testH5Aopen_invalidname +.testH5Aopen +.testH5Aget_info_by_name +.testH5Aget_create_plist +.testH5Adelete_by_name +.testH5Aopen_by_name +.testH5Aget_info +.testH5Aget_name +.testH5Aexists +.testH5Aget_info_by_idx +.testH5Arename +.testH5Adelete_by_idx_name1 +.testH5Adelete_by_idx_name2 +.testH5Adelete_by_idx_order +.testH5Arename_by_name +.testH5Acreate2_invalidobject +.testH5Acreate2 +.testH5Aiterate_by_name +.testH5Adelete_by_idx_null +.testH5Adelete_by_idx_invalidobject +.testH5Awrite_readVL +.testH5Aget_info1 +.testH5Oget_comment_by_name_null +.testH5Ovisit_by_name_nullname +.testH5Oget_info_invalid +.testH5Ovisit_by_name_null +.testH5Oget_comment_invalid +.testH5Oset_comment_by_name_invalid +.testH5Oopen_null +.testH5Oclose_invalid +.testH5Oget_comment_by_name_invalid +.testH5Ocopy_null_dest +.testH5Olink_invalid +.testH5Oget_info_by_idx_invalid +.testH5Oget_info_by_idx_null +.testH5Olink_null_dest +.testH5Oget_info_by_name_invalid +.testH5Oget_info_by_name_null +.testH5Ocopy_invalid +.testH5Oset_comment_by_name_null +.testH5Ocopy_null_current +.testH5Oset_comment_invalid +.testH5Oopen_invalid +.testH5Ovisit_null +.testH5Oexists_by_name +.testH5Oget_info_by_idx_n0 +.testH5Oget_info_by_idx_n3 +.testH5Oget_info_by_name_not_exist_name +.testH5Ovisit_by_name +.testH5Oget_info_by_idx_name_not_exist_name +.testH5Oget_info_datatype +.testH5Oget_info_by_idx_not_exist_name +.testH5Oopen_by_idx_n0 +.testH5Oopen_by_idx_n3 +.testH5Oopen_not_exists +.testH5Ovisit +.testH5Oget_info_by_idx_not_exist_create +.testH5Oget_info_by_name_hardlink +.testH5Oget_info_by_name_group +.testH5Oopen_by_addr +.testH5Oget_info_by_name_not_exists +.testH5Oget_info_by_name_dataset +.testH5Oget_info_group +.testH5Oget_info_by_name_datatype +.testH5Oget_info_hardlink +.testH5Oget_info_by_idx_name_not_exist_create +.testH5Oget_info_dataset +.testH5OcopyRefsDatasettosameFile +.testH5OcopyRefsDatasettodiffFile +.testH5OcopyRefsAttr +.testH5Oget_info_by_idx_n0_create +.testH5Oget_info_softlink_dangle +.testH5Oget_info_softlink +.testH5Oget_info_externallink +.testH5Ocopy +.testH5Olink +.testH5Ocomment_by_name +.testH5Oget_info_by_idx_n1_create +.testH5Ocomment +.testH5Oinc_dec_count +.testH5Ocomment_by_name_clear +.testH5Ovisit_create +.testH5Ocopy_dst_link_exists +.testH5Ocomment_clear +.testH5Ocopy_cur_not_exists +.TestH5PLplugins +.testH5Zfilter_avail +.testH5Zunregister_predefined +.testH5Zget_filter_info + +Time: XXXX + +OK (624 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 + major: File accessibilty + minor: Can't set value + #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list + major: Property lists + minor: Inappropriate type + #002: (file name) line (number) in H5P_isa_class(): not a property list + major: Invalid arguments to routine + minor: Inappropriate type +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 + major: File accessibilty + minor: Can't set value + #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list + major: Property lists + minor: Inappropriate type + #002: (file name) line (number) in H5P_isa_class(): not a property list + major: Invalid arguments to routine + minor: Inappropriate type +[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java +[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/Makefile.am b/java/test/Makefile.am new file mode 100644 index 00000000000..1cb41df78f3 --- /dev/null +++ b/java/test/Makefile.am @@ -0,0 +1,103 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Test Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = test +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +jarfile = jar$(PACKAGE_TARNAME)test.jar + +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +noinst_JAVA = \ + TestH5.java \ + TestH5E.java \ + TestH5Edefault.java \ + TestH5Eregister.java \ + TestH5Fparams.java \ + TestH5Fbasic.java \ + TestH5F.java \ + TestH5Gbasic.java \ + TestH5G.java \ + TestH5Giterate.java \ + TestH5Sbasic.java \ + TestH5S.java \ + TestH5Tparams.java \ + TestH5Tbasic.java \ + TestH5T.java \ + TestH5Dparams.java \ + TestH5D.java \ + TestH5Dplist.java \ + TestH5Lparams.java \ + TestH5Lbasic.java \ + TestH5Lcreate.java \ + TestH5R.java \ + TestH5P.java \ + TestH5PData.java \ + TestH5Pfapl.java \ + TestH5Pvirtual.java \ + TestH5Plist.java \ + TestH5A.java \ + TestH5Oparams.java \ + TestH5Obasic.java \ + TestH5Ocreate.java \ + TestH5Ocopy.java \ + TestH5PL.java \ + TestH5Z.java \ + TestAll.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = junit.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class junit.sh + +#JAVA_JUNIT = $(JAVA_SRCS) +#noinst_JAVA = @JAVA_JUNIT@ +#EXTRA_JAVA = $(JAVA_JUNIT) +TESTS_JUNIT = AllJunitTests +#EXTRA_TEST = $(TESTS_JUNIT) + +AllJunitTests : + echo "#! /bin/sh" > $@ + echo "exec @JUNIT@ test.TestAll" >> $@ + chmod +x $@ + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/test/TestAll.java b/java/test/TestAll.java new file mode 100644 index 00000000000..e3abe216754 --- /dev/null +++ b/java/test/TestAll.java @@ -0,0 +1,40 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( { TestH5.class, + TestH5Eregister.class, + TestH5Edefault.class, + TestH5E.class, + TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, + TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class, + TestH5Sbasic.class, TestH5S.class, + TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class, + TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, + TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, + TestH5R.class, + TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, + TestH5A.class, + TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, + TestH5PL.class, TestH5Z.class +}) + +public class TestAll { +} diff --git a/java/test/TestH5.java b/java/test/TestH5.java new file mode 100644 index 00000000000..1a78bea02ef --- /dev/null +++ b/java/test/TestH5.java @@ -0,0 +1,257 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +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; + +/** + * @author xcao + * + */ +public class TestH5 { + @Rule public TestName testname = new TestName(); + @Before + public void showTestName() { + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + /** + * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. + * NOTE: + * H5F_ACC_DEBUG no longer prints any special debug info. The symbol is + * being retained and will be listed as deprecated in HDF5 1.10.0. + */ + @Test + public void testJ2C() { + int H5F_ACC_RDONLY = 0x0000; + int H5F_ACC_RDWR = 0x0001; + int H5F_ACC_TRUNC = 0x0002; + int H5F_ACC_EXCL = 0x0004; + int H5F_ACC_DEBUG = 0x0000; // HDFFV-1074 was 0x0008; + int H5F_ACC_CREAT = 0x0010; + int H5F_OBJ_FILE = 0x0001; + int H5F_OBJ_DATASET = 0x0002; + int H5F_OBJ_GROUP = 0x0004; + int H5F_OBJ_DATATYPE = 0x0008; + int H5F_OBJ_ATTR = 0x0010; + int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP + | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR; + int H5F_OBJ_LOCAL = 0x0020; + + int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, + H5F_ACC_EXCL, H5F_ACC_DEBUG, H5F_ACC_CREAT, H5F_OBJ_FILE, + H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, + H5F_OBJ_ALL, H5F_OBJ_LOCAL }; + + int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5F_ACC_EXCL, H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, + HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, + HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, + HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL }; + + for (int i = 0; i < definedValues.length; i++) { + assertEquals(definedValues[i], j2cValues[i]); + } + + assertFalse(H5F_ACC_RDONLY == HDF5Constants.H5F_ACC_RDWR); + assertFalse(H5F_OBJ_FILE == HDF5Constants.H5F_OBJ_GROUP); + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5error_off()}. + */ + @Test + public void testH5error_off() { + try { + H5.H5error_off(); + } + catch (Throwable err) { + fail("H5.H5error_off failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5open()}. + */ + @Test + public void testH5open() { + try { + H5.H5open(); + } + catch (Throwable err) { + fail("H5.H5open failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5garbage_collect()}. + */ + @Test + public void testH5garbage_collect() { + try { + H5.H5garbage_collect(); + } + catch (Throwable err) { + fail("H5.H5garbage_collect failed: " + err); + } + } + + /** + * Test method for + * {@link hdf.hdf5lib.H5#H5set_free_list_limits(int, int, int, int, int, int)} + * . + */ + @Test + public void testH5set_free_list_limits() { + int reg_global_lim = 1; + int reg_list_lim = 1; + int arr_global_lim = 1; + int arr_list_lim = 1; + int blk_global_lim = 1; + int blk_list_lim = 1; + + try { + H5.H5set_free_list_limits(reg_global_lim, reg_list_lim, + arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); + } + catch (Throwable err) { + fail("H5.H5set_free_list_limits failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}. + */ + @Test + public void testH5get_libversion() { + int libversion[] = { 1, 9, 0 }; + + try { + H5.H5get_libversion(libversion); + } + catch (Throwable err) { + fail("H5.H5get_libversion: " + err); + } + + for (int i = 0; i < 2; i++) + assertEquals(H5.LIB_VERSION[i], libversion[i]); + + for (int i = 0; i < 2; i++) + assertFalse(libversion[i] == 0); + } + + /** + * Test method for + * {@link hdf.hdf5lib.H5#H5check_version(int, int, int)}. + */ + @Test + public void testH5check_version() { + int majnum = 1, minnum = 9, relnum = 0; + + try { + H5.H5check_version(majnum, minnum, relnum); + } + catch (Throwable err) { + fail("H5.H5check_version failed: " + err); + } + + try { + H5.H5check_version(-1, 0, 0); + } + catch (Throwable err) { + fail("H5.H5check_version failed: " + err); + } + } + + @Test + public void testIsSerializable() { + H5 test = new H5(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ObjectOutputStream oos; + try { + oos = new ObjectOutputStream(out); + oos.writeObject(test); + oos.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("ObjectOutputStream failed: " + err); + } + assertTrue(out.toByteArray().length > 0); + + } + + @SuppressWarnings("static-access") + @Test + public void serializeToDisk() + { + try { + H5 test = new H5(); + + FileOutputStream fos = new FileOutputStream("temph5.ser"); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(test); + oos.close(); + } + catch (Exception ex) { + fail("Exception thrown during test: " + ex.toString()); + } + + try { + FileInputStream fis = new FileInputStream("temph5.ser"); + ObjectInputStream ois = new ObjectInputStream(fis); + H5 test = (hdf.hdf5lib.H5) ois.readObject(); + ois.close(); + + assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0]==H5.LIB_VERSION[0]); + assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1]==H5.LIB_VERSION[1]); +// assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]); + + // Clean up the file + new File("temph5.ser").delete(); + } + catch (Exception ex) { + fail("Exception thrown during test: " + ex.toString()); + } + } +} diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java new file mode 100644 index 00000000000..fb7b31a1536 --- /dev/null +++ b/java/test/TestH5A.java @@ -0,0 +1,1119 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5A_iterate_cb; +import hdf.hdf5lib.callbacks.H5A_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5A_info_t; + +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; + +public class TestH5A { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long type_id = -1; + long space_id = -1; + long lapl_id = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + 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("TestH5A._createDataset: ", did > 0); + + return did; + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("TestH5A.createH5file: H5.H5Fcreate: ", H5fid > 0); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + assertTrue("TestH5A.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + H5did = _createDataset(H5fid, H5dsid, "dset", + HDF5Constants.H5P_DEFAULT); + assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); + space_id = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue(space_id > 0); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + assertTrue(lapl_id > 0); + type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE); + assertTrue(type_id > 0); + int status = H5.H5Tenum_insert(type_id, "test", 1); + assertTrue(status >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5A.createH5file: " + err); + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + + if (type_id > 0) + try {H5.H5Tclose(type_id);} catch (Exception ex) {} + if (space_id > 0) + try {H5.H5Sclose(space_id);} catch (Exception ex) {} + if (lapl_id > 0) + try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Acreate2() { + long attr_id = -1; + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Acreate2", attr_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate2: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Acreate2_invalidobject() throws Throwable { + H5.H5Acreate(H5dsid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Acreate2_nullname() throws Throwable { + H5.H5Acreate(H5did, null, type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Aopen() { + String attr_name = "dset"; + long attribute_id = -1; + long attr_id = -1; + + try { + attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + // Opening the existing attribute, attr_name(Created by H5ACreate2) + // attached to an object identifier. + attribute_id = H5.H5Aopen(H5did, attr_name, + HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Aopen: H5Aopen", attribute_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Aopen_invalidname() throws Throwable { + H5.H5Aopen(H5did, "attr_name", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Aopen_by_idx() { + long loc_id = H5did; + String obj_name = "."; + int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; + int order = HDF5Constants.H5_ITER_INC; + long n = 0; + long attr_id = -1; + long attribute_id = -1; + long aapl_id = HDF5Constants.H5P_DEFAULT; + + try { + attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + // Opening the existing attribute, obj_name(Created by H5ACreate2) + // by index, attached to an object identifier. + attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, + 0, HDF5Constants.H5P_DEFAULT, lapl_id); + + assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); + + // Negative test- Error should be thrown when H5Aopen_by_idx is + // called + // with n=5 and we do not have 5 attributes created. + try { + n = 5; + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, + aapl_id, lapl_id); + fail("Negative Test Failed:- Error not Thrown when n is invalid."); + } + catch (AssertionError err) { + fail("H5.H5Aopen_by_idx: " + err); + } + catch (HDF5LibraryException err) {} + + // Negative test- Error should be thrown when H5Aopen_by_idx is + // called + // with an invalid object name(which hasn't been created). + try { + n = 0; + obj_name = "file"; + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, + aapl_id, lapl_id); + fail("Negative Test Failed:- Error not Thrown when attribute name is invalid."); + } + catch (AssertionError err) { + fail("H5.H5Aopen_by_idx: " + err); + } + catch (HDF5LibraryException err) {} + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_idx: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Acreate_by_name() { + String obj_name = "."; + String attr_name = "DATASET"; + long attribute_id = -1; + boolean bool_val = false; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Acreate_by_name: H5Acreate_by_name", + attribute_id >= 0); + + // Check if the name of attribute attached to the object specified + // by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name, + lapl_id); + assertTrue("testH5Acreate_by_name: H5Aexists_by_name", + bool_val == true); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate_by_name " + err); + } + finally { + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException { + long loc_id = H5fid; + String old_attr_name = "old"; + String new_attr_name = "new"; + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + + try { + attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id); + + ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); + + // Check the return value.It should be non negative. + assertTrue("testH5Arename: H5Arename", ret_val >= 0); + + // Check if the new name of attribute attached to the object + // specified by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists(loc_id, new_attr_name); + assertTrue("testH5Arename: H5Aexists", bool_val == true); + + // Check if the old name of attribute attached to the object + // specified by loc_id and obj_name exists. It should equal false. + bool_val = H5.H5Aexists(loc_id, old_attr_name); + assertEquals(bool_val, false); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Arename " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Arename_by_name() { + long loc_id = H5fid; + String obj_name = "."; + String old_attr_name = "old"; + String new_attr_name = "new"; + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + + try { + attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + + ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, + new_attr_name, lapl_id); + + // Check the return value.It should be non negative. + assertTrue("testH5Arename_by_name: H5Arename_by_name", ret_val >= 0); + + // Check if the new name of attribute attached to the object + // specified by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name, + lapl_id); + assertTrue("testH5Arename_by_name: H5Aexists_by_name", + bool_val == true); + + // Check if the old name of attribute attached to the object + // specified by loc_id and obj_name exists. It should equal false. + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name, + lapl_id); + assertEquals(bool_val, false); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Arename_by_name " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_name() { + String obj_name = "."; + String attr_name = "DATASET1"; + String ret_name = null; + long attribute_id = -1; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); + ret_name = H5.H5Aget_name(attribute_id); + assertEquals(ret_name, attr_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_name " + err); + } + finally { + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + + @Test + public void testH5Aget_name_by_idx() { + long loc_id = H5fid; + String obj_name = "."; + String attr_name = "DATASET1", attr2_name = "DATASET2"; + String ret_name = null; + int idx_type = HDF5Constants.H5_INDEX_NAME; + int order = HDF5Constants.H5_ITER_INC; + int n = 0; + long attr1_id = -1; + long attr2_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + // getting the 1st attribute name(n=0). + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, + n, lapl_id); + assertFalse("H5Aget_name_by_idx ", ret_name == null); + assertEquals(ret_name, attr_name); + + // getting the second attribute name(n=1) + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, + 1, lapl_id); + assertFalse("H5Aget_name_by_idx ", ret_name == null); + assertEquals(ret_name, attr2_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_name_by_idx " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_storage_size() { + long attr_id = -1; + long attr_size = -1; + + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + attr_size = H5.H5Aget_storage_size(attr_id); + assertTrue("The size of attribute is :", attr_size == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_storage_size: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info() { + H5A_info_t attr_info = null; + long attribute_id = -1; + long attr_id = -1; + + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen(H5did, "dset", HDF5Constants.H5P_DEFAULT); + // Calling H5Aget_info with attribute_id returned from H5Aopen. + attr_info = H5.H5Aget_info(attribute_id); + assertFalse("H5Aget_info ", attr_info == null); + assertTrue("Corder_Valid should be false", + attr_info.corder_valid == false); + assertTrue("Character set used for attribute name", + attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + assertTrue("Corder ", attr_info.corder == 0); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info1() { + H5A_info_t attr_info = null; + long attribute_id = -1; + long attr_id = -1; + int order = HDF5Constants.H5_ITER_INC; + + try { + attr_id = H5.H5Acreate(H5did, ".", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen_by_idx(H5did, ".", + HDF5Constants.H5_INDEX_CRT_ORDER, order, 0, + HDF5Constants.H5P_DEFAULT, lapl_id); + // Calling H5Aget_info with attribute_id returned from + // H5Aopen_by_idx. + attr_info = H5.H5Aget_info(attribute_id); + + assertFalse("H5Aget_info ", attr_info == null); + assertTrue("Corder_Valid should be true", + attr_info.corder_valid == true); + assertTrue("Character set", + attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + assertTrue("Corder ", attr_info.corder == 0); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info1: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info_by_idx() { + long attr_id = -1; + long attr2_id = -1;; + H5A_info_t attr_info = null; + + try { + attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + //Verify info for 1st attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder ", attr_info.corder == 0);//should equal 0 as this is the order of 1st attribute created. + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + + //Verify info for 2nd attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr2_id)); + + //verify info for 2nd attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 0, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + + //verify info for 1st attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + + //verify info for 1st attribute, in increasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + + //verify info for 2nd attribute, in decreasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info_by_idx:" + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info_by_name() { + long attr_id = -1; + H5A_info_t attr_info = null; + String obj_name = "."; + String attr_name = "DATASET"; + + try { + attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, + space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name, + lapl_id); + assertNotNull(attr_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info_by_name:" + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_name() { + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + boolean exists = false; + + try { + attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); + assertTrue("H5Adelete_by_name", ret_val >= 0); + + // Check if the Attribute still exists. + bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET", + lapl_id); + assertFalse("testH5Adelete_by_name: H5Aexists_by_name", bool_val); + exists = H5.H5Aexists(H5fid, "DATASET"); + assertFalse("testH5Adelete_by_name: H5Aexists ",exists); + + // Negative test. Error thrown when we try to delete an attribute + // that has already been deleted. + try{ + ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); + fail("Negative Test Failed: Error Not thrown."); + } + catch (AssertionError err) { + fail("H5.H5Adelete_by_name: " + err); + } + catch (HDF5LibraryException err) {} + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_name " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aexists() { + boolean exists = false; + long attr_id = -1; + long attribute_id = -1; + + try { + exists = H5.H5Aexists(H5fid, "None"); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aexists: " + err); + } + assertFalse("H5Aexists ", exists); + + try { + attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + exists = H5.H5Aexists(H5fid, "dset"); + assertTrue("H5Aexists ", exists); + + attribute_id = H5.H5Acreate_by_name(H5fid, ".", "attribute", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute"); + assertTrue("H5Aexists ", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aexists: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_order() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute4"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_name1() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute3"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_name2() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute1"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test(expected = NullPointerException.class) + public void testH5Adelete_by_idx_null() throws Throwable { + H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, lapl_id); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Adelete_by_idx_invalidobject() throws Throwable { + H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, lapl_id); + } + + @Test + public void testH5Aopen_by_name() { + String obj_name = "."; + String attr_name = "DATASET"; + long attribute_id = -1; + long aid = -1; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + //open Attribute by name + if(attribute_id >= 0) { + try { + aid = H5.H5Aopen_by_name(H5fid, obj_name, attr_name, HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Aopen_by_name: ", aid>=0); + } + catch(Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_name " + err); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_name " + err); + } + finally { + if (aid > 0) + try {H5.H5Aclose(aid);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Awrite_readVL() { + String attr_name = "VLdata"; + long attr_id = -1; + long atype_id = -1; + long aspace_id = -1; + String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; + long[] dims = { str_data.length }; + long lsize = 1; + + try { + atype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("testH5Awrite_readVL.H5Tcopy: ", atype_id >= 0); + H5.H5Tset_size(atype_id, HDF5Constants.H5T_VARIABLE); + assertTrue("testH5Awrite_readVL.H5Tis_variable_str", H5.H5Tis_variable_str(atype_id)); + } + catch (Exception err) { + if (atype_id > 0) + try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.testH5Awrite_readVL: " + err); + } + + try { + aspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(aspace_id > 0); + attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Awrite_readVL: ", attr_id >= 0); + + H5.H5AwriteVL(attr_id, atype_id, str_data); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) { + lsize *= dims[j]; + } + String[] strs = new String[(int) lsize]; + for (int j = 0; j < lsize; j++) { + strs[j] = ""; + } + try { + H5.H5AreadVL(attr_id, atype_id, strs); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5Awrite_readVL:", str_data[0].equals(strs[0])); + assertTrue("testH5Awrite_readVL:", str_data[1].equals(strs[1])); + assertTrue("testH5Awrite_readVL:", str_data[2].equals(strs[2])); + assertTrue("testH5Awrite_readVL:", str_data[3].equals(strs[3])); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5Awrite_readVL: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (aspace_id > 0) + try {H5.H5Sclose(aspace_id);} catch (Exception ex) {} + if (atype_id > 0) + try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_create_plist() { + String attr_name = "DATASET1"; + int char_encoding = 0; + long plist_id = -1; + long attribute_id = -1; + + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); + assertTrue(plist_id > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_create_plist: H5Pcreate " + err); + } + try { + // Get the character encoding and ensure that it is the default (ASCII) + try { + char_encoding = H5.H5Pget_char_encoding(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + + // Create an attribute for the dataset using the property list + try { + attribute_id = H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Aget_create_plist: H5Acreate", attribute_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate: " + err); + } + + /* Close the property list, and get the attribute's property list */ + H5.H5Pclose(plist_id); + plist_id = H5.H5Aget_create_plist(attribute_id); + assertTrue(plist_id > 0); + + /* Get the character encoding and ensure that it is the default (ASCII) */ + try { + char_encoding = H5.H5Pget_char_encoding(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_create_plist " + err); + } + finally { + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aiterate() { + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + class idata { + public String attr_name = null; + idata(String name) { + this.attr_name = name; + } + } + class H5A_iter_data implements H5A_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5A_iterate_t iter_data = new H5A_iter_data(); + class H5A_iter_callback implements H5A_iterate_cb { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + idata id = new idata(name); + ((H5A_iter_data)op_data).iterdata.add(id); + return 0; + } + } + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5A_iterate_cb iter_cb = new H5A_iter_callback(); + try { + H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aiterate: " + err); + } + assertFalse("H5Aiterate ",((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1")==0); + assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); + assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3")==0); + assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name.compareToIgnoreCase("attribute4")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aiterate: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aiterate_by_name() { + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + class idata { + public String attr_name = null; + idata(String name) { + this.attr_name = name; + } + } + class H5A_iter_data implements H5A_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5A_iterate_t iter_data = new H5A_iter_data(); + class H5A_iter_callback implements H5A_iterate_cb { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + idata id = new idata(name); + ((H5A_iter_data)op_data).iterdata.add(id); + return 0; + } + } + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5A_iterate_cb iter_cb = new H5A_iter_callback(); + try { + H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aiterate_by_name: " + err); + } + assertFalse("H5Aiterate_by_name ",((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate_by_name "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Aiterate_by_name "+((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aiterate: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + +} + + + diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java new file mode 100644 index 00000000000..9e359e24968 --- /dev/null +++ b/java/test/TestH5D.java @@ -0,0 +1,892 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.HDFNativeData; +import hdf.hdf5lib.callbacks.H5D_iterate_cb; +import hdf.hdf5lib.callbacks.H5D_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5D { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + 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 H5dtid = -1; + long H5did = -1; + long H5did0 = -1; + long H5dcpl_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + // Values for the status of space allocation + enum H5D_space_status { + H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED( + 1), H5D_SPACE_STATUS_ALLOCATED(2); + + private int code; + + H5D_space_status(int space_status) { + this.code = space_status; + } + + public int getCode() { + return this.code; + } + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} + catch (SecurityException e) {} + } + } + + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + + try { + H5dcpl_id = H5.H5Pcreate(dcpl_val); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Pcreate: " + err); + } + assertTrue("testH5D._createPDataset: H5.H5Pcreate: ", H5dcpl_id >= 0); + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + H5.H5Pset_alloc_time(H5dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + H5did0 = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, H5dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createPDataset.H5Dcreate: ", H5did0 >= 0); + } + + private final void _createDataset(long fid, long dsid, String name, long dapl) { + try { + H5did = 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("TestH5D._createDataset.H5Dcreate: ", H5did >= 0); + } + + private final void _createVLDataset(long fid, long dsid, String name, long dapl) { + try { + H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Tcopy: " + err); + } + assertTrue("TestH5D._createVLDataset.H5Tcopy: ", H5dtid >= 0); + try { + H5.H5Tset_size(H5dtid, HDF5Constants.H5T_VARIABLE); + assertTrue("TestH5D._createVLDataset.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Tset_size: " + err); + } + try { + H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createVLDataset.H5Dcreate: ", H5did >= 0); + } + + private final void _closeH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + if (H5did0 >= 0) + try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dtid > 0) + try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + + private final void _openH5file(String name, long dapl) { + try { + H5fid = H5.H5Fopen(H5_FILE, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, name, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Dopen: ",H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(RANK, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D.createH5file: " + err); + } + assertTrue("TestH5D.createH5file: H5.H5Fcreate: ",H5fid >= 0); + assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + if (H5did0 >= 0) + try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dtid > 0) + try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Dcreate() { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dcreate: " + err); + } + assertTrue(dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dcreate_anon() { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, + H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dcreate_anon: " + err); + } + assertTrue(dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dopen() { + long dataset_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Dclose(H5did); + H5did = -1; + dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dopen: " + err); + } + assertTrue("testH5Dopen: ", dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dget_storage_size_empty() { + long storage_size = 0; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + storage_size = H5.H5Dget_storage_size(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_storage_size: " + err); + } + assertTrue("testH5Dget_storage_size: ", storage_size == 0); + } + + @Test + public void testH5Dget_storage_size() { + long storage_size = 0; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int FILLVAL = 99; + _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(); + } + + try { + storage_size = H5.H5Dget_storage_size(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_storage_size: " + err); + } + assertTrue("testH5Dget_storage_size: "+storage_size, storage_size == DIM_X*DIM_Y*4); + } + + @Test + public void testH5Dget_access_plist() { + long dapl_id = -1; + int pequal = -1; + long test_dapl_id = -1; + + try { + test_dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_access_plist: H5.H5Pcreate: " + err); + } + assertTrue("testH5Dget_access_plist: test_dapl_id: ", test_dapl_id >= 0); + + _createDataset(H5fid, H5dsid, "dset", test_dapl_id); + + try { + dapl_id = H5.H5Dget_access_plist(H5did); + assertTrue("testH5Dget_access_plist: dapl_id: ", dapl_id >= 0); + pequal = H5.H5Pequal(dapl_id, test_dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_access_plist: H5.H5Dget_access_plist: " + err); + } + + // End access to the dataset and release resources used by it. + try { + if (dapl_id >= 0) + H5.H5Pclose(dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + } + try { + if (test_dapl_id >= 0) + H5.H5Pclose(test_dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + } + assertTrue("testH5Dget_access_plist: ", pequal > 0); + } + + @Test + public void testH5Dget_space_status() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int space_status = -1; + int space_status0 = -1; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + _createPDataset(H5fid, H5dsid, "dset0", HDF5Constants.H5P_DATASET_CREATE); + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + // Retrieve and print space status and storage size for dset0. + try { + space_status0 = H5.H5Dget_space_status(H5did0); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ", space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + + // Retrieve and print space status and storage size for dset. + try { + space_status = H5.H5Dget_space_status(H5did); + } + catch (Exception e) { + e.printStackTrace(); + } + assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset. + try { + space_status = H5.H5Dget_space_status(H5did); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_closed() throws Throwable { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D.testH5Dget_space_closed: ", dataset_id >= 0); + H5.H5Dclose(dataset_id); + + H5.H5Dget_space(dataset_id); + } + + @Test + public void testH5Dget_space() { + long dataspace_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + dataspace_id = H5.H5Dget_space(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_space: " + err); + } + assertTrue("TestH5D.testH5Dget_space: ", dataspace_id >= 0); + + // End access to the dataspace and release resources used by it. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_type_closed() throws Throwable { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D.testH5Dget_type_closed: ", dataset_id >= 0); + H5.H5Dclose(dataset_id); + + H5.H5Dget_type(dataset_id); + } + + @Test + public void testH5Dget_type() { + long datatype_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + datatype_id = H5.H5Dget_type(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_type: " + err); + } + assertTrue("TestH5D.testH5Dget_type: ", datatype_id >= 0); + + // End access to the datatype and release resources used by it. + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dget_offset() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + long dset_address = 0; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + // Test dataset address. Should be undefined. + dset_address = H5.H5Dget_offset(H5did); + } + catch (HDF5LibraryException hdfex) { + ; + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_offset: " + err); + } + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + // Test dataset address. + dset_address = H5.H5Dget_offset(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_offset: " + err); + } + + assertTrue("TestH5D.testH5Dget_offset: ", dset_address >= 0); + } + + @Test + public void testH5Dfill_null() { + int[] buf_data = new int[DIM_X*DIM_Y]; + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(null, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dfill: " + err); + } + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0); + } + + @Test + public void testH5Dfill() { + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(254); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dfill: " + err); + } + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 254); + } + + @Test + public void testH5Diterate() { + final int SPACE_RANK = 2; + final int SPACE_FILL = 254; + + class H5D_iter_data implements H5D_iterate_t { + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ + } + + H5D_iterate_t iter_data = new H5D_iter_data(); + + class H5D_iter_callback implements H5D_iterate_cb { + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { + //Check value in current buffer location + int element = HDFNativeData.byteToInt(elem_buf, 0); + if(element != ((H5D_iter_data)op_data).fill_value) + return -1; + //Check number of dimensions + if(ndim != SPACE_RANK) + return(-1); + //Check Coordinates + long[] fill_coords = new long[2]; + fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + ((H5D_iter_data)op_data).fill_curr_coord++; + if(fill_coords[0] != point[0]) + return(-1); + if(fill_coords[1] != point[1]) + return(-1); + + return(0); + } + } + + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + + // Initialize the iterator structure + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_curr_coord = 0; + // Set the coordinates of the selection + ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + } /* end for */ + + // Iterate through selection, verifying correct data + H5D_iterate_cb iter_cb = new H5D_iter_callback(); + int op_status = -1; + try { + op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + assertTrue("H5Diterate ", op_status == 0); + } + + @Test + public void testH5Diterate_write() { + final int SPACE_RANK = 2; + final int SPACE_FILL = 254; + + class H5D_iter_data implements H5D_iterate_t { + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ + } + + H5D_iterate_t iter_data = new H5D_iter_data(); + + class H5D_iter_callback implements H5D_iterate_cb { + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { + //Check value in current buffer location + int element = HDFNativeData.byteToInt(elem_buf, 0); + if(element != ((H5D_iter_data)op_data).fill_value) + return -1; + //Check number of dimensions + if(ndim != SPACE_RANK) + return(-1); + //Check Coordinates + long[] fill_coords = new long[2]; + fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + ((H5D_iter_data)op_data).fill_curr_coord++; + if(fill_coords[0] != point[0]) + return(-1); + if(fill_coords[1] != point[1]) + return(-1); + element -= 128; + byte[] new_elembuf = HDFNativeData.intToByte(element); + elem_buf[0] = new_elembuf[0]; + elem_buf[1] = new_elembuf[1]; + elem_buf[2] = new_elembuf[2]; + elem_buf[3] = new_elembuf[3]; + return(0); + } + } + + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + + // Initialize the iterator structure + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_curr_coord = 0; + // Set the coordinates of the selection + ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + } /* end for */ + + // Iterate through selection, verifying correct data + H5D_iterate_cb iter_cb = new H5D_iter_callback(); + int op_status = -1; + try { + op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + assertTrue("H5Diterate ", op_status == 0); + + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Diterate: [" + indx+","+jndx + "] "+buf_data[(indx * DIM_Y) + jndx], buf_data[(indx * DIM_Y) + jndx] == 126); + } + + @Test + public void testH5Dvlen_get_buf_size() { + String[] str_data = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + long vl_size = -1; /* Number of bytes used */ + long str_data_bytes = 0; + for (int idx = 0; idx < str_data.length; idx++) + str_data_bytes += str_data[idx].length() + 1; //Account for terminating null + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + vl_size = H5.H5Dvlen_get_buf_size(H5did, H5dtid, H5dsid); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("H5Dvlen_get_buf_size " + vl_size + " == " + str_data_bytes, vl_size == str_data_bytes); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Dvlen_read_invalid_buffer() throws Throwable { + String[] str_data = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + byte[] read_data = new byte[512]; + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + H5.H5Dread(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_data); + } + + @Test + public void testH5Dvlen_write_read() { + String[] str_wdata = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + String[] str_rdata = new String[DIM_X * DIM_Y]; + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_wdata); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dread_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_rdata); + } + catch (Exception e) { + e.printStackTrace(); + } + for (int v = 0; v < DIM_X * DIM_Y; v++) + assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v], str_wdata[v] == str_wdata[v]); + } + +} diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java new file mode 100644 index 00000000000..f0560278541 --- /dev/null +++ b/java/test/TestH5Dparams.java @@ -0,0 +1,134 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Dparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Dclose_invalid() throws Throwable { + long did = H5.H5Dclose(-1); + assertTrue(did == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Dcreate_null() throws Throwable { + H5.H5Dcreate(-1, null, 0, 0, 0, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dcreate_invalid() throws Throwable { + H5.H5Dcreate(-1, "Bogus", -1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dcreate_anon_invalid() throws Throwable { + H5.H5Dcreate_anon(-1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_access_plist_invalid() throws Throwable { + H5.H5Dget_access_plist(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_create_plist_invalid() throws Throwable { + H5.H5Dget_create_plist(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_offset_invalid() throws Throwable { + H5.H5Dget_offset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_invalid() throws Throwable { + H5.H5Dget_space(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_type_invalid() throws Throwable { + H5.H5Dget_type(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_status_invalid() throws Throwable { + int status = H5.H5Dget_space_status(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dset_extent_status_invalid() throws Throwable { + long[] size = new long[2]; + H5.H5Dset_extent(-1, size); + } + + @Test(expected = NullPointerException.class) + public void testH5Dset_extent_status_null() throws Throwable { + H5.H5Dset_extent(-1, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Dopen_null() throws Throwable { + H5.H5Dopen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dopen_invalid() throws Throwable { + H5.H5Dopen(-1, "Bogus", 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dvlen_get_buf_size_invalid() throws Throwable { + H5.H5Dvlen_get_buf_size(-1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dvlen_reclaim_invalid() throws Throwable { + byte[] buf = new byte[2]; + H5.H5Dvlen_reclaim(-1, -1, -1, buf); + } + + @Test(expected = NullPointerException.class) + public void testH5Dvlen_reclaim_null() throws Throwable { + H5.H5Dvlen_reclaim(-1, -1, -1, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Dget_storage_size_invalid() throws Throwable { + H5.H5Dget_storage_size(-1); + } + +} diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java new file mode 100644 index 00000000000..eb1669fd752 --- /dev/null +++ b/java/test/TestH5Dplist.java @@ -0,0 +1,216 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Dplist { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + private static final int RANK = 2; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5dcpl_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long[] H5extdims = { EDIM_X, EDIM_Y }; + long[] H5chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] H5maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + try { + H5dcpl_id = H5.H5Pcreate(dcpl_val); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Pcreate: " + err); + } + assertTrue("TestH5Dplist._createPDataset: ", H5dcpl_id > 0); + + // Set the chunk size. + try { + H5.H5Pset_chunk(H5dcpl_id, NDIMS, H5chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the fill value for the dataset + try { + int[] fill_value = { FILLVAL }; + H5.H5Pset_fill_value(H5dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + H5.H5Pset_alloc_time(H5dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + _createDataset(H5fid, H5dsid, "dset", H5dcpl_id, HDF5Constants.H5P_DEFAULT); + } + + private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { + try { + H5did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, dcpl, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Dplist._createDataset: ",H5did > 0); + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(RANK, H5dims, H5maxdims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Dplist.createH5file: " + err); + } + assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + 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) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Dset_extent() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); + + // Read values from the dataset, which has not been written to yet. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99); + + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data back. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12); + + // Extend the dataset. + try { + H5.H5Dset_extent(H5did, H5extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read from the extended dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12); + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99); + } + +} diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java new file mode 100644 index 00000000000..028369dcb90 --- /dev/null +++ b/java/test/TestH5E.java @@ -0,0 +1,553 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.callbacks.H5E_walk_cb; +import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.structs.H5E_error2_t; + +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; + +public class TestH5E { + @Rule public TestName testname = new TestName(); + long hdf_java_classid = -1; + long current_stackid = -1; + + @Before + public void H5Eget_stack_class() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + hdf_java_classid = -1; + try { + hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", + "hdf-java", "2.5"); + current_stackid = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_stack_class: " + err); + } + } + + @After + public void H5Erestore_stack_class() { + try { + H5.H5Eunregister_class(hdf_java_classid); + hdf_java_classid = -1; + H5.H5Eclose_stack(current_stackid); + current_stackid = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Erestore_stack_class: " + err); + } + System.out.println(); + } + + @Test + public void testH5Eget_class_name() { + try { + String class_name = H5.H5Eget_class_name(hdf_java_classid); + assertNotNull("H5.H5Eget_class_name: " + class_name, class_name); + assertEquals("H5.H5Eget_class_name: ", "HDF-Java-Error", class_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_class_name: " + err); + } + } + + @Test + public void testH5Eprint2() { + try { + assertFalse(current_stackid < 0); + H5.H5Eprint2(current_stackid, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint2: " + err); + } + } + + @Ignore("Tested with create_msg_major[minor]") + public void testH5Eclose_msg() { + fail("Not yet implemented"); + } + + @Test(expected = NullPointerException.class) + public void testH5Ecreate_msg_name_null() throws Throwable { + H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null); + } + + @Test + public void testH5Ecreate_msg_major() { + try { + long err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MAJOR, "Error in Test"); + assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0); + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_msg_major: " + err); + } + } + + @Test + public void testH5Ecreate_msg_minor() { + try { + long err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MINOR, "Error in Test Function"); + assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0); + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_msg_minor: " + err); + } + } + + @Test + public void testH5Eget_msg() { + int[] error_msg_type = { HDF5Constants.H5E_MINOR }; + long err_id = -1; + String msg = null; + try { + err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MAJOR, "Error in Test"); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertFalse("H5.H5Eget_msg: H5Ecreate_msg - " + err_id, err_id < 0); + try { + msg = H5.H5Eget_msg(err_id, error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Error in Test", msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, + error_msg_type[0]); + try { + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Eget_msg_major() { + + try { + H5.H5Fopen("test", 0, 1); + } + catch (HDF5LibraryException hdferr) { + int[] error_msg_type = { HDF5Constants.H5E_MAJOR }; + String msg = null; + try { + msg = H5.H5Eget_msg(hdferr.getMajorErrorNumber(), + error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Invalid arguments to routine", + msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, + error_msg_type[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Eget_msg_minor() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (HDF5LibraryException hdferr) { + int[] error_msg_type = { HDF5Constants.H5E_MINOR }; + String msg = null; + try { + msg = H5.H5Eget_msg(hdferr.getMinorErrorNumber(), + error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Inappropriate type", msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, + error_msg_type[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Ecreate_stack() { + long stk_id = -1; + try { + stk_id = H5.H5Ecreate_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + assertFalse("H5.H5Ecreate_stack: " + stk_id, stk_id < 0); + try { + H5.H5Eclose_stack(stk_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + } + + @Test + public void testH5Epop() { + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); + + try { + H5.H5Epop(current_stackid, 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop", num_msg == 2); + } + + @Test + public void testH5Epush() { + String err_func = "testH5Epush"; + String err_msg = "Error message"; + long estack_id = -1; + long maj_err_id = -1; + long min_err_id = -1; + long num_msg = -1; + + try { + try { + maj_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test"); + assertFalse("testH5Epush: H5.H5Ecreate_msg_major: " + maj_err_id, maj_err_id < 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_msg_major: " + err); + } + try { + min_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); + assertFalse("H5.H5Ecreate_msg_minor: " + min_err_id, min_err_id < 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_msg_minor: " + err); + } + + try { + estack_id = H5.H5Ecreate_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_stack: " + err); + } + assertFalse("testH5Epush: H5.H5Ecreate_stack: " + estack_id, estack_id < 0); + + try { + num_msg = H5.H5Eget_num(estack_id); + assertTrue("testH5Epush #:" + num_msg, num_msg == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Eget_num: " + err); + } + + H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id, err_msg); + + try { + num_msg = H5.H5Eget_num(estack_id); + assertTrue("testH5Epush #:" + num_msg, num_msg == 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Eget_num: " + err); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: " + err); + } + finally { + if (estack_id >= 0) + try {H5.H5Eclose_stack(estack_id);} catch (Exception ex) {} + if (maj_err_id >= 0) + try {H5.H5Eclose_msg(maj_err_id);} catch (Exception ex) {} + if (min_err_id >= 0) + try {H5.H5Eclose_msg(min_err_id);} catch (Exception ex) {} + } + } /* end test_create() */ + + @Test + public void testH5EprintInt() { + assertFalse(current_stackid < 0); + try { + H5.H5Eprint2(current_stackid, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } + + @Test + public void testH5EclearInt() { + try { + H5.H5Eclear(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EclearInt: " + err); + } + } + + @Test + public void testH5Eclear2() { + try { + H5.H5Eclear2(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2: " + err); + } + } + + @Test + public void testH5Eauto_is_v2() { + boolean is_v2 = false; + try { + is_v2 = H5.H5Eauto_is_v2(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eauto_is_v2: " + err); + } + assertTrue("H5.H5Eauto_is_v2: ", is_v2); + } + + @Test + public void testH5Eget_num() { + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num: " + err); + } + assertTrue("H5.H5Eget_num", num_msg == 0); + } + + @Test + public void testH5Eget_num_with_msg() { + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + } + + @Test + public void testH5Ewalk() { + class wdata { + public String err_desc = null; + public String func_name = null; + public int line = -1; + wdata(String desc, String func, int lineno) { + this.err_desc = new String(desc); + this.func_name = new String(func); + this.line = lineno; + } + } + class H5E_walk_data implements H5E_walk_t { + public ArrayList walkdata = new ArrayList(); + } + H5E_walk_t walk_data = new H5E_walk_data(); + class H5E_walk_callback implements H5E_walk_cb { + public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data) { + wdata wd = new wdata(info.desc, info.func_name, info.line); + ((H5E_walk_data)op_data).walkdata.add(wd); + return 0; + } + } + H5E_walk_cb walk_cb = new H5E_walk_callback(); + long num_msg = -1; + + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Eset_current_stack " + err); + } + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Eget_num " + err); + } + assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); + + try { + H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Ewalk2 " + err); + } + assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==3); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line==3767); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line==5506); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name.compareToIgnoreCase("H5P_verify_apl_and_dxpl")==0); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc.compareToIgnoreCase("not a property list")==0); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc.compareToIgnoreCase("not the required access property list")==0); + } + +} diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java new file mode 100644 index 00000000000..510aa2f4445 --- /dev/null +++ b/java/test/TestH5Edefault.java @@ -0,0 +1,564 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Edefault { + @Rule public TestName testname = new TestName(); + + @Before + public void H5Eset_default_stack() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + // Clear any active stack messages + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5Eset_default_stack: " + err); + } + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eprint2_invalid_classid() throws Throwable { + H5.H5Eprint2(-1, null); + } + + @Test + public void testH5Eprint() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint: " + err); + } + } + + @Test + public void testH5Eget_current_stack() { + long num_msg = -1; + long num_msg_default = -1; + long stack_id = -1; + long stack_id_default = HDF5Constants.H5E_DEFAULT; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //default stack id will be different after exception + stack_id_default = HDF5Constants.H5E_DEFAULT; + //err.printStackTrace(); //This will clear the error stack + } + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(stack_id_default); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Save a copy of the current stack and clears the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id == stack_id_default); + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(stack_id_default); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 0); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + + try { + H5.H5Eclose_stack(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + } + + @Test + public void testH5Eget_current_stack_pop() { + long num_msg = -1; + long num_msg_default = -1; + long stack_id = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Save a copy of the current stack and clears the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 0); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Generate errors on default stack + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Remove one message from the current stack + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, + num_msg_default == 2); + + //Verify the copy still has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclose_stack_invalid_stackid() throws Throwable { + H5.H5Eclose_stack(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_class_name_invalid_classid() throws Throwable { + H5.H5Eget_class_name(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_class_name_invalid_classname() throws Throwable { + H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclose_msg_invalid_errid() throws Throwable { + H5.H5Eclose_msg(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Ecreate_msg_invalid_errid() throws Throwable { + H5.H5Ecreate_msg(-1, HDF5Constants.H5E_MAJOR, "null"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_msg_invalid_msgid() throws Throwable { + H5.H5Eget_msg(-1, null); + } + + @Test + public void testH5Ecreate_stack() { + try { + long stack_id = H5.H5Ecreate_stack(); + assertTrue("H5.H5Ecreate_stack", stack_id > 0); + H5.H5Eclose_stack(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eset_current_stack_invalid_stkid() throws Throwable { + H5.H5Eset_current_stack(-1); + } + + @Test + public void testH5Eset_current_stack() { + long num_msg = -1; + long stack_id = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Save a copy of the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertFalse("H5.H5Eset_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eset_current_stack: get_current_stack - " + + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Generate errors on default stack + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Remove one message from the current stack + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, + num_msg == 2); + + //Verify the copy still has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + try { + H5.H5Eset_current_stack(stack_id); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, + num_msg == 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Epop_invalid_stkid() throws Throwable { + H5.H5Epop(-1, 0); + } + + @Test + public void testH5Epop() throws Throwable { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 3); + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 2); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Epush_invalid_stkid() throws Throwable { + H5.H5Epush(-1, "Invalid", "Invalid", 0, -1, -1, -1, "Invalid message"); + } + + @Test(expected = NullPointerException.class) + public void testH5Epush_null_name() throws Throwable { + H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5EprintInt_invalid_classid() throws Throwable { + H5.H5Eprint2(-1, null); + } + + @Test + public void testH5EprintInt() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } + + @Test + public void testH5EclearInt() { + try { + H5.H5Eclear(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EclearInt: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclear2_invalid_stkid() throws Throwable { + H5.H5Eclear2(-1); + } + + @Test + public void testH5Eclear() { + try { + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2: " + err); + } + } + + @Test + public void testH5Eclear2_with_msg() { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2_with_msg: " + err); + } + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, + num_msg == 3); + try { + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2_with_msg: " + err); + } + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eauto_is_v2_invalid_stkid() throws Throwable { + H5.H5Eauto_is_v2(-1); + } + + @Test + public void testH5Eauto_is_v2() { + boolean is_v2 = false; + try { + is_v2 = H5.H5Eauto_is_v2(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eauto_is_v2: " + err); + } + assertTrue("H5.H5Eauto_is_v2: ", is_v2); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_num_invalid_stkid() throws Throwable { + H5.H5Eget_num(-1); + } + + @Test + public void testH5Eget_num() { + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num: " + err); + } + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); + } + + @Test + public void testH5Eget_num_with_msg() { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num_with_msg: " + err); + } + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + } + +} diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java new file mode 100644 index 00000000000..13e0ca26103 --- /dev/null +++ b/java/test/TestH5Eregister.java @@ -0,0 +1,78 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Eregister { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_cls_name_null() throws Throwable { + H5.H5Eregister_class(null, "libname", "version"); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_lib_name_null() throws Throwable { + H5.H5Eregister_class("clsname", null, "version"); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_version_null() throws Throwable { + H5.H5Eregister_class("clsname", "libname", null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eunregister_class_invalid_classid() throws Throwable { + H5.H5Eunregister_class(-1); + } + + @Test + public void testH5Eregister_class() { + long hdf_java_classid = -1; + try { + hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", + "hdf-java", "2.5"); + } + catch (Throwable err) { + fail("H5.H5Eregister_class: " + err); + } + try { + H5.H5Eunregister_class(hdf_java_classid); + } + catch (Throwable err) { + fail("H5.H5Eunregister_class: " + err); + } + } +} diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java new file mode 100644 index 00000000000..3451187698c --- /dev/null +++ b/java/test/TestH5F.java @@ -0,0 +1,332 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5F { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + + private static final int COUNT_OBJ_FILE = 1; + private static final int COUNT_OBJ_DATASET = 0; + private static final int COUNT_OBJ_GROUP = 0; + private static final int COUNT_OBJ_DATATYPE = 0; + private static final int COUNT_OBJ_ATTR = 0; + private static final int COUNT_OBJ_ALL = (COUNT_OBJ_FILE + + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR); + private static final int[] OBJ_COUNTS = { COUNT_OBJ_FILE, + COUNT_OBJ_DATASET, COUNT_OBJ_GROUP, COUNT_OBJ_DATATYPE, + COUNT_OBJ_ATTR, COUNT_OBJ_ALL }; + private static final int[] OBJ_TYPES = { HDF5Constants.H5F_OBJ_FILE, + HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, + HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, + HDF5Constants.H5F_OBJ_ALL }; + long H5fid = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Fget_create_plist() { + long plist = -1; + + try { + plist = H5.H5Fget_create_plist(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_create_plist: " + err); + } + assertTrue(plist > 0); + try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fget_create_plist_closed() throws Throwable { + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // it should fail because the file was closed. + H5.H5Fget_create_plist(fid); + } + + @Test + public void testH5Fget_access_plist() { + long plist = -1; + + try { + plist = H5.H5Fget_access_plist(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_access_plist: " + err); + } + assertTrue(plist > 0); + try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fget_access_plist_closed() throws Throwable { + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // it should fail because the file was closed. + H5.H5Fget_access_plist(fid); + } + + @Test + public void testH5Fget_intent_rdwr() { + int intent = 0; + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + intent = H5.H5Fget_intent(fid); + } + catch (Throwable err) { + fail("H5.H5Fget_intent: " + err); + } + assertEquals(HDF5Constants.H5F_ACC_RDWR, intent); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_intent_rdonly() { + int intent = 0; + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + intent = H5.H5Fget_intent(fid); + } + catch (Throwable err) { + fail("H5.H5Fget_intent: " + err); + } + assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_obj_count() { + long count = -1; + + for (int i = 0; i < OBJ_TYPES.length; i++) { + try { + count = H5.H5Fget_obj_count(H5fid, OBJ_TYPES[i]); + } + catch (Throwable err) { + fail("H5.H5Fget_obj_count: " + err); + } + + assertEquals(count, OBJ_COUNTS[i]); + } + } + + @Test + public void testH5Fget_obj_ids() { + long count = 0; + long max_objs = 100; + long[] obj_id_list = new long[(int)max_objs]; + int[] open_obj_counts = new int[OBJ_TYPES.length]; + + for (int i = 0; i < OBJ_TYPES.length; i++) + open_obj_counts[i] = 0; + + open_obj_counts[0] = 1; + for (int i = 0; i < OBJ_TYPES.length - 1; i++) + open_obj_counts[OBJ_TYPES.length - 1] += open_obj_counts[i]; + + for (int i = 0; i < OBJ_TYPES.length; i++) { + try { + count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs, + obj_id_list); + } + catch (Throwable err) { + fail("H5.H5Fget_obj_ids: " + err); + } + assertEquals(count, open_obj_counts[i]); + } + } + /** + * TODO: need to add objects to the file after H5G[D,T]create() functions + * are implemented. + */ + // + // @Test + // public void testH5Fmount_unmount() { + // String file1 = "src.h5"; + // String file2 = "dst.h5"; + // String group1 = "/G"; + // String group2 = "/MOUNTED"; + // + // _createH5File(file1); + // _createH5File(file2); + // + // int fid1 = _openFile(file1, HDF5Constants.H5F_ACC_RDWR); + // assertTrue(fid1 > 0); + // + // int fid2 = _openFile(file2, HDF5Constants.H5F_ACC_RDWR); + // assertTrue(fid2 > 0); + // + // // create a group at file1 + // int gid = _createGroup(fid1, group1); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // create a group at file 2 + // gid = _createGroup(fid2, group2); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // before mount, "/G/MOUNTED" does not exists in file1 + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid < 0); + // + // // Mount file2 under G in the file1 + // try { + // H5.H5Fmount(fid1, group1, fid2, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // fail("H5.H5Fmount: "+err); + // } + // + // // now file1 should have group "/G/MOUNTED" + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid > 0); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // unmount file2 from file1 + // try { + // H5.H5Funmount(fid1, group1); + // } + // catch (Throwable err) { + // fail("H5.H5Funmount: "+err); + // } + // + // // file2 was unmounted from file1, "/G/MOUNTED" does not exists in file1 + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid < 0); + // + // try { H5.H5Fclose(fid1); } catch (Exception ex) {} + // try { H5.H5Fclose(fid2); } catch (Exception ex) {} + // + // _deleteFile(file1); + // _deleteFile(file2); + // } +} diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java new file mode 100644 index 00000000000..c08daffd7f5 --- /dev/null +++ b/java/test/TestH5Fbasic.java @@ -0,0 +1,320 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Fbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final String TXT_FILE = "test.txt"; + long H5fid = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Fcreate() { + assertTrue(H5fid > 0); + } + + @Test + public void testH5Fis_hdf5() { + boolean isH5 = false; + + try { + isH5 = H5.H5Fis_hdf5(H5_FILE); + } + catch (Throwable err) { + fail("H5.H5Fis_hdf5 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, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fopen_read_only() throws Throwable { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // set the file to read-only + File file = new File(H5_FILE); + if (file.setWritable(false)) { + // this should fail. + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + else { + fail("File.setWritable(true) failed."); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Freopen_closed() throws Throwable { + long fid = -1; + long fid2 = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // should fail because the file was closed. + fid2 = H5.H5Freopen(fid); + } + + @Test + public void testH5Freopen() { + long fid = -1; + long fid2 = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fid2 = H5.H5Freopen(fid); + } + catch (Throwable err) { + fail("H5.H5Freopen: " + err); + } + assertTrue(fid2 > 0); + + try { + H5.H5Fclose(fid2); + } + catch (Exception ex) { + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fclose() { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Throwable err) { + fail("H5.H5Fclose: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fclose_twice() throws Throwable { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Throwable err) { + fail("H5.H5Fclose: " + err); + } + + // it should fail since the file was closed. + H5.H5Fclose(fid); + } + + @Test + public void testH5Fget_freespace() { + long freeSpace = 0; + + try { + freeSpace = H5.H5Fget_freespace(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_freespace: " + err); + } + assertEquals(freeSpace, 0); + } + + // TODO add/and delete objects and test freespace + + @Test + public void testH5Fget_filesize() { + long fileSize = 0; + + try { + fileSize = H5.H5Fget_filesize(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_freespace: " + err); + } + assertTrue(fileSize > 0); + } + + // TODO add/and delete objects and test freespace + + @Test + public void testH5Fget_mdc_hit_rate() { + double rate; + + try { + rate = H5.H5Fget_mdc_hit_rate(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_mdc_hit_rate: " + err); + } + } + + @Test + public void testH5Fget_mdc_size() { + int nentries = -1; + long cache_sizes[] = new long[3]; + + try { + nentries = H5.H5Fget_mdc_size(H5fid, cache_sizes); + } + catch (Throwable err) { + fail("H5.H5Fget_mdc_size: " + err); + } + assertTrue("H5.H5Fget_mdc_size #:" + nentries, nentries == 4); + } + + // TODO: test more cases of different cache sizes. + + @Test + public void testH5Freset_mdc_hit_rate_stats() { + + try { + H5.H5Freset_mdc_hit_rate_stats(H5fid); + } + catch (Throwable err) { + fail("H5.H5Freset_mdc_hit_rate_stats: " + err); + } + } + + @Test + public void testH5Fget_name() { + String fname = null; + + try { + fname = H5.H5Fget_name(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_name: " + err); + } + assertNotNull(fname); + assertEquals(fname, H5_FILE); + } + + @Test + public void testH5Fclear_elink_file_cache() { + + try { + H5.H5Fclear_elink_file_cache(H5fid); + } + catch (Throwable err) { + fail("H5.H5Freset_mdc_hit_rate_stats: " + err); + } + } +} diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java new file mode 100644 index 00000000000..2d67f3d79e1 --- /dev/null +++ b/java/test/TestH5Fparams.java @@ -0,0 +1,215 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5F_info2_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Fparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = NullPointerException.class) + public void testH5Fcreate_null() throws Throwable { + H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Fopen_null() throws Throwable { + H5.H5Fopen(null, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Fis_hdf5_null() throws Throwable { + H5.H5Fis_hdf5(null); + } + + @Test(expected = NullPointerException.class) + public void testH5Fmount_null() throws Throwable { + H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Funmount_null() throws Throwable { + H5.H5Funmount(-1, null); + } + + @Test + public void testH5Fis_hdf5_text() { + File txtFile = null; + boolean isH5 = false; + + try { + txtFile = new File("test.txt"); + if (!txtFile.exists()) + txtFile.createNewFile(); + isH5 = H5.H5Fis_hdf5("test.txt"); + } + catch (Throwable err) { + fail("H5.H5Fis_hdf5 failed on test.txt: " + err); + } + + assertFalse(isH5); + + try { + txtFile.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Fclose_negative() throws Throwable { + // cannot close a file with negative id. + int fid = H5.H5Fclose(-1); + assertTrue(fid == 0); + } + + @Test + public void testH5Fcreate() { + long fid = -1; + File file = null; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (fid > 0) { + H5.H5Fclose(fid); + } + file = new File("test.h5"); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5Fflush_global() { + long fid = -1; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_GLOBAL); + } + catch (Throwable err) { + fail("H5.H5Fflush: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fflush_local() { + long fid = -1; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + fail("H5.H5Fflush: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_info() { + 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.H5Fopen: " + err); + } + + try { + H5F_info2_t finfo = H5.H5Fget_info(fid); + assertEquals(finfo.super_version, 0); + assertEquals(finfo.free_version, 0); + assertEquals(finfo.sohm_version, 0); + } + catch (Throwable err) { + fail("H5.H5Fget_info: " + err); + } + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + try {H5.H5Fclose(fid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java new file mode 100644 index 00000000000..32329bb5b95 --- /dev/null +++ b/java/test/TestH5G.java @@ -0,0 +1,505 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5G { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final String H5_FILE2 = "test2.h5"; + private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12", + "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" }; + private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; + long H5fid = -1; + long H5fid2 = -1; + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5G._createGroup: ", gid > 0); + + return gid; + } + + private final long _createGroup2(long fid, String name) { + long gid = -1; + long gcpl = -1; + try { + gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl + } + catch (final Exception ex) { + fail("H5.H5Pcreate(): " + ex); + } + assertTrue("TestH5G._createGroup2: ", gcpl >= 0); + try { + H5.H5Pset_link_creation_order(gcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order + } + catch (final Exception ex) { + try {H5.H5Pclose(gcpl);} catch (final Exception exx) {} + fail("H5.H5Pset_link_creation_order: " + ex); + } + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + finally { + try {H5.H5Pclose(gcpl);} catch (final Exception ex) {} + } + assertTrue("TestH5G._createGroup2: ", gid > 0); + + return gid; + } + + private final long _openGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + gid = -1; + err.printStackTrace(); + fail("H5.H5Gopen: " + err); + } + assertTrue("TestH5G._openGroup: ", gid > 0); + + return gid; + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + H5fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.createH5file: " + err); + } + assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0); + + long gid = -1; + + for (int i = 0; i < GROUPS.length; i++) { + gid = _createGroup(H5fid, GROUPS[i]); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + for (int i = 0; i < GROUPS2.length; i++) { + gid = _createGroup2(H5fid2, GROUPS2[i]); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + if (H5fid2 > 0) { + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + _deleteFile(H5_FILE2); + System.out.println(); + } + + @Test + public void testH5Gopen() { + long gid = -1; + for (int i = 0; i < GROUPS.length; i++) { + try { + gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gopen: H5.H5Gopen: " + err); + } + assertTrue("TestH5G.testH5Gopen: ", gid > 0); + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5Gget_create_plist() { + long gid = -1; + long pid = -1; + + for (int i = 0; i < GROUPS.length; i++) { + try { + gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_create_plist: H5.H5Gopen: " + err); + } + assertTrue("TestH5G.testH5Gget_create_plist: ", gid > 0); + + try { + pid = H5.H5Gget_create_plist(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_create_plist: H5.H5Gget_create_plist: " + err); + } + assertTrue("TestH5G.testH5Gget_create_plist: ", pid > 0); + + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5Gget_info() { + H5G_info_t info = null; + + for (int i = 0; i < GROUPS.length; i++) { + + try { + info = H5.H5Gget_info(H5fid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info: H5.H5Gget_info: " + err); + } + assertNotNull("TestH5G.testH5Gget_info: ", info); + } + } + + @Test + public void testH5Gget_info_by_name() { + H5G_info_t info = null; + + for (int i = 0; i < GROUPS.length; i++) { + try { + info = H5.H5Gget_info_by_name(H5fid, GROUPS[i], + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info_by_name: H5.H5Gget_info_by_name: " + err); + } + assertNotNull("TestH5G.testH5Gget_info_by_name: ", info); + } + } + + @Test + public void testH5Gget_info_by_idx() { + H5G_info_t info = null; + for (int i = 0; i < 2; i++) { + try { + info = H5.H5Gget_info_by_idx(H5fid, "/G1", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + i, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info_by_idx: H5.H5Gget_info_by_idx: " + err); + } + assertNotNull("TestH5G.testH5Gget_info_by_idx: ", info); + } + } + + @Test + public void testH5Gget_obj_info_all() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[0]); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + assertNotNull("TestH5G.testH5Gget_obj_info_all: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all: ", objNames[i].length() > 0); + } + } + + @Test + public void testH5Gget_obj_info_all_gid() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[0]); + + try { + info = H5.H5Gget_info(gid); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, + objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: ", objNames[i].length() > 0); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + } + + @Test + public void testH5Gget_obj_info_all_gid2() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[1]); + + try { + info = H5.H5Gget_info(gid); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, + objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: ", objNames[i].length() > 0); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + } + + @Test + public void testH5Gget_obj_info_max() { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length + 1; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; + long objRefs[] = new long[(int)groups_max_size]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, + objRefs, groups_max_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_max: H5.H5Gget_obj_info_max: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + // expected number does not include root group + assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found + "] different than expected[" + + (GROUPS.length - 1) + "]", names_found == (GROUPS.length - 1)); + for (int i = 0; i < GROUPS.length-1; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_max: name #"+i+" does not exist",objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length()>0); + } + } + + @Test + public void testH5Gget_obj_info_max_limit() { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length - 3; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; + long objRefs[] = new long[(int)groups_max_size]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, + objRefs, groups_max_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_max_limit: H5.H5Gget_obj_info_max: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found + "] different than expected[" + + groups_max_size + "]", names_found == groups_max_size); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_max_limit: ", objNames[i].length() > 0); + } + } + + @Test + public void testH5Gget_obj_info_all_byIndexType() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid2, GROUPS2[0]); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + assertNotNull("TestH5G.testH5Gget_obj_info_all_byIndexType: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_byIndexType: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + try { + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); + } + + assertEquals("G12",objNames[1]); + assertEquals("G13", objNames[2] ); + assertEquals("G11", objNames[3] ); + + try { + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); + } + + assertEquals("G12",objNames[1]); + assertEquals("G13", objNames[2] ); + assertEquals("G14", objNames[3] ); + } + +} diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java new file mode 100644 index 00000000000..70acef48c3d --- /dev/null +++ b/java/test/TestH5Gbasic.java @@ -0,0 +1,371 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Gbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + long H5fid = -1; + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + + return gid; + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Gclose_invalid() throws Throwable { + long gid = H5.H5Gclose(-1); + assertTrue(gid == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Gcreate_null() throws Throwable { + long gid = -1; + + // it should fail because the group name is null + gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gcreate_invalid() throws Throwable { + H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gcreate() { + long gid = -1; + try { + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gclose() { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + H5.H5Gclose(gid); + } + catch (Throwable err) { + fail("H5Gclose: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gcreate_exists() throws Throwable { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + // it should failed now because the group already exists in file + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gcreate_anon() { + long gid = -1; + try { + gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate_anon: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gopen_null() throws Throwable { + long gid = -1; + + gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gopen_invalid() throws Throwable { + H5.H5Gopen(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gopen_not_exists() throws Throwable { + long gid = -1; + + gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gopen() { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + gid = H5.H5Gopen(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gopen: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_create_plist_invalid() throws Throwable { + H5.H5Gget_create_plist(-1); + } + + @Test + public void testH5Gget_create_plist() { + long pid = -1; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + pid = H5.H5Gget_create_plist(gid); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_create_plist: " + err); + } + assertTrue(pid > 0); + + try {H5.H5Pclose(pid);} catch (Exception ex) {} + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_invalid() throws Throwable { + H5.H5Gget_info(-1); + } + + @Test + public void testH5Gget_info() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gget_info_by_name_null() throws Throwable { + H5.H5Gget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_name_invalid() throws Throwable { + H5.H5Gget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_name_not_exists() throws Throwable { + H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gget_info_by_name() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info_by_name: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gget_info_by_name_fileid() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info_by_name: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gget_info_by_idx_null() throws Throwable { + H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_idx_invalid() throws Throwable { + H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_idx_not_exists() throws Throwable { + H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L, + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gget_info_by_idx() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info_by_idx: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gget_info_by_idx_fileid() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + info = H5.H5Gget_info_by_idx(H5fid, "/", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info_by_idx: " + err); + } + assertNotNull(info); + } + +} diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java new file mode 100644 index 00000000000..17f594eac05 --- /dev/null +++ b/java/test/TestH5Giterate.java @@ -0,0 +1,136 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Giterate { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + long H5fid = -1; + + private final long _openGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + gid = -1; + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + + return gid; + } + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Gget_obj_info_all() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, "/"); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info: " + err); + } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + assertNotNull(info); + assertTrue("number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("name #" + i + " does not exist", objNames[i]); + assertTrue(objNames[i].length() > 0); + if (objTypes[i]==HDF5Constants.H5O_TYPE_GROUP) { + assertTrue("Group is index: "+i + " ",i==2); + assertTrue("Group is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("G1")==0); + } + else if (objTypes[i]==HDF5Constants.H5O_TYPE_DATASET) { + assertTrue("Dataset is index: "+i + " ",(i==0)||(i==3)); + if(i==0) + assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DS1")==0); + else + assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("L1")==0); + } + else if (objTypes[i]==HDF5Constants.H5O_TYPE_NAMED_DATATYPE) { + assertTrue("Datatype is index: "+i + " ",i==1); + assertTrue("Datatype is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DT1")==0); + } + else { + fail(" Unknown at index: " + i + " " + objNames[i]); + } + } + } + +} diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java new file mode 100644 index 00000000000..c35519e6249 --- /dev/null +++ b/java/test/TestH5Lbasic.java @@ -0,0 +1,371 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5L_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Lbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + long H5fid = -1; + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Lexists() { + boolean link_exists = false; + try { + link_exists = H5.H5Lexists(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertFalse("H5Lexists ",link_exists); + try { + link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertTrue("H5Lexists ",link_exists); + try { + link_exists = H5.H5Lexists(H5fid, "G1/DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertTrue("H5Lexists ",link_exists); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_not_exist() throws Throwable { + H5.H5Lget_info(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_info_dataset() { + H5L_info_t link_info = null; + try { + link_info = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ",link_info==null); + assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test + public void testH5Lget_info_hardlink() { + H5L_info_t link_info = null; + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ",link_info==null); + assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertTrue("Link Address ",link_info.address_val_size>0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_not_exist_name() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_not_exist_create() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_info_by_idx_n0() { + H5L_info_t link_info = null; + H5L_info_t link_info2 = null; + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ",link_info==null); + assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + try { + link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + } + + @Test + public void testH5Lget_info_by_idx_n3() { + H5L_info_t link_info = null; + H5L_info_t link_info2 = null; + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ",link_info==null); + assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + try { + link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_name_by_idx_not_exist() throws Throwable { + H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_name_by_idx_n0() { + String link_name = null; + try { + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_name_by_idx: " + err); + } + assertFalse("H5Lget_name_by_idx ",link_name==null); + assertTrue("Link Name ",link_name.compareTo("DS1")==0); + } + + @Test + public void testH5Lget_name_by_idx_n3() { + String link_name = null; + try { + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_name_by_idx: " + err); + } + assertFalse("H5Lget_name_by_idx ",link_name==null); + assertTrue("Link Name ",link_name.compareTo("L1")==0); + } + + @Test + public void testH5Lvisit() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit: " + err); + } + assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(3)).link_name,(((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(4)).link_name,(((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Lvisit_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit_by_name: " + err); + } + assertFalse("H5Lvisit_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Lvisit_by_name "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + } + + @Test + public void testH5Literate() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate: " + err); + } + assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Literate_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate_by_name: " + err); + } + assertFalse("H5Literate_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Literate_by_name "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + } + +} diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java new file mode 100644 index 00000000000..2fbd9e391c3 --- /dev/null +++ b/java/test/TestH5Lcreate.java @@ -0,0 +1,819 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5L_info_t; + +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; + +public class TestH5Lcreate { + @Rule public TestName testname = new TestName(); + private static final String H5_EXTFILE = "h5ex_g_iterate.hdf"; + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fcpl = -1; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + 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("TestH5L._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5L._createGroup: ",gid > 0); + + return gid; + } + + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_hard: " + err); + } + assertTrue("TestH5L._createHardLink ", link_exists); + } + + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_soft: " + err); + } + assertTrue("TestH5L._createSoftLink ", link_exists); + } + + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_external: " + err); + } + assertTrue("TestH5L._createExternalLink ", link_exists); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + H5fcpl, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5L.createH5file: " + err); + } + assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5L.createH5file: H5.H5Gcreate: ",H5gid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5gcpl > 0) + try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5fcpl > 0) + try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Lget_info_by_idx_n0_create() { + H5L_info_t link_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx_n0_create:H5Pget_link_creation_order " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ", link_info==null); + assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test + public void testH5Lget_info_by_idx_n1_create() { + H5L_info_t link_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx_n1_create:H5Pget_link_creation_order " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ", link_info==null); + assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_cur_not_exists() throws Throwable { + H5.H5Lcreate_hard(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lcreate_hard() { + try { + H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_hard:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_hard_link() { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_hard:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lcreate_soft() { + try { + H5.H5Lcreate_soft("DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_soft_dst_link_exists() throws Throwable { + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_soft("L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_soft_link() { + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_softlink() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_soft() { + String[] link_value = {null, null}; + int link_type = -1; + + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_value ", link_value[0]==null); + assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lcreate_soft_dangle() { + try { + H5.H5Lcreate_soft("DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Ldelete_soft_link_dangle() { + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_softlink_dangle() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_dangle() { + String[] link_value = {null,null}; + int link_type = -1; + + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L2", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_value ", link_value[0]==null); + assertTrue("Link Value ", link_value[0].compareTo("DS3")==0); + } + + @Test + public void testH5Lcreate_external() { + try { + H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_external:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_externallink() { + H5L_info_t link_info = null; + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_external(){ + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("H5Lget_value ", link_value[0]==null); + assertFalse("H5Lget_value ", link_value[1]==null); + assertTrue("Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_cur_not_exists() throws Throwable { + H5.H5Lcopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lcopy() { + try { + H5.H5Lcopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcopy:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Lcopy:H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_cur_not_exists() throws Throwable { + H5.H5Lmove(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lmove() { + try { + H5.H5Lmove(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lmove:H5Lexists ", link_exists); + link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lmove:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Lmove:H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lmove(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_not_exist_name() throws Throwable { + String[] link_value = {null,null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_not_exist_create() throws Throwable { + String[] link_value = {null,null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_value_by_idx_n2_name() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_n2 ",link_info==null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lget_value_by_idx_n2_create() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx_n2_create: H5Pget_link_creation_order " + err); + } + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_n2 ", link_info==null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lget_value_by_idx_external_name() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); + assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test + public void testH5Lget_value_by_idx_external_create() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); + assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_not_exist_name() throws Throwable { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_not_exist_create() throws Throwable { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_by_idx_n2_name() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (HDF5LibraryException err) { + link_info = null; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + } + + @Test + public void testH5Ldelete_by_idx_n2_create() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (HDF5LibraryException err) { + link_info = null; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + } + + @Test + public void testH5Lvisit_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit_create: H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit: " + err); + } + assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==6); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS")==0); + } + + @Test + public void testH5Literate_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate_create: H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate: " + err); + } + assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS")==0); + } + +} diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java new file mode 100644 index 00000000000..9a2c2040330 --- /dev/null +++ b/java/test/TestH5Lparams.java @@ -0,0 +1,231 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Lparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_invalid() throws Throwable { + H5.H5Lget_value(-1, "Bogus", null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_value_null() throws Throwable { + H5.H5Lget_value(-1, null, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lexists_invalid() throws Throwable { + H5.H5Lexists(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lexists_null() throws Throwable { + H5.H5Lexists(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_invalid() throws Throwable { + H5.H5Lget_info(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_info_null() throws Throwable { + H5.H5Lget_info(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_invalid() throws Throwable { + H5.H5Lget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_info_by_idx_null() throws Throwable { + H5.H5Lget_info_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_name_by_idx_invalid() throws Throwable { + H5.H5Lget_name_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_name_by_idx_null() throws Throwable { + H5.H5Lget_name_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_invalid() throws Throwable { + H5.H5Lcreate_hard(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_hard_null_current() throws Throwable { + H5.H5Lcreate_hard(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_hard_null_dest() throws Throwable { + H5.H5Lcreate_hard(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_invalid() throws Throwable { + H5.H5Ldelete(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ldelete_null() throws Throwable { + H5.H5Ldelete(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_soft_invalid() throws Throwable { + H5.H5Lcreate_soft( "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_soft_null_current() throws Throwable { + H5.H5Lcreate_soft(null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_soft_null_dest() throws Throwable { + H5.H5Lcreate_soft("Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_external_invalid() throws Throwable { + H5.H5Lcreate_external("PathToFile", "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_file() throws Throwable { + H5.H5Lcreate_external(null, "Bogus", 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_current() throws Throwable { + H5.H5Lcreate_external("PathToFile", null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_dest() throws Throwable { + H5.H5Lcreate_external("PathToFile", "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_invalid() throws Throwable { + H5.H5Lcopy(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcopy_null_current() throws Throwable { + H5.H5Lcopy(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcopy_null_dest() throws Throwable { + H5.H5Lcopy(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_invalid() throws Throwable { + H5.H5Lmove(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lmove_null_current() throws Throwable { + H5.H5Lmove(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lmove_null_dest() throws Throwable { + H5.H5Lmove(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_invalid() throws Throwable { + H5.H5Lget_value_by_idx(-1, "Bogus", -1, -1, -1L, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_value_by_idx_null() throws Throwable { + H5.H5Lget_value_by_idx(-1, null, 0, 0, 0L, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_invalid() throws Throwable { + H5.H5Ldelete_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ldelete_by_idx_null() throws Throwable { + H5.H5Ldelete_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_null() throws Throwable { + H5.H5Lvisit(-1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_by_name_nullname() throws Throwable { + H5.H5Lvisit_by_name(-1, null, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_by_name_null() throws Throwable { + H5.H5Lvisit_by_name(-1, "Bogus", -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_null() throws Throwable { + H5.H5Literate(-1, -1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_by_name_nullname() throws Throwable { + H5.H5Literate_by_name(-1, null, -1, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_by_name_null() throws Throwable { + H5.H5Literate_by_name(-1, "Bogus", -1, -1, -1, null, null, -1); + } + +} diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java new file mode 100644 index 00000000000..b564089fccb --- /dev/null +++ b/java/test/TestH5Obasic.java @@ -0,0 +1,488 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5O_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Obasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + private static long H5la_ds1 = -1; + private static long H5la_l1 = -1; + private static long H5la_dt1 = -1; + private static long H5la_g1 = -1; + long H5fid = -1; + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oopen_not_exists() throws Throwable { + long oid = -1; + + oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_dataset() { + long oid = -1; + H5O_info_t obj_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_hardlink() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_group() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_datatype() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_not_exist_name() throws Throwable { + H5.H5Oget_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_not_exists() throws Throwable { + H5.H5Oget_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_name_dataset() { + H5O_info_t obj_info = null; + + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_name_hardlink() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_name_group() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + } + + @Test + public void testH5Oget_info_by_name_datatype() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_not_exist_name() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_not_exist_create() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_idx_n0() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1); + } + + @Test + public void testH5Oget_info_by_idx_n3() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err); + } + H5la_l1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + } + + @Test + public void testH5Ovisit() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit: " + err); + } + assertFalse("H5Ovisit ",((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(2)).link_name,(((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(3)).link_name,(((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(4)).link_name,(((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2")==0); +// assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Ovisit_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit_by_name: " + err); + } + assertFalse("H5Ovisit_by_name ",((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit_by_name "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==2); + assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2")==0); + } + + @Test + public void testH5Oexists_by_name() { + boolean name_exists = false; + try { + name_exists = H5.H5Oexists_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oexists_by_name: " + err); + } + assertTrue("H5Oexists_by_name ", name_exists); + //TODO get dangling link result + } + + @Test + public void testH5Oopen_by_addr() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + } + assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null); + assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Oopen_by_idx_n0() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n0: H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Oopen_by_idx_n3() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err); + } + H5la_l1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n3:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java new file mode 100644 index 00000000000..62dd8868af6 --- /dev/null +++ b/java/test/TestH5Ocopy.java @@ -0,0 +1,365 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +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; + +public class TestH5Ocopy { + @Rule public TestName testname = new TestName(); + private static final String FILENAME = "testRefsattribute.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long H5dsid2 = -1; + long[] dims = { 2 }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + 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("TestH5O._createDataset: ",did >= 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5O._createGroup: ",gid >= 0); + + return gid; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); + H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(1, dims, null); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5O.createH5file: " + err); + } + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5dsid2 > 0) + try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(FILENAME); + System.out.println(); + } + + @Test + public void testH5OcopyRefsAttr() { + long ocp_plist_id = -1; + byte rbuf0[]=null , rbuf1[] = null; + byte[] dset_data = new byte[16]; + long attribute_id = -1; + + + try { + rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + //System.arraycopy(rbuf0, 0, dset_data, 0, 8); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Rcreate failed"); + } + + try { + attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0); + H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Awrite failed"); + } + finally { + try {H5.H5Aclose(attribute_id);} catch (Exception exx) {} + } + + try { + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsAttr.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Ocopy failed"); + } + finally { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5OcopyRefsDatasettodiffFile() { + byte rbuf1[] = null; + byte[] dset_data = new byte[16]; + long ocp_plist_id = -1; + long dataset_id = -1; + long H5fid2 = -1; + + try { + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + + dataset_id = H5.H5Dcreate(H5fid, "DSREF", + HDF5Constants.H5T_STD_REF_OBJ, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dclose(dataset_id); + } + catch (Exception ex) { + fail("testH5OcopyRefsDatasettodiffFile: create dataset failed"); + } + finally { + try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + } + + try { + //create new file + H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0); + H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Exception ex) { + try {H5.H5Fclose(H5fid2);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed"); + } + + try { + //create object copy property list id and set the flags. + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + + //Perform copy function. + H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception ex){ + ex.printStackTrace(); + fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed"); + } + finally { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + } + } + + @Test + public void testH5OcopyRefsDatasettosameFile() { + byte rbuf0[]=null , rbuf1[] = null; + byte[] dset_data = new byte[16]; + long ocp_plist_id = -1; + long dataset_id = -1; + long did = -1; + int obj_type = -1; + byte[] read_data = new byte[16]; + + try { + rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + System.arraycopy(rbuf0, 0, dset_data, 0, 8); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + + //Create a dataset and write object references to it. + dataset_id = H5.H5Dcreate(H5fid, "DSREF", + HDF5Constants.H5T_STD_REF_OBJ, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + //Close the dataset. + H5.H5Dclose(dataset_id); + } + catch (Exception ex) { + try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: create dataset failed"); + } + + try { + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + } + catch (Exception ex) { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed"); + } + + //Perform copy function. + try { + H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch(Exception ex) { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed"); + } + + //Open the dataset that has been copied + try { + did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0); + } + catch (Exception e) { + try {H5.H5Dclose(did);} catch (Exception exx) {} + e.printStackTrace(); + fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed"); + } + + try { + //Read the dataset object references in the read_data buffer. + H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data); + System.arraycopy(read_data, 0, rbuf0, 0, 8); + System.arraycopy(read_data, 8, rbuf1, 0, 8); + + //Get the type of object the reference points to. + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf0); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP); + } + catch (Exception ex) { + ex.printStackTrace(); + } + finally { + try {H5.H5Dclose(did);} catch (Exception ex) {} + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + } + } + +// @Ignore because of JIRA HDF5-9547 +// @Test(expected = HDF5LibraryException.class) +// public void testH5OcopyInvalidRef() throws Throwable { +// final long _pid_ = HDF5Constants.H5P_DEFAULT; +// long sid = -1; +// long did = -1; +// long aid = -1; +// +// try { +// sid = H5.H5Screate_simple(1, new long[] {1}, null); +// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0); +// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_); +// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0); +// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_); +// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0); +// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1}); +// } +// catch (Exception ex) { +// ex.printStackTrace(); +// } +// finally { +// try {H5.H5Dclose(did);} catch (Exception exx) {} +// try {H5.H5Aclose(aid);} catch (Exception exx) {} +// try {H5.H5Sclose(sid);} catch (Exception exx) {} +// } +// +// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); +// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0); +// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); +// try { +// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_); +// } +// finally { +// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} +// } +// } + +} diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java new file mode 100644 index 00000000000..0edecbaf0fa --- /dev/null +++ b/java/test/TestH5Ocreate.java @@ -0,0 +1,562 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5O_info_t; + +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; + +public class TestH5Ocreate { + @Rule public TestName testname = new TestName(); + private static final String H5_EXTFILE = "h5ex_g_iterate.hdf"; + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fcpl = -1; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + 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("TestH5O._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5O._createGroup: ",gid > 0); + + return gid; + } + + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_hard: " + err); + } + assertTrue("TestH5O._createHardLink ", link_exists); + } + + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_soft: " + err); + } + assertTrue("TestH5O._createSoftLink ", link_exists); + } + + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_external: " + err); + } + assertTrue("TestH5O._createExternalLink ", link_exists); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + H5fcpl, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5O.createH5file: " + err); + } + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5gcpl > 0) + try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5fcpl > 0) + try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_cur_not_exists() throws Throwable { + H5.H5Ocopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ocopy() { + try { + H5.H5Ocopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Ocopy:H5Lexists ",link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ocopy: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Ocopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_idx_n0_create() { + H5O_info_t obj_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx_n0:H5Pget_link_creation_order " + err); + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx: " + err); + } + assertFalse("H5Oget_info_by_idx ", obj_info==null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_idx_n1_create() { + H5O_info_t obj_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx_n1:H5Pget_link_creation_order " + err); + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx: " + err); + } + assertFalse("H5Oget_info_by_idx ", obj_info==null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + } + + @Test + public void testH5Oget_info_softlink() { + H5O_info_t obj_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("Link Address ", obj_info.addr>0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_softlink_dangle() throws Throwable { + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Oget_info_by_name(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_externallink() { + H5O_info_t obj_info = null; + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + assertTrue("Link Address ", obj_info.addr>0); + } + + @Test + public void testH5Olink() { + long oid = -1; + H5O_info_t obj_info = null; + H5O_info_t dst_obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + try { + H5.H5Olink(oid, H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Olink: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info object type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + + try { + dst_obj_info = H5.H5Oget_info_by_name(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_name: " + err); + } + assertFalse("H5Oget_info ", dst_obj_info==null); + assertTrue("H5Oget_info object type", dst_obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Ovisit_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit_create:H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit: " + err); + } + assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(), ((H5O_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); + } + + @Test + public void testH5Ocomment() { + long oid = -1; + String obj_comment = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + H5.H5Oset_comment(oid, "Test Comment"); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_comment: ", obj_comment==null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + } + + @Test + public void testH5Ocomment_clear() { + long oid = -1; + String obj_comment = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + H5.H5Oset_comment(oid, "Test Comment"); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + assertFalse("H5Oget_comment: ", obj_comment==null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + try { + H5.H5Oset_comment(oid, null); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertTrue("H5Oget_comment: ", obj_comment==null); + } + + @Test + public void testH5Ocomment_by_name() { + String obj_comment = null; + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertFalse("H5Oget_comment_by_name: ", obj_comment==null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + } + + @Test + public void testH5Ocomment_by_name_clear() { + String obj_comment = null; + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertFalse("H5Oget_comment_by_name: ", obj_comment==null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", null, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertTrue("H5Oget_comment_by_name: ", obj_comment==null); + } + + @Test + public void testH5Oinc_dec_count() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + try { + H5.H5Oincr_refcount(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oincr_refcount: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + try { + H5.H5Odecr_refcount(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Odecr_refcount: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + +} diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java new file mode 100644 index 00000000000..ced66f563ab --- /dev/null +++ b/java/test/TestH5Oparams.java @@ -0,0 +1,154 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +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; + +public class TestH5Oparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Oclose_invalid() throws Throwable { + long oid = H5.H5Oclose(-1); + assertTrue(oid == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Oopen_null() throws Throwable { + H5.H5Oopen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oopen_invalid() throws Throwable { + H5.H5Oopen(-1, "Bogus", 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_invalid() throws Throwable { + H5.H5Ocopy(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ocopy_null_current() throws Throwable { + H5.H5Ocopy(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Ocopy_null_dest() throws Throwable { + H5.H5Ocopy(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_invalid() throws Throwable { + H5.H5Oget_info(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_info_by_name_null() throws Throwable { + H5.H5Oget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_invalid() throws Throwable { + H5.H5Oget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_invalid() throws Throwable { + H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_info_by_idx_null() throws Throwable { + H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Olink_invalid() throws Throwable { + H5.H5Olink(-1, -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Olink_null_dest() throws Throwable { + H5.H5Olink(-1, 0, null, 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_null() throws Throwable { + H5.H5Ovisit(-1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_by_name_nullname() throws Throwable { + H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_by_name_null() throws Throwable { + H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oset_comment_invalid() throws Throwable { + H5.H5Oset_comment(-1, "Bogus"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Oget_comment_invalid() throws Throwable { + H5.H5Oget_comment(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oset_comment_by_name_invalid() throws Throwable { + H5.H5Oset_comment_by_name(-1, "Bogus", null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oset_comment_by_name_null() throws Throwable { + H5.H5Oset_comment_by_name(-1, null, null, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Oget_comment_by_name_invalid() throws Throwable { + H5.H5Oget_comment_by_name(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_comment_by_name_null() throws Throwable { + H5.H5Oget_comment_by_name(-1, null, -1); + } + +} diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java new file mode 100644 index 00000000000..2a0fc34fe93 --- /dev/null +++ b/java/test/TestH5P.java @@ -0,0 +1,1221 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5P { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long[] H5dims = { DIM_X, DIM_Y }; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long lapl_id = -1; + long fapl_id = -1; + long fcpl_id = -1; + long ocpl_id = -1; + long ocp_plist_id = -1; + long lcpl_id = -1; + long plapl_id = -1; + long plist_id = -1; + long gapl_id = -1; + long gcpl_id = -1; + long acpl_id = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + 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("TestH5P._createDataset: ", did > 0); + + return did; + } + + private final void _createH5File(long fcpl, long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + fcpl, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5P.createH5file: " + err); + } + assertTrue("TestH5P.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5P.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5P.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() throws HDF5LibraryException { + _deleteFile(H5_FILE); + } + + @Before + public void createH5fileProperties() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS); + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5P.createH5file: " + err); + } + assertTrue(lapl_id > 0); + assertTrue(fapl_id > 0); + assertTrue(fcpl_id > 0); + assertTrue(ocpl_id > 0); + assertTrue(ocp_plist_id > 0); + assertTrue(lcpl_id > 0); + assertTrue(plapl_id>0); + assertTrue(plist_id > 0); + assertTrue(gapl_id > 0); + assertTrue(gcpl_id >0); + assertTrue(acpl_id >0); + } + + @After + public void deleteH5fileProperties() throws HDF5LibraryException { + if (lapl_id >0) + try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + if (fapl_id >0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (fcpl_id >0) + try {H5.H5Pclose(fcpl_id);} catch (Exception ex) {} + if (ocpl_id >0) + try {H5.H5Pclose(ocpl_id);} catch (Exception ex) {} + if (ocp_plist_id >0) + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + if (lcpl_id >0) + try {H5.H5Pclose(lcpl_id);} catch (Exception ex) {} + if (plapl_id >0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (plist_id >0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (gapl_id >0) + try {H5.H5Pclose(gapl_id);} catch (Exception ex) {} + if (gcpl_id >0) + try {H5.H5Pclose(gcpl_id);} catch (Exception ex) {} + if (acpl_id >0) + try {H5.H5Pclose(acpl_id);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pget_nlinks() { + long nlinks = -1; + try { + nlinks = (long) H5.H5Pget_nlinks(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_nlinks: " + err); + } + assertTrue("testH5Pget_nlinks", nlinks > 0); + // Check the default value of nlinks. + assertEquals(nlinks, 16L); + } + + @Test + public void testH5Pset_nlinks() { + long nlinks = 20; + int ret_val = -1; + try { + ret_val = H5.H5Pset_nlinks(lapl_id, nlinks); + nlinks = (long) H5.H5Pget_nlinks(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pset_nlinks: " + err); + } + assertTrue("testH5Pset_nlinks", ret_val >= 0); + // Check the value of nlinks retrieved from H5Pget_nlinks function. + assertEquals(nlinks, 20L); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_libver_bounds_invalidlow() throws Throwable { + H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, 5); + } + + @Test + public void testH5Pget_link_creation_order() { + int crt_order_flags = 0; + try { + crt_order_flags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_creation_order: " + err); + } + assertTrue("testH5Pget_link_creation_order", crt_order_flags >= 0); + } + + @Test + public void testH5Pset_link_creation_order_trackedPLUSindexed() { + int ret_val = -1; + int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags); + crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_creation_order: " + err); + } + assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed",ret_val >= 0); + assertEquals(crt_order_flags, crtorderflags); + } + + @Test + public void testH5Pset_link_creation_order_tracked() { + int ret_val = -1; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_creation_order: " + err); + } + assertTrue("testH5Pset_link_creation_order_tracked",ret_val >= 0); + assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_link_creation_order_invalidvalue() throws Throwable { + H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + + @Test + public void testH5Pget_attr_creation_order() { + int crt_order_flags = 0; + + try { + crt_order_flags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_creation_order: " + err); + } + assertTrue("testH5Pget_attr_creation_order", crt_order_flags >= 0); + } + + @Test + public void testH5Pset_attr_creation_order_trackedPLUSindexed() { + int ret_val = -1; + int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags); + crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_creation_order: " + err); + } + assertTrue("testH5Pset_attr_creation_order_trackedPLUSindexed", ret_val >= 0); + assertEquals(crt_order_flags, crtorderflags); + } + + @Test + public void testH5Pset_attr_creation_order_tracked() { + int ret_val = -1; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_creation_order: " + err); + } + assertTrue("testH5Pset_attr_creation_order_tracked", ret_val >= 0); + assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable { + H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + + @Test + public void testH5Pset_copy_object() { + + int cpy_option = -1; + + try { + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG); + cpy_option = H5.H5Pget_copy_object(ocp_plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_copy_object: " + err); + } + assertEquals(HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG, cpy_option); + + try { + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + cpy_option = H5.H5Pget_copy_object(ocp_plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_copy_object: " + err); + } + assertEquals(HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG, cpy_option); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_copy_object_invalidobject() throws Throwable { + H5.H5Pset_copy_object(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG); + } + + @Test + public void testH5Pset_create_intermediate_group() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_create_intermediate_group(lcpl_id, true); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_create_intermediate_group: " + err); + } + assertTrue(ret_val>=0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable { + H5.H5Pset_create_intermediate_group(ocp_plist_id, true); + } + + @Test + public void testH5Pget_create_intermediate_group() { + boolean flag = false; + try { + H5.H5Pset_create_intermediate_group(lcpl_id, true); + flag = H5.H5Pget_create_intermediate_group(lcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_create_intermediate_group: " + err); + } + assertEquals(true, flag); + } + + @Test + public void testH5Pget_create_intermediate_group_notcreated() { + boolean flag = true; + try { + flag = H5.H5Pget_create_intermediate_group(lcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_create_intermediate_group_notcreated: " + err); + } + assertEquals(false, flag); + } + + @Test + public void testH5Pset_data_transform() { + + String expression = "(5/9.0)*(x-32)"; + int ret_val = -1; + + try { + ret_val= H5.H5Pset_data_transform(plist_id, expression); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_data_transform: " + err); + } + assertTrue(ret_val>=0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_data_transform_NullExpression() throws Throwable { + H5.H5Pset_data_transform(plist_id, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_data_transform_InvalidExpression1() throws Throwable { + H5.H5Pset_data_transform(plist_id, ""); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_data_transform_InvalidExpression2() throws Throwable { + H5.H5Pset_data_transform(plist_id, "hello"); + } + + @Test + public void testH5Pget_data_transform() { + + String expression = "(5/9.0)*(x-32)"; + String [] express = {""}; + long express_size = 0; + long size = 20; + + try { + H5.H5Pset_data_transform(plist_id, expression); + express_size = H5.H5Pget_data_transform(plist_id, express, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_data_transform: " + err); + } + assertTrue(express_size>=0); + assertTrue("The data transform expression: ", expression.equals(express[0])); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable { + String [] express = {""}; + H5.H5Pget_data_transform(plist_id, express, 20); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pget_data_transform_IllegalSize() throws Throwable { + String [] express = {""}; + H5.H5Pset_data_transform(plist_id, "(5/9.0)*(x-32)"); + H5.H5Pget_data_transform(plist_id, express, 0); + } + + @Test + public void testH5Pget_elink_acc_flags() { + + int get_flags = -1; + try { + get_flags = H5.H5Pget_elink_acc_flags(gapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_acc_flags: " + err); + } + assertTrue("H5Pget_elink_acc_flags", get_flags >= 0); + assertEquals(HDF5Constants.H5F_ACC_DEFAULT, get_flags); + } + + @Test + public void testH5Pset_elink_acc_flags() { + + int get_flags = -1; + int ret_val = -1; + try { + ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR); + get_flags = H5.H5Pget_elink_acc_flags(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_elink_acc_flags: " + err); + } + assertTrue("H5Pset_elink_acc_flags", ret_val >= 0); + assertEquals(HDF5Constants.H5F_ACC_RDWR, get_flags); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable { + H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable { + H5.H5Pset_elink_acc_flags(lapl_id, -1); + } + + @Test + public void testH5Pset_link_phase_change() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_link_phase_change(fcpl_id , 2, 2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_phase_change: " + err); + } + assertTrue("H5Pset_link_phase_change", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 70000000, 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 5, 6); + } + + @Test + public void testH5Pget_link_phase_change() { + int ret_val = -1; + int[] links = new int[2]; + + try { + ret_val = H5.H5Pget_link_phase_change(fcpl_id, links); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_phase_change: " + err); + } + assertTrue("testH5Pget_link_phase_change", ret_val >= 0); + assertEquals("Default value of maximum compact storage", 8, links[0]); + assertEquals("Default value of minimum dense storage", 6, links[1]); + } + + @Test + public void testH5Pget_link_phase_change_EqualsSet() { + int[] links = new int[2]; + try { + H5.H5Pset_link_phase_change(fcpl_id , 10, 7); + H5.H5Pget_link_phase_change(fcpl_id, links); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_phase_change_EqualsSet: " + err); + } + assertEquals("Value of maximum compact storage set", 10, links[0]); + assertEquals("Value of minimum dense storage set", 7, links[1]); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_link_phase_change_Null() throws Throwable { + H5.H5Pget_link_phase_change(fcpl_id, null); + } + + @Test + public void testH5Pget_attr_phase_change() { + int ret_val = -1; + int[] attributes = new int[2]; + + try { + ret_val = H5.H5Pget_attr_phase_change(ocpl_id, attributes); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_phase_change: " + err); + } + assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 8, attributes[0]); + assertEquals("Default value of the min. no. of attributes stored in dense storage", 6, attributes[1]); + try { + H5.H5Pset_attr_phase_change(ocpl_id, 9, 5); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_phase_change: " + err); + } + try { + ret_val = H5.H5Pget_attr_phase_change(ocpl_id, attributes); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_phase_change: " + err); + } + assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 9, attributes[0]); + assertEquals("Default value of the min. no. of attributes stored in dense storage", 5, attributes[1]); + } + + @Test + public void testH5Pget_shared_mesg_phase_change() { + int ret_val = -1; + int[] size = new int[2]; + + try { + ret_val = H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_phase_change: " + err); + } + assertTrue("testH5Pget_shared_mesg_phase_change", ret_val >= 0); + } + + @Test + public void testH5Pget_shared_mesg_phase_change_EqualsSET() { + int[] size = new int[2]; + + try { + H5.H5Pset_shared_mesg_phase_change(fcpl_id,50, 40); + H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_phase_change_EqualsSET: " + err); + } + assertEquals("Value of maximum list set", 50, size[0]); + assertEquals("Value of minimum btree set", 40, size[1]); + } + + @Test + public void testH5Pset_shared_mesg_phase_change() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id,2, 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_phase_change: " + err); + } + assertTrue("H5Pset_shared_mesg_phase_change", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable { + H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5001, 4000); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable { + H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5000, 5001); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 3, 7); + } + + @Test + public void testH5Pget_shared_mesg_nindexes() { + + int nindexes = -1; + try { + nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_nindexes: " + err); + } + assertTrue("H5Pget_shared_mesg_nindexes", nindexes >= 0); + } + + @Test + public void testH5Pset_shared_mesg_nindexes() { + + int nindexes = -1; + int ret_val = -1; + try { + ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); + nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_nindexes: " + err); + } + assertTrue("H5Pset_shared_mesg_nindexes", ret_val >= 0); + assertEquals("Value of nindexes is equal to value set",7 ,nindexes); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes()throws Throwable { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 9); + } + + @Test + public void testH5Pset_shared_mesg_index() { + + int ret_val = -1; + try { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); + ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_index: " + err); + } + assertTrue("H5Pset_shared_mesg_index", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable { + H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); + H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10); + } + + @Test + public void testH5Pget_shared_mesg_index() { + + int ret_val = -1; + int[] mesg_info = new int[2]; + try { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); + H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + ret_val = H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_index: " + err); + } + assertTrue("H5Pget_shared_mesg_index", ret_val >= 0); + assertEquals("Type of message", HDF5Constants.H5O_SHMESG_ATTR_FLAG, mesg_info[0]); + assertEquals("minimum message size", 10, mesg_info[1]); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable { + int[] mesg_info = new int[2]; + H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); + } + + @Test + public void testH5Pset_local_heap_size_hint() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_local_heap_size_hint(gcpl_id, 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_local_heap_size_hint: " + err); + } + assertTrue("H5Pset_local_heap_size_hint", ret_val >= 0); + } + + @Test + public void testH5Pget_local_heap_size_hint() { + long size_hint = -1; + try { + size_hint = H5.H5Pget_local_heap_size_hint(gcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_local_heap_size_hint: " + err); + } + assertTrue("H5Pget_local_heap_size_hint", size_hint >= 0); + } + + @Test + public void testH5Pset_nbit() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_nbit(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_nbit: " + err); + } + assertTrue("H5Pset_nbit", ret_val >= 0); + } + + @Test + public void testH5Pset_scaleoffset() { + int ret_val = -1; + int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE; + int scale_factor = HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT; + try { + ret_val = H5.H5Pset_scaleoffset(ocpl_id, scale_type, scale_factor); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_scaleoffset: " + err); + } + assertTrue("H5Pset_scaleoffset", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable { + H5.H5Pset_scaleoffset(ocpl_id, 3, 1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable { + H5.H5Pset_scaleoffset(ocpl_id, HDF5Constants.H5Z_SO_INT, -1); + } + + @Test + public void testH5Pset_est_link_info() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_est_link_info(gcpl_id, 0,10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_est_link_info: " + err); + } + assertTrue("H5Pset_est_link_info", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_est_link_info_InvalidValues() throws Throwable { + H5.H5Pset_est_link_info(gcpl_id, 100000,10); + } + + @Test + public void testH5Pget_est_link_info() { + int ret_val = -1; + int[] link_info = new int[2]; + try { + ret_val = H5.H5Pget_est_link_info(gcpl_id, link_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_est_link_info: " + err); + } + assertTrue("H5Pget_est_link_info", ret_val >= 0); + } + + @Test + public void testH5Pset_elink_prefix() { + int ret_val = -1; + String prefix = "tmp"; + try { + ret_val = H5.H5Pset_elink_prefix(plapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_est_link_info: " + err); + } + assertTrue("H5Pset_elink_prefix", ret_val >= 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_elink_prefix_null() throws Throwable{ + H5.H5Pset_elink_prefix(plapl_id, null); + } + + @Test + public void testH5Pget_elink_prefix() { + String prefix = "tmp"; + String[] pre = {""}; + long prefix_size = 0; + + try { + H5.H5Pset_elink_prefix(plapl_id, prefix); + prefix_size = H5.H5Pget_elink_prefix(plapl_id, pre); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_prefix: " + err); + } + assertTrue(prefix_size>=0); + assertTrue("The prefix: ", prefix.equals(pre[0])); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_elink_prefix_null() throws Throwable { + H5.H5Pget_elink_prefix(plapl_id, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_version_null() throws Throwable { + H5.H5Pget_version(fcpl_id, null); + } + + @Test + public void testH5Pget_version() { + int[] version_info = {255,255,255,255}; + + try { + _createH5File(fcpl_id, fapl_id); + H5.H5Pget_version(fcpl_id, version_info); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_version: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_userblock_null() throws Throwable { + H5.H5Pget_userblock(fcpl_id, null); + } + + @Test + public void testH5P_userblock() { + int[] version_info = {255,255,255,255}; + long[] size = {0}; + + try { + H5.H5Pset_userblock(fcpl_id, 1024); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_userblock(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_userblock: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("user block size: "+size[0], size[0] == 1024); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_sizes_null() throws Throwable { + H5.H5Pget_sizes(fcpl_id, null); + } + + @Test + public void testH5P_sizes() { + int[] version_info = {255,255,255,255}; + long[] size = {0,0}; + + try { + H5.H5Pset_sizes(fcpl_id, 4, 8); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_sizes(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sizes: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("sizeof_addr size: "+size[0], size[0] == 4); + assertTrue("sizeof_size size: "+size[1], size[1] == 8); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_sym_k_null() throws Throwable { + H5.H5Pget_sym_k(fcpl_id, null); + } + + @Test + public void testH5P_sym_k() { + int[] version_info = {255,255,255,255}; + int[] size = {0,0}; + + try { + H5.H5Pset_sym_k(fcpl_id, 32, 8); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_sym_k(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sym_k: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("symbol table tree rank: "+size[0], size[0] == 32); + assertTrue("symbol table node size: "+size[1], size[1] == 8); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_istore_k_null() throws Throwable { + H5.H5Pget_istore_k(fcpl_id, null); + } + + @Test + public void testH5P_istore_k() { + int[] version_info = {255,255,255,255}; + int[] size = {0}; + + try { + H5.H5Pset_istore_k(fcpl_id, 64); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_istore_k(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sym_k: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 1); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64); + } + + @Test + public void testH5P_obj_track_times() { + boolean default_ret_val = false; + boolean ret_val = true; + try { + default_ret_val = H5.H5Pget_obj_track_times(ocpl_id); + H5.H5Pset_obj_track_times(ocpl_id, false); + ret_val = H5.H5Pget_obj_track_times(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_obj_track_times: " + err); + } + assertTrue("H5Pget_obj_track_times default", default_ret_val); + assertFalse("H5Pget_obj_track_times", ret_val); + } + + @Test + public void testH5Pget_char_encoding() { + int char_encoding = 0; + + try { + char_encoding = H5.H5Pget_char_encoding(acpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Pget_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + try { + H5.H5Pset_char_encoding(acpl_id, HDF5Constants.H5T_CSET_UTF8); + char_encoding = H5.H5Pget_char_encoding(acpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Pget_char_encoding", char_encoding == HDF5Constants.H5T_CSET_UTF8); + } + + @Test + public void testH5P_fill_time() { + int[] fill_time = {0}; + + try { + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET); + H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_ALLOC); + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC); + H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_NEVER); + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fill_time: " + err); + } + } + + @Test + public void testH5P_alloc_time() { + int[] alloc_time = {0}; + + try { + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE); + H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY); + H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_INCR); + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_alloc_time: " + err); + } + } + + @Test + public void testH5P_fill_value() { + int[] fill_value = {-1}; + int[] fill_value_status = {-1}; + + try { + H5.H5Pfill_value_defined(ocpl_id, fill_value_status); + assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT); + H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + assertTrue("fill_value: "+fill_value[0], fill_value[0] == 0); + fill_value[0] = 255; + H5.H5Pset_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + assertTrue("fill_value: "+fill_value[0], fill_value[0] == 255); + H5.H5Pfill_value_defined(ocpl_id, fill_value_status); + assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fill_value: " + err); + } + } + + @Test + public void testH5P_layout() { + int layout_type = -1; + + try { + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS); + H5.H5Pset_layout(ocpl_id, HDF5Constants.H5D_COMPACT); + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_COMPACT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_layout: " + err); + } + } + + @Test + public void testH5P_chunk() { + long[] chunk_size = {0,0}; + long[] chunk_new_size = {2,3}; + int layout_type = -1; + + try { + H5.H5Pset_chunk(ocpl_id, 2, chunk_new_size); + H5.H5Pget_chunk(ocpl_id, 2, chunk_size); + assertTrue("chunk: "+chunk_size[0], chunk_size[0] == chunk_new_size[0]); + assertTrue("chunk: "+chunk_size[1], chunk_size[1] == chunk_new_size[1]); + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CHUNKED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_chunk: " + err); + } + } + + @Test + public void testH5P_file_space() { + long[] threshold = {0}; + int[] strategy = {0}; + try { + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL); + assertTrue("theshold: "+threshold[0], threshold[0] == 1); + H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST, 10); + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST); + assertTrue("theshold: "+threshold[0], threshold[0] == 10); + H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_VFD, 0); + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_VFD); + assertTrue("theshold: "+threshold[0], threshold[0] == 10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5P_file_space: " + err); + } + } +} diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java new file mode 100644 index 00000000000..7fc154d17bd --- /dev/null +++ b/java/test/TestH5PData.java @@ -0,0 +1,170 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5PData { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 12; + private static final int DIM_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long plist_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createFloatDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5PData._createFloatDataset: ", did > 0); + + return did; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5PData.createH5file: " + err); + } + assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5PData.createH5file: _createFloatDataset: ",H5did > 0); + assertTrue(plist_id > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pdata_transform() { + String f_to_c = "(5/9.0)*(x-32)"; + double windchillFread[][] = new double[DIM_X][DIM_Y]; + double windchillC; + NumberFormat formatter = new DecimalFormat("#0.000"); + + try { + H5.H5Pset_data_transform(plist_id, f_to_c); + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + plist_id, windchillF); + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, windchillFread); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + for(int row = 0; row < DIM_X; row++) + for(int col = 0; col < DIM_Y; col++) { + windchillC = (5/9.0)*(windchillF[row][col]-32); + String Cstr = formatter.format(windchillC); + String Fread = formatter.format(windchillFread[row][col]); + assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + } + } + + @Test + public void testH5P_buffer() { + long default_size = 0; + long size = 0; + + try { + default_size = H5.H5Pget_buffer_size(plist_id); + H5.H5Pset_buffer_size(plist_id, DIM_X*DIM_Y); + size = H5.H5Pget_buffer_size(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_buffer fail: " + err); + } + assertTrue("H5P_buffer default: "+default_size, default_size==1024*1024); + assertTrue("H5P_buffer size: "+size, size==DIM_X*DIM_Y); + } +} diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java new file mode 100644 index 00000000000..555afe091eb --- /dev/null +++ b/java/test/TestH5Pfapl.java @@ -0,0 +1,1325 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Pfapl { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final String H5_LOG_FILE = "test.log"; + private static final String H5_FAMILY_FILE = "test%05d"; + private static final String H5_MULTI_FILE = "testmulti"; + private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int DIMF_X = 12; + private static final int DIMF_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5Fdsid = -1; + long H5Fdid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long fapl_id = -1; + long plapl_id = -1; + long dapl_id = -1; + long plist_id = -1; + long btplist_id = -1; + long[] H5Fdims = { DIMF_X, DIMF_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + 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 void _deleteLogFile() { + File file = null; + try { + file = new File(H5_LOG_FILE); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteFamilyFile() { + File file = null; + for(int indx = 0; ;indx++) { + java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); + try { + file = new File("test"+myFormat.format(new Integer(indx))+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + else + return; + } + } + + private final void _deleteMultiFile() { + File file = null; + for(int indx = 1;indx<7;indx++) { + try { + file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); + } + 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("TestH5Pfapl._createDataset: ", did > 0); + + return did; + } + + private final void _createFloatDataset() { + try { + H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); + H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFileDS() { + try { + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5File(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + 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("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5familyFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + 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("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() { + _deleteFile(H5_FILE); + } + + public void deleteH5familyfile() { + _deleteFamilyFile(); + } + + public void deleteH5multifile() { + _deleteMultiFile(); + } + + @Before + public void createFileAccess() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(fapl_id > 0); + try { + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plapl_id > 0); + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plist_id > 0); + assertTrue(btplist_id > 0); + assertTrue(dapl_id > 0); + } + + @After + public void deleteFileAccess() throws HDF5LibraryException { + if (fapl_id > 0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (plapl_id > 0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (dapl_id > 0) + try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (btplist_id > 0) + try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + + if (H5Fdsid > 0) + try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} + if (H5Fdid > 0) + try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pget_libver_bounds() { + int ret_val = -1; + int[] libver = new int[2]; + + try { + ret_val = H5.H5Pget_libver_bounds(fapl_id, libver); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_libver_bounds: " + err); + } + assertTrue("testH5Pget_libver_bounds", ret_val >= 0); + // Check the Earliest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_EARLIEST, libver[0]); + // Check the Latest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_LATEST, libver[1]); + } + + @Test + public void testH5Pset_libver_bounds() { + + int ret_val = -1; + int low = HDF5Constants.H5F_LIBVER_EARLIEST; + int high = HDF5Constants.H5F_LIBVER_LATEST; + int[] libver = new int[2]; + + try { + ret_val = H5.H5Pset_libver_bounds(fapl_id, low, high); + H5.H5Pget_libver_bounds(fapl_id, libver); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_libver_bounds: " + err); + } + assertTrue("testH5Pset_libver_bounds", ret_val >= 0); + // Check the Earliest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_EARLIEST, libver[0]); + // Check the Latest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_LATEST, libver[1]); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_elink_fapl_NegativeID() throws Throwable { + H5.H5Pset_elink_fapl(-1, fapl_id ); + } + + @Test + public void testH5Pset_elink_fapl() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_elink_fapl: " + err); + } + assertTrue("H5Pset_elink_fapl", ret_val >= 0); + } + + @Test + public void testH5Pget_elink_fapl() { + long ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5Pget_elink_fapl", ret_val_id >= 0); + assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id ); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_fapl: " + err); + } + finally { + if (ret_val_id > 0) + try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_elink_fapl() { + long ret_val_id = -1; + try { + H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + ret_val_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5P_elink_fapl", ret_val_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_elink_fapl: " + err); + } + finally { + if (ret_val_id > 0) + try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_elink_file_cache_size() { + long elink_fapl_id = -1; + int efc_size = 0; + try { + H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + elink_fapl_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5P_elink_file_cache_size", elink_fapl_id >= 0); + try { + efc_size = H5.H5Pget_elink_file_cache_size(elink_fapl_id); + assertTrue("H5P_elink_file_cache_size default", efc_size == 0); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + try { + efc_size = 8; + H5.H5Pset_elink_file_cache_size(elink_fapl_id, efc_size); + efc_size = H5.H5Pget_elink_file_cache_size(elink_fapl_id); + assertTrue("H5P_elink_file_cache_size 8", efc_size == 8); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_elink_file_cache_size: " + err); + } + finally { + if (elink_fapl_id > 0) + try {H5.H5Pclose(elink_fapl_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_btree_ratios() { + double[] left = {0.1}; + double[] middle = {0.5}; + double[] right = {0.7}; + try { + H5.H5Pset_btree_ratios(plist_id, left[0], middle[0], right[0]); + H5.H5Pget_btree_ratios(plist_id, left, middle, right); + assertTrue("H5P_btree_ratios", left[0] == 0.1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_btree_ratios: " + err); + } + } + + @Test + public void testH5P_edc_check() { + int ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_edc_check(plist_id); + assertTrue("H5P_edc_check", ret_val_id == HDF5Constants.H5Z_ENABLE_EDC); + H5.H5Pset_edc_check(plist_id, HDF5Constants.H5Z_DISABLE_EDC); + ret_val_id = H5.H5Pget_edc_check(plist_id); + assertTrue("H5P_edc_check", ret_val_id == HDF5Constants.H5Z_DISABLE_EDC); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_edc_check: " + err); + } + } + + @Test + public void testH5P_fclose_degree() { + int ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree default", ret_val_id == HDF5Constants.H5F_CLOSE_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: default " + err); + } + try { + H5.H5Pset_fclose_degree(fapl_id, HDF5Constants.H5F_CLOSE_STRONG); + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree", ret_val_id == HDF5Constants.H5F_CLOSE_STRONG); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: H5F_CLOSE_STRONG " + err); + } + try { + H5.H5Pset_fclose_degree(fapl_id, HDF5Constants.H5F_CLOSE_SEMI); + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree", ret_val_id == HDF5Constants.H5F_CLOSE_SEMI); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: H5F_CLOSE_SEMI " + err); + } + } + + @Test + public void testH5P_alignment() { + long[] align = {0,0}; + try { + H5.H5Pget_alignment(fapl_id, align); + assertTrue("H5P_alignment threshold default", align[0] == 1); + assertTrue("H5P_alignment alignment default", align[1] == 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_alignment: default " + err); + } + try { + align[0] = 1024; + align[1] = 2048; + H5.H5Pset_alignment(fapl_id, align[0], align[1]); + H5.H5Pget_alignment(fapl_id, align); + assertTrue("H5P_alignment threshold", align[0] == 1024); + assertTrue("H5P_alignment alignment", align[1] == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_alignment: " + err); + } + } + + @Test + public void testH5P_meta_block_size() { + long meta_size = 0; + try { + meta_size = H5.H5Pget_meta_block_size(fapl_id); + assertTrue("H5P_meta_block_size default", meta_size == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_meta_block_size: default " + err); + } + try { + meta_size = 4096; + H5.H5Pset_meta_block_size(fapl_id, meta_size); + meta_size = H5.H5Pget_meta_block_size(fapl_id); + assertTrue("H5P_meta_block_size 4096", meta_size == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_meta_block_size: " + err); + } + } + + @Test + public void testH5P_small_data_block_size() { + long align = 0; + try { + align = H5.H5Pget_small_data_block_size(fapl_id); + assertTrue("H5P_small_data_block_size default", align == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_small_data_block_size: default " + err); + } + try { + align = 4096; + H5.H5Pset_small_data_block_size(fapl_id, align); + align = H5.H5Pget_small_data_block_size(fapl_id); + assertTrue("H5P_small_data_block_size 4096", align == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_small_data_block_size: " + err); + } + } + + @Test + public void testH5P_hyper_vector_size() { + long[] align = {0}; + try { + H5.H5Pget_hyper_vector_size(plist_id, align); + assertTrue("H5P_hyper_vector_size default", align[0] == 1024); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_hyper_vector_size: default " + err); + } + try { + align[0] = 4096; + H5.H5Pset_hyper_vector_size(plist_id, align[0]); + H5.H5Pget_hyper_vector_size(plist_id, align); + assertTrue("H5P_hyper_vector_size 4096", align[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_hyper_vector_size: " + err); + } + } + + @Test + public void testH5P_cache() { + long[] rdcc_nelmts = {0}; + long[] rdcc_nbytes = {0}; + double[] rdcc_w0 = {0}; + try { + H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_cache default", rdcc_nelmts[0] == 521); + assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_cache default", rdcc_w0[0] == 0.75); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_cache: default " + err); + } + try { + rdcc_nelmts[0] = 4096; + H5.H5Pset_cache(fapl_id, 0, rdcc_nelmts[0], rdcc_nbytes[0], rdcc_w0[0]); + H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_cache 4096", rdcc_nelmts[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_cache: " + err); + } + } + + @Test + public void testH5P_chunk_cache() { + long[] rdcc_nslots = {0}; + long[] rdcc_nbytes = {0}; + double[] rdcc_w0 = {0}; + try { + H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_chunk_cache default", rdcc_nslots[0] == 521); + assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_chunk_cache default", rdcc_w0[0] == 0.75); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_chunk_cache: default " + err); + } + try { + rdcc_nslots[0] = 4096; + H5.H5Pset_chunk_cache(dapl_id, rdcc_nslots[0], rdcc_nbytes[0], rdcc_w0[0]); + H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_chunk_cache 4096", rdcc_nslots[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_chunk_cache: " + err); + } + } + + @Test + public void testH5P_sieve_buf_size() { + long buf_size = 0; + try { + buf_size = H5.H5Pget_sieve_buf_size(fapl_id); + assertTrue("H5P_sieve_buf_size default", buf_size == (64*1024)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_sieve_buf_size: default " + err); + } + try { + buf_size = 4096; + H5.H5Pset_sieve_buf_size(fapl_id, buf_size); + buf_size = H5.H5Pget_sieve_buf_size(fapl_id); + assertTrue("H5P_sieve_buf_size 4096", buf_size == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_sieve_buf_size: " + err); + } + } + + @Test + public void testH5P_gc_references() { + boolean ret_val_id = false; + try { + H5.H5Pset_gc_references(fapl_id, true); + ret_val_id = H5.H5Pget_gc_references(fapl_id); + assertTrue("H5P_gc_references", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_gc_references: " + err); + } + } + + @Test + public void testH5Pget_mdc_config() { + H5AC_cache_config_t cache_config = null; + try { + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pget_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_mdc_config: " + err); + } + } + + @Test + public void testH5Pset_mdc_config() { + H5AC_cache_config_t cache_config = null; + try { + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_mdc_config: " + err); + } + try { + cache_config.decr_mode = HDF5Constants.H5C_decr_off; + H5.H5Pset_mdc_config(fapl_id, cache_config); + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + assertTrue("H5Pset_mdc_config", cache_config.decr_mode==HDF5Constants.H5C_decr_off); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_mdc_config: " + err); + } + } + + @Test + public void testH5P_fapl_core() { + if (HDF5Constants.H5FD_CORE < 0) + return; + try { + H5.H5Pset_fapl_core(fapl_id, 4096, false); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: core = "+ driver_type, HDF5Constants.H5FD_CORE==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_core: " + err); + } + try { + long[] increment = {-1}; + boolean[] backingstore = {true}; + H5.H5Pget_fapl_core(fapl_id, increment, backingstore); + assertTrue("H5Pget_fapl_core: increment="+increment[0], increment[0]==4096); + assertTrue("H5Pget_fapl_core: backingstore="+backingstore[0], !backingstore[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_core: " + err); + } + } + + @Test + public void testH5P_fapl_family() { + if (HDF5Constants.H5FD_FAMILY < 0) + return; + try { + H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_family: " + err); + } + try { + long[] member_size = {0}; + long[] member_fapl = {-1}; + H5.H5Pget_fapl_family(fapl_id, member_size, member_fapl); + assertTrue("H5Pget_fapl_family: member_size="+member_size[0], member_size[0]==1024); + assertTrue("H5Pget_fapl_family: member_fapl ", H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + _createH5familyFile(fapl_id); + deleteH5familyfile(); + } + + @Test + public void testH5P_family_offset() { + if (HDF5Constants.H5FD_FAMILY < 0) + return; + try { + H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_family: " + err); + } + _createH5familyFile(fapl_id); + long family_offset = 512; + try { + H5.H5Pset_family_offset(fapl_id, family_offset); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + try { + long offset = H5.H5Pget_family_offset(fapl_id); + assertTrue("H5Pget_fapl_family: offset="+offset, offset==family_offset); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + deleteH5familyfile(); + } + + @Test + public void testH5Pset_fapl_sec2() { + if (HDF5Constants.H5FD_SEC2 < 0) + return; + try { + H5.H5Pset_fapl_sec2(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: sec2 = "+ driver_type, HDF5Constants.H5FD_SEC2==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_sec2: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_stdio() { + if (HDF5Constants.H5FD_STDIO < 0) + return; + try { + H5.H5Pset_fapl_stdio(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: stdio = "+ driver_type, HDF5Constants.H5FD_STDIO==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_stdio: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_log() { + if (HDF5Constants.H5FD_LOG < 0) + return; + try { + long log_flags = HDF5Constants.H5FD_LOG_LOC_IO; + H5.H5Pset_fapl_log(fapl_id, H5_LOG_FILE, log_flags, 1024); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: log = "+ driver_type, HDF5Constants.H5FD_LOG==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_log: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + _deleteLogFile(); + } + + @Test + public void testH5P_fapl_muti_nulls() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + + int[] member_map = null; + long[] member_fapl = null; + String[] member_name = null; + long[] member_addr = null; + + try { + H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti: " + err); + } + try { + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_muti: relax ", relax); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_muti: " + err); + } + _createH5multiFile(fapl_id); + deleteH5multifile(); + } + + @Test + public void testH5P_fapl_muti_defaults() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + int H5FD_MEM_NTYPES = HDF5Constants.H5FD_MEM_NTYPES; // 7 + + long sH5FD_MEM_DEFAULT_HADDR = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE; + long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE; + long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE; + long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE; + long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE; + long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE; + long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE; + int[] member_map = null; + long[] member_fapl = null; + String[] member_name = null; + long[] member_addr = null; + + try { + H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti: " + err); + } + try { + member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_muti: relax ", relax); + assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT); + assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DEFAULT], member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5")==0); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_SUPER], member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_LHEAP], member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_OHDR], member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_muti: " + err); + } + _createH5multiFile(fapl_id); + _createH5multiFileDS(); + deleteH5multifile(); + } + + @Test + public void testH5P_fapl_muti() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + long HADDR_DEFAULT_SIZE = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + + for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt= HADDR_DEFAULT_SIZE/4 || file_size <= HADDR_DEFAULT_SIZE/2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti:H5Fget_filesize " + err); + } + _createH5multiFileDS(); + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-super.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-btree.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-draw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-gheap.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5P_fapl_split() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + + try { + H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5", HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: split = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_split: " + err); + } + try { + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_multi: relax ", relax); + assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5")==0); + assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_split: " + err); + } + _createH5multiFile(fapl_id); + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-meta.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-raw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5P_fapl_direct() { + if (HDF5Constants.H5FD_DIRECT < 0) + return; + try { + H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8*4096); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: direct = "+ driver_type, HDF5Constants.H5FD_DIRECT==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_direct: " + err); + } + try { + long[] params = {-1, -1, -1}; + H5.H5Pget_fapl_direct(fapl_id, params); + assertTrue("H5Pget_fapl_direct: alignment="+params[0], params[0]==1024); + assertTrue("H5Pget_fapl_direct: block_size="+params[1], params[1]==4096); + assertTrue("H5Pget_fapl_direct: cbuf_size="+params[2], params[2]==8*4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_direct: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_windows() { + if (HDF5Constants.H5FD_WINDOWS < 0) + return; + try { + H5.H5Pset_fapl_windows(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: windows = "+ driver_type, HDF5Constants.H5FD_WINDOWS==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_windows: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pmulti_transform() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + String f_to_c = "(5/9.0)*(x-32)"; + double windchillFread[][] = new double[DIMF_X][DIMF_Y]; + double windchillC; + NumberFormat formatter = new DecimalFormat("#0.000"); + long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + + try { + H5.H5Pset_data_transform(plist_id, f_to_c); + H5.H5Pset_btree_ratios(btplist_id, 0.1, 0.5, 0.7); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + + for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt= HADDRMAX/4 || file_size <= HADDRMAX/2); + _createH5multiFileDS(); + _createFloatDataset(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + try { + H5.H5Dwrite(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + plist_id, windchillF); + H5.H5Dread(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, windchillFread); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + for(int row = 0; row < DIMF_X; row++) { + for(int col = 0; col < DIMF_Y; col++) { + windchillC = (5/9.0)*(windchillF[row][col]-32); + String Cstr = formatter.format(windchillC); + String Fread = formatter.format(windchillFread[row][col]); + assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + } + } + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-super.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-btree.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-draw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-gheap.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } +} diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java new file mode 100644 index 00000000000..72e0bfb3671 --- /dev/null +++ b/java/test/TestH5R.java @@ -0,0 +1,335 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5R { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "testH5R.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5gid = -1; + long H5did2 = -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("TestH5R._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5R._createGroup: ",gid > 0); + + return gid; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5gid = _createGroup(H5fid, "Group1"); + H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R.createH5file: " + err); + } + assertTrue("TestH5R.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5R.createH5file: _createDataset: ",H5did > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Rget_name() { + long loc_id=H5fid; + int ref_type=HDF5Constants.H5R_OBJECT; + long ret_val=-1; + byte[] ref=null; + String[] name= {""}; + String objName = "/dset"; + + try { + ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_name:H5Rcreate " + err); + } + + try { + ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_name: " + err); + } + + assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); + assertTrue("The name of the object: ", objName.equals(name[0])); + } + + @Test + public void testH5Rget_obj_type2() { + int ref_type=HDF5Constants.H5R_OBJECT; + byte[] ref=null; + + String objName = "/dset"; + int obj_type = -1;; + + try { + ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + } + catch(Throwable err) { + err.printStackTrace(); + } + + try { + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_obj_type2: " + err); + } + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Rcreate_refobj() { + byte[] ref = null; + + try { + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rcreate: " + err); + } + assertNotNull(ref); + } + + @Test + public void testH5Rcreate_regionrefobj() { + byte[] ref = null; + try { + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rcreate: " + err); + } + assertNotNull(ref); + } + + @Test + public void testH5Rdereference() { + byte[] ref1 = null; + byte[] ref2 = null; + long dataset_id = -1; + long group_id = -1; + try { + //Create reference on dataset + ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + 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() { + byte[] ref = null; + long dsid = -1; + try { + 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); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Rget_region: " + err); + } + finally { + try {H5.H5Sclose(dsid);} catch (Exception ex) {} + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rget_name_Invalidreftype() throws Throwable { + byte[] ref = null; + String[] name= {""}; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16); + } + + @Test(expected = NullPointerException.class) + public void testH5Rget_name_NULLreference() throws Throwable { + byte[] ref = null; + String[] name= {""}; + H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rget_obj_type2_Invalidreftype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rcreate_InvalidObjectName() throws Throwable { + H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rcreate_Invalidspace_id() throws Throwable { + H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rcreate_Invalidreftype() throws Throwable { + H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rgetregion_Invalidreftype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); + H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rgetregion_Badreferencetype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); + H5.H5Rget_region(H5fid, HDF5Constants.H5R_OBJECT, ref); + } + + @Test(expected = NullPointerException.class) + public void testH5Rgetregion_Nullreference() throws Throwable { + byte[] ref = null; + H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = NullPointerException.class) + public void testH5Rdereference_Nullreference() throws Throwable { + byte[] ref = null; + H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rdereference_Invalidreference() throws Throwable { + byte[] ref1 = null; + byte[] ref2 = null; + ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); + } + +} diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java new file mode 100644 index 00000000000..909ab025385 --- /dev/null +++ b/java/test/TestH5S.java @@ -0,0 +1,590 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5S { + @Rule public TestName testname = new TestName(); + long H5sid = -1; + int H5rank = 2; + long H5dims[] = {5, 5}; + long H5maxdims[] = {10, 10}; + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5sid = H5.H5Screate_simple(H5rank, H5dims, H5maxdims); + assertTrue("H5.H5Screate_simple_extent", H5sid > 0); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5sid > 0) { + try {H5.H5Sclose(H5sid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Sget_simple_extent_ndims() { + int read_rank = -1; + try { + read_rank = H5.H5Sget_simple_extent_ndims(H5sid); + assertTrue("H5.H5Sget_simple_extent_ndims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_ndims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_dims_null() { + int read_rank = -1; + + try { + read_rank = H5.H5Sget_simple_extent_dims(H5sid, null, null); + assertTrue("H5.H5Sget_simple_extent_dims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_dims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_dims() { + int read_rank = -1; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + read_rank = H5.H5Sget_simple_extent_dims(H5sid, dims, maxdims); + assertTrue("H5.H5Sget_simple_extent_dims", H5rank == read_rank); + assertTrue("H5.H5Sget_simple_extent_dims:dims", H5dims[0] == dims[0]); + assertTrue("H5.H5Sget_simple_extent_dims:maxdims", H5maxdims[0] == maxdims[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_dims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_npoints() { + long num_elements = -1; + try { + num_elements = H5.H5Sget_simple_extent_npoints(H5sid); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0]*H5dims[1]) == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_npoints: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_type() { + int read_type = -1; + try { + read_type = H5.H5Sget_simple_extent_type(H5sid); + assertTrue("H5.H5Sget_simple_extent_type", HDF5Constants.H5S_SIMPLE == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_type: " + err); + } + } + + @Test + public void testH5Sis_simple() { + boolean result = false; + + try { + result = H5.H5Sis_simple(H5sid); + assertTrue("H5.H5Sis_simple", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sis_simple: " + err); + } + } + + @Test + public void testH5Sset_extent_simple() { + long num_elements = -1; + try { + H5.H5Sset_extent_simple(H5sid, H5rank, H5maxdims, H5maxdims); + num_elements = H5.H5Sget_simple_extent_npoints(H5sid); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0]*H5maxdims[1]) == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_simple: " + err); + } + } + + @Test + public void testH5Sget_select_type() { + int read_type = -1; + try { + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type", HDF5Constants.H5S_SEL_ALL == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Sset_extent_none() { + int read_type = -1; + try { + H5.H5Sset_extent_none(H5sid); + read_type = H5.H5Sget_simple_extent_type(H5sid); + assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NO_CLASS == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Scopy() { + long sid = -1; + int read_rank = -1; + + try { + sid = H5.H5Scopy(H5sid); + assertTrue("H5.H5Sis_simple", sid > 0); + read_rank = H5.H5Sget_simple_extent_ndims(sid); + assertTrue("H5.H5Screate_simple_extent_ndims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Scopy: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sextent_copy() { + long sid = -1; + int class_type = -1; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + H5.H5Sextent_copy(sid, H5sid); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_null: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sextent_copy: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sextent_equal() { + long sid = -1; + boolean result = false; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null",sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + result = H5.H5Sextent_equal(sid, H5sid); + assertFalse("H5.testH5Sextent_equal",result); + H5.H5Sextent_copy(sid, H5sid); + result = H5.H5Sextent_equal(sid, H5sid); + assertTrue("H5.testH5Sextent_equal", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sextent_copy " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sencode_decode_null_dataspace() { + long sid = -1; + long decoded_sid = -1; + byte[] null_sbuf = null; + boolean result = false; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + null_sbuf = H5.H5Sencode(sid); + assertFalse("H5.testH5Sencode", null_sbuf==null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sencode " + err); + } + finally { + if(null_sbuf == null) { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + try { + decoded_sid = H5.H5Sdecode(null_sbuf); + assertTrue("H5.testH5Sdecode", decoded_sid>0); + + result = H5.H5Sextent_equal(sid, decoded_sid); + assertTrue("H5.testH5Sextent_equal", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sdecode " + err); + } + finally { + try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sencode_decode_scalar_dataspace() { + long sid = -1; + long decoded_sid = -1; + byte[] scalar_sbuf = null; + boolean result = false; + int iresult = -1; + long lresult = -1; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); + assertTrue("H5.H5Screate_null", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + scalar_sbuf = H5.H5Sencode(sid); + assertFalse("H5.testH5Sencode", scalar_sbuf==null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sencode " + err); + } + finally { + if(scalar_sbuf == null) { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + try { + decoded_sid = H5.H5Sdecode(scalar_sbuf); + assertTrue("H5.testH5Sdecode", decoded_sid>0); + + result = H5.H5Sextent_equal(sid, decoded_sid); + assertTrue("H5.testH5Sextent_equal", result); + + /* Verify decoded dataspace */ + lresult = H5.H5Sget_simple_extent_npoints(decoded_sid); + assertTrue("H5.testH5Sget_simple_extent_npoints", lresult==1); + + iresult = H5.H5Sget_simple_extent_ndims(decoded_sid); + assertTrue("H5.testH5Sget_simple_extent_ndims", iresult==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sdecode " + err); + } + finally { + try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sselect_none() { + int read_type = -1; + try { + H5.H5Sselect_none(H5sid); + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_NONE == read_type); + H5.H5Sselect_all(H5sid); + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_ALL == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Sget_select_npoints() { + long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ + long num_elements = -1; + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + num_elements = H5.H5Sget_select_npoints(H5sid); + assertTrue("H5.H5Sget_select_npoints: "+num_elements, 3 == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_npoints: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Sget_select_elem_pointlist_invalid() throws Throwable { + long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ + long getcoord[] = {-1,-1}; /* Coordinates for get point selection */ + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err); + } + H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord); + } + + @Test + public void testH5Sget_select_elem_pointlist() { + long coord[][] = {{0,1},{2,3},{4,5}}; /* Coordinates for point selection */ + long getcoord[] = {-1,-1,-1,-1,-1,-1}; /* Coordinates for get point selection */ + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err); + } + } + + @Test + public void testH5Sget_select_bounds() { + long lowbounds[] = {-1,-1}; + long hibounds[] = {-1,-1}; + try { + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + } + + @Test + public void testH5Soffset_simple() { + long coord[][] = {{2,2},{2,4},{4,2},{4,4}}; /* Coordinates for point selection */ + long lowbounds[] = {-1,-1}; + long hibounds[] = {-1,-1}; + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 4, coord); + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + try { + long offset[] = {-1,-1}; + H5.H5Soffset_simple(H5sid, offset); + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-2) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-2) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Soffset_simple: " + err); + } + } + + @Test + public void testH5Sget_select_hyper() { + long space1 = -1; + long start[] = {0,0}; + long stride[] = {1,1}; + long count[] = {1,1}; + long block[] = {4,4}; + long nblocks; // Number of hyperslab blocks + long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks + try { + // Copy "all" selection & space + space1 = H5.H5Scopy(H5sid); + assertTrue("H5.H5Scopy", H5sid > 0); + // 'AND' "all" selection with another hyperslab + H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_AND, start, stride, count, block); + + // Verify that there is only one block + nblocks = H5.H5Sget_select_hyper_nblocks(space1); + assertTrue("H5Sget_select_hyper_nblocks", nblocks == 1); + + // Retrieve the block defined + H5.H5Sget_select_hyper_blocklist(space1, 0, nblocks, blocks); + + // Verify that the correct block is defined + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == blocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == blocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == blocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == blocks[3]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + finally { + try {H5.H5Sclose(space1);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sget_select_valid() { + long space1 = -1; + long start[] = {1,0}; + long stride[] = {1,1}; + long count[] = {2,3}; + long block[] = {1,1}; + long offset[] = {0,0}; // Offset of selection + + try { + // Copy "all" selection & space + space1 = H5.H5Scopy(H5sid); + assertTrue("H5.H5Scopy", H5sid > 0); + // 'AND' "all" selection with another hyperslab + H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Check a valid offset + offset[0]=-1; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); + + // Check an invalid offset + offset[0]=10; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertFalse("H5Sselect_valid", H5.H5Sselect_valid(space1)); + + /* Reset offset */ + offset[0]=0; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Sget_select_valid: " + err); + } + finally { + try {H5.H5Sclose(space1);} catch (Exception ex) {} + } + } + + @Test + public void testH5Shyper_regular() { + long start[] = {1,0}; + long stride[] = {1,1}; + long count[] = {2,3}; + long block[] = {1,1}; + long q_start[] = new long[2]; + long q_stride[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; + boolean is_regular = false; + + try { + // Set "regular" hyperslab selection + H5.H5Sselect_hyperslab(H5sid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Query if 'hyperslab' selection is regular hyperslab (should be TRUE) + is_regular = H5.H5Sis_regular_hyperslab(H5sid); + assertTrue("H5.H5Sis_regular_hyperslab", is_regular); + + // Retrieve the hyperslab parameters + H5.H5Sget_regular_hyperslab(H5sid, q_start, q_stride, q_count, q_block); + + /* Verify the hyperslab parameters */ + for(int u = 0; u < H5rank; u++) { + assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]); + assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]); + assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]); + assertTrue("H5Sget_regular_hyperslab, block", block[u] == q_block[u]); + } /* end for */ + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Sget_select_valid: " + err); + } + } +} diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java new file mode 100644 index 00000000000..2731a061b16 --- /dev/null +++ b/java/test/TestH5Sbasic.java @@ -0,0 +1,247 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Sbasic { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Sclose_invalid() throws Throwable { + long sid = H5.H5Sclose(-1); + assertTrue(sid == 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Screate_invalid() throws Throwable { + H5.H5Screate(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Sget_simple_extent_type_invalid() throws Throwable { + H5.H5Sget_simple_extent_type(-1); + } + + @Test + public void testH5Screate_scalar() { + long sid = -1; + int class_type = -1; + try { + sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); + assertTrue("H5.H5Screate_scalar",sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_scalar: type",class_type == HDF5Constants.H5S_SCALAR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_null() { + long sid = -1; + int class_type = -1; + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_null: type", class_type == HDF5Constants.H5S_NULL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test(expected = NullPointerException.class) + public void testH5Screate_simple_dims_null() throws Throwable { + H5.H5Screate_simple(2, (long[])null, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Screate_simple_rank_invalid() throws Throwable { + long dims[] = {5, 5}; + H5.H5Screate_simple(-1, dims, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Screate_simple_dims_invalid() throws Throwable { + long dims[] = {2, 2}; + H5.H5Screate_simple(5, dims, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Screate_simple_dims_exceed() throws Throwable { + long dims[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30,31,32,33,35}; + H5.H5Screate_simple(35, dims, null); + } + +//H5Screate_simple was changed to allow a dim of 0 +// @Ignore(expected = HDF5LibraryException.class) +// public void testH5Screate_simple_dims_zero() { +// long dims[] = {0, 0}; +// H5.H5Screate_simple(2, dims, null); +// } + + @Test + public void testH5Screate_simple() { + long sid = -1; + int class_type = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_unlimted() { + long sid = -1; + int class_type = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_unlimted_1d() { + long sid = -1; + int class_type = -1; + int rank = 1; + long dims[] = {5}; + long maxdims[] = {HDF5Constants.H5S_UNLIMITED}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_max_default() { + long sid = -1; + int rank = 2; + long dims[] = {5, 5}; + + try { + sid = H5.H5Screate_simple(rank, dims, null); + assertTrue("H5.H5Screate_simple_max_default", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_extent() { + long sid = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); + assertTrue("H5.H5Screate_simple_extent",sid > 0); + H5.H5Sset_extent_simple(sid, rank, dims, maxdims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Sencode_invalid() throws Throwable { + H5.H5Sencode(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Sdecode_null() throws Throwable { + H5.H5Sdecode(null); + } + +} diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java new file mode 100644 index 00000000000..e03b97f7a78 --- /dev/null +++ b/java/test/TestH5T.java @@ -0,0 +1,459 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5T { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + long H5fid = -1; + long H5strdid = -1; + + 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) {} + } + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("H5.H5Fcreate", H5fid > 0); + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy", H5strdid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tequal_type_error() throws Throwable { + H5.H5Tequal(HDF5Constants.H5T_INTEGER, H5strdid); + } + + @Test + public void testH5Tget_class() { + try { + int result = H5.H5Tget_class(H5strdid); + assertTrue("H5.H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_class: " + err); + } + } + + @Test + public void testH5Tget_size() { + long dt_size = -1; + + try { + dt_size = H5.H5Tget_size(H5strdid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_size:H5.H5Tget_size " + err); + } + assertTrue("testH5Tget_size", dt_size > 0); + } + + @Test + public void testH5Tset_size() { + long dt_size = 5; + + try { + H5.H5Tset_size(H5strdid, dt_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tset_size:H5.H5Tset_size " + err); + } + try { + dt_size = H5.H5Tget_size(H5strdid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_size:H5.H5Tget_size " + err); + } + assertTrue("testH5Tget_size", dt_size == 5); + } + + @Test + public void testH5Tarray_create() { + long filetype_id = -1; + long[] adims = { 3, 5 }; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + assertTrue("testH5Tarray_create", filetype_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tget_array_ndims() { + long filetype_id = -1; + int ndims = 0; + long[] adims = { 3, 5 }; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_ndims(filetype_id); + assertTrue("testH5Tget_array_ndims", ndims == 2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tget_array_dims() { + long filetype_id = -1; + int ndims = 0; + long[] adims = { 3, 5 }; + long[] rdims = new long[2]; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_dims(filetype_id, rdims); + assertTrue("testH5Tget_array_dims", ndims == 2); + assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]); + assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_dims.H5Tget_array_dims " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tenum_functions() { + long filetype_id =-1; + String enum_type ="Enum_type"; + byte[] enum_val = new byte[1]; + String enum_name = null; + + // Create a enumerate datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_ENUM, (long)1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_functions:H5Tcreate " + err); + } + assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0); + try { + enum_val[0]=10; + H5.H5Tenum_insert(filetype_id, "RED", enum_val); + enum_val[0]=11; + H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); + enum_val[0]=12; + H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); + enum_val[0]=13; + H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); + enum_val[0]=14; + H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + + // Commit enumeration datatype and close it */ + H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + H5.H5Tclose(filetype_id); + + // Open the dataytpe for query + filetype_id = H5.H5Topen(H5fid, enum_type, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0); + + // Query member number and member index by member name, for enumeration type + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + + // Query member value by member name, for enumeration type + H5.H5Tenum_valueof (filetype_id, "ORANGE", enum_val); + assertTrue("Incorrect value for enum member", enum_val[0]==13); + + // Query member value by member index, for enumeration type + H5.H5Tget_member_value (filetype_id, 2, enum_val); + assertTrue("Incorrect value for enum member", enum_val[0]==12); + + // Query member name by member value, for enumeration type + enum_val[0] = 14; + enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16); + assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_functions:query " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tenum_create_functions() { + long filetype_id = -1; + byte[] enum_val = new byte[1]; + + // Create a enumerate datatype + try { + filetype_id = H5.H5Tenum_create(HDF5Constants.H5T_NATIVE_INT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_create_functions:H5Tcreate " + err); + } + assertTrue("testH5Tenum_create_functions:H5Tcreate", filetype_id >= 0); + try { + enum_val[0]=10; + H5.H5Tenum_insert(filetype_id, "RED", enum_val); + enum_val[0]=11; + H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); + enum_val[0]=12; + H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); + enum_val[0]=13; + H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); + enum_val[0]=14; + H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_create_functions:H5Tget_nmembers " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Topaque_functions() { + long filetype_id = -1; + String opaque_name = null; + + // Create a opaque datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)4); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Topaque_functions:H5Tcreate " + err); + } + assertTrue("testH5Topaque_functions:H5Tcreate", filetype_id >= 0); + + try { + H5.H5Tset_tag(filetype_id, "opaque type"); + opaque_name = H5.H5Tget_tag(filetype_id); + assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Topaque_functions:H5Tset_get_tag " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tvlen_create() { + long filetype_id = -1; + + try { + filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tvlen_create", filetype_id >= 0); + + // Check if datatype is VL type + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tvlen_create.H5Tvlen_create " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tis_variable_str() { + long filetype_id = -1; + + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0); + + // Convert to variable-length string + H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE); + + // Check if datatype is VL string + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + + assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id)); + + // Verify that the class detects as a string + assertTrue("testH5Tis_variable_str:H5Tdetect_class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tis_variable_str " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tcompound_functions() { + long filetype_id =-1; + + // Create a compound datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, (long)16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcompound_functions:H5Tcreate " + err); + } + assertTrue("testH5Tcompound_functions:H5Tcreate", filetype_id >= 0); + try { + H5.H5Tinsert(filetype_id, "Lon", 0, HDF5Constants.H5T_NATIVE_DOUBLE); + H5.H5Tinsert(filetype_id, "Lat", 8, HDF5Constants.H5T_NATIVE_DOUBLE); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 2); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "Lat") == 1); + + // We started to support this function for compound type in 1.8.6 release. + int order = H5.H5Tget_order(filetype_id); + assertFalse("Can't get order for compound type.", order == HDF5Constants.H5T_ORDER_ERROR); + assertTrue("Wrong order for this type.", (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE)); + + // Make certain that the correct classes can be detected + assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND)); + assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_FLOAT)); + // Make certain that an incorrect class is not detected + assertFalse("Can get incorrect class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_TIME)); + + // Query member name by member index + String index_name = H5.H5Tget_member_name (filetype_id, 0); + assertTrue("Incorrect name for member index", index_name.compareTo("Lon")==0); + + // Query member offset by member no + long index_offset = H5.H5Tget_member_offset (filetype_id, 1); + assertTrue("Incorrect offset for member no", index_offset == 8); + + // Query member type by member index + long index_type = H5.H5Tget_member_type (filetype_id, 0); + assertTrue("Incorrect type for member index", H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type)); + if (index_type >= 0) + try {H5.H5Tclose(index_type);} catch (Exception ex) {} + + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcompound_functions:query " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + +} diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java new file mode 100644 index 00000000000..950f1c7942a --- /dev/null +++ b/java/test/TestH5Tbasic.java @@ -0,0 +1,161 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Tbasic { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void testH5Tcopy() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy",H5strdid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcopy: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tequal() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy",H5strdid > 0); + boolean teq = H5.H5Tequal(HDF5Constants.H5T_C_S1, H5strdid); + assertTrue("H5.H5Tequal",teq); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tequal: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tequal_not() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE); + assertTrue("H5.H5Tcopy",H5strdid > 0); + boolean teq = H5.H5Tequal(HDF5Constants.H5T_IEEE_F32BE, H5strdid); + assertFalse("H5.H5Tequal",teq); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tequal_not: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tconvert() { + String[] strs = {"a1234","b1234"}; + int srcLen = 5; + int dstLen = 10; + long srcId = -1; + long dstId = -1; + int dimSize = strs.length; + byte[] buf = new byte[dimSize*dstLen]; + + for (int i=0; i 0); + H5.H5Tset_size(H5strdid, (long)5); + assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid)); + H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_NONE); + assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid)); + assertTrue(5 == H5.H5Tget_size(H5strdid)); + + // Variable length string + H5.H5Tset_size(H5strdid, HDF5Constants.H5T_VARIABLE); + H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_BE); + assertTrue(HDF5Constants.H5T_ORDER_BE == H5.H5Tget_order(H5strdid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Torder: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java new file mode 100644 index 00000000000..15cc6affd01 --- /dev/null +++ b/java/test/TestH5Tparams.java @@ -0,0 +1,389 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Tparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Tclose_invalid() throws Throwable { + long tid = H5.H5Tclose(-1); + assertTrue(tid == 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcopy_invalid() throws Throwable { + H5.H5Tcopy(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tequal_invalid() throws Throwable { + H5.H5Tequal(-1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tlock_invalid() throws Throwable { + H5.H5Tlock(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_class_invalid() throws Throwable { + H5.H5Tget_class(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_size_invalid() throws Throwable { + H5.H5Tget_size(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_size_invalid() throws Throwable { + H5.H5Tset_size(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_order_invalid() throws Throwable { + H5.H5Tget_order(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_order_invalid() throws Throwable { + H5.H5Tset_order(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_precision_invalid() throws Throwable { + H5.H5Tget_precision(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_precision_long_invalid() throws Throwable { + H5.H5Tget_precision_long(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_precision_invalid() throws Throwable { + H5.H5Tset_precision(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_offset_invalid() throws Throwable { + H5.H5Tget_offset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_offset_invalid() throws Throwable { + H5.H5Tset_offset(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcreate_invalid() throws Throwable { + H5.H5Tcreate(-1, (long)0); + } + + @Test(expected = NullPointerException.class) + public void testH5Topen_null() throws Throwable { + H5.H5Topen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Topen_invalid() throws Throwable { + H5.H5Topen(-1, "Bogus", 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Tcommit_null() throws Throwable { + H5.H5Tcommit(-1, null, 0, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcommit_invalid() throws Throwable { + H5.H5Tcommit(-1, "Bogus", -1, -1, -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_pad_null() throws Throwable { + H5.H5Tget_pad(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_pad_invalid() throws Throwable { + int[] pad = new int[2]; + H5.H5Tget_pad(-1, pad); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_pad_invalid() throws Throwable { + H5.H5Tset_pad(-1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_sign_invalid() throws Throwable { + H5.H5Tget_sign(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_sign_invalid() throws Throwable { + H5.H5Tset_sign(-1, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_fields_null() throws Throwable { + H5.H5Tget_fields(-1, (long[])null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tget_fields_length_invalid() throws Throwable { + long[] fields = new long[2]; + H5.H5Tget_fields(-1, fields); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_fields_invalid() throws Throwable { + long[] fields = new long[5]; + H5.H5Tget_fields(-1, fields); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_fields_invalid() throws Throwable { + H5.H5Tset_fields(-1, -1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_ebias_invalid() throws Throwable { + H5.H5Tget_ebias(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_ebias_long_invalid() throws Throwable { + H5.H5Tget_ebias_long(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_ebias_invalid() throws Throwable { + H5.H5Tset_ebias(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_norm_invalid() throws Throwable { + H5.H5Tget_norm(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_norm_invalid() throws Throwable { + H5.H5Tset_norm(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_inpad_invalid() throws Throwable { + H5.H5Tget_inpad(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_inpad_invalid() throws Throwable { + H5.H5Tset_inpad(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_cset_invalid() throws Throwable { + H5.H5Tget_cset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_cset_invalid() throws Throwable { + H5.H5Tset_cset(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_strpad_invalid() throws Throwable { + H5.H5Tget_strpad(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_strpad_invalid() throws Throwable { + H5.H5Tset_strpad(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_nmembers_invalid() throws Throwable { + H5.H5Tget_nmembers(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_member_index_null() throws Throwable { + H5.H5Tget_member_index(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_index_invalid() throws Throwable { + H5.H5Tget_member_index(-1, "Bogus"); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_type_invalid() throws Throwable { + H5.H5Tget_member_type(-1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_class_invalid() throws Throwable { + H5.H5Tget_member_class(-1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tinsert_null() throws Throwable { + H5.H5Tinsert(-1, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tinsert_invalid() throws Throwable { + H5.H5Tinsert(-1, "Bogus", 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tpack_invalid() throws Throwable { + H5.H5Tpack(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tvlen_create_invalid() throws Throwable { + H5.H5Tvlen_create(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tset_tag_null() throws Throwable { + H5.H5Tset_tag(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_tag_invalid() throws Throwable { + H5.H5Tset_tag(-1, "Bogus"); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_super_invalid() throws Throwable { + H5.H5Tget_super(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_create_invalid() throws Throwable { + H5.H5Tenum_create(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_insert_name_null() throws Throwable { + H5.H5Tenum_insert(-1, null, (byte[])null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_insert_null() throws Throwable { + H5.H5Tenum_insert(-1, "bogus", (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_insert_invalid() throws Throwable { + byte[] enumtype = new byte[2]; + H5.H5Tenum_insert(-1, "bogus", enumtype); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tenum_nameof_invalid_size() throws Throwable { + H5.H5Tenum_nameof(-1, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_nameof_value_null() throws Throwable { + H5.H5Tenum_nameof(-1, null, 1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_nameof_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tenum_nameof(-1, btype, 1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_valueof_name_null() throws Throwable { + H5.H5Tenum_valueof(-1, null, (byte[])null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_valueof_null() throws Throwable { + H5.H5Tenum_valueof(-1, "bogus", (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_valueof_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tenum_valueof(-1, "bogus", btype); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_member_value_null() throws Throwable { + H5.H5Tget_member_value(-1, -1, (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_value_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tget_member_value(-1, -1, btype); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tarray_create_invalid() throws Throwable { + H5.H5Tarray_create(-1, -1, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tarray_create_value_null() throws Throwable { + H5.H5Tarray_create(-1, 1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_array_ndims_invalid() throws Throwable { + H5.H5Tget_array_ndims(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_array_dims_null() throws Throwable { + H5.H5Tget_array_dims(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_native_type_invalid() throws Throwable { + H5.H5Tget_native_type(-1); + } + +} diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java new file mode 100644 index 00000000000..bdf3f1dde73 --- /dev/null +++ b/java/test/TestH5Z.java @@ -0,0 +1,100 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Z { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void testH5Zfilter_avail() { + try { + int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); + assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); + assertTrue("H5.H5Zfilter_avail_NBIT", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); +// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); +// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Zfilter_avail " + err); + } + } + + @Test + public void testH5Zget_filter_info() { + try { + int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); + assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); +// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); +// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); +// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Zget_filter_info " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Zunregister_predefined() throws Throwable { + int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zfilter_avail", filter_found > 0); + + H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); + } +} diff --git a/java/test/h5ex_g_iterate.hdf b/java/test/h5ex_g_iterate.hdf new file mode 100644 index 0000000000000000000000000000000000000000..e4627035fb4a95d6779c38d053eea6eb3c6607be GIT binary patch literal 2928 zcmeHIJ5B>J5PjYa!3siJs1TLQv~YqTd0`6_A~pv|Ny!l+(ZCHTDY*<1CC8woKmyN? z5X3GO5J*N^&&M+!`|XT2-fj;>-lKy8IV&=}D4lQ2>*jK!&Q1+e6(*`z<-v$W zwfD_Wxv`@?kzy@E91A~IyRH9V0sn-LPs>S;%T187tY{e#XsWkIz31=WKMo0?dUz5YzZ!zp<$616 zJ34*q+x=|1(EHEo_~Sl;F7spo?aMCgtV5UkS_WVZo<)~seDqxVzDVcn@F@b14t?R` zX5o$8L*lYr5ViM)H2P$1U_0d}BHP9Duma9l|EWQCH_K*qIZ#s*9zd7{wMc|_M)R8J oJMpFzhWE9=%4x~|8QyolfVcFqd%O4ldOy*xT?C5t{@gZR0g_@_i~s-t literal 0 HcmV?d00001 diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in new file mode 100644 index 00000000000..6878b3b2188 --- /dev/null +++ b/java/test/junit.sh.in @@ -0,0 +1,234 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=JUnitInterface +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="$top_builddir/java/lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/test" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@test.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/hamcrest-core.jar +$HDFLIB_HOME/junit.jar +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.hdf +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.hdf + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll) + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 new file mode 100644 index 00000000000..098aa77290b --- /dev/null +++ b/m4/ax_check_class.m4 @@ -0,0 +1,144 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASS +# +# DESCRIPTION +# +# AX_CHECK_CLASS tests the existence of a given Java class, either in a +# jar or in a '.class' file. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) +AC_DEFUN([AX_CHECK_CLASS],[ +AC_REQUIRE([AX_PROG_JAVA]) +ac_var_name=`echo $1 | sed 's/\./_/g'` +dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is +dnl dynamic I need an extra level of extraction +AC_MSG_CHECKING([for $1 class]) +AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ +if test x$ac_cv_prog_uudecode_base64 = xyes; then +dnl /** +dnl * Test.java: used to test dynamicaly if a class exists. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl Class lib; +dnl if (argv.length < 1) +dnl { +dnl System.err.println ("Missing argument"); +dnl System.exit (77); +dnl } +dnl try +dnl { +dnl lib = Class.forName (argv[0]); +dnl } +dnl catch (ClassNotFoundException e) +dnl { +dnl System.exit (1); +dnl } +dnl lib = null; +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ +AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt +ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV +ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp +VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM +amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi +AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B +AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA +AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN +uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK +AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA +JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA +JwAAAAIAKA== +==== +EOF + if $UUDECODE Test.uue; then + : + else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD + echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD + cat Test.uue >&AS_MESSAGE_LOG_FD + ac_cv_prog_uudecode_base64=no + fi + rm -f Test.uue + if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then + eval "ac_cv_class_$ac_var_name=yes" + else + eval "ac_cv_class_$ac_var_name=no" + fi + rm -f Test.class +else + AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], + [eval "ac_cv_class_$ac_var_name=no"]) +fi +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" +HAVE_LAST_CLASS=$ac_var_val +if test x$ac_var_val = xyes; then + ifelse([$2], , :, [$2]) +else + ifelse([$3], , :, [$3]) +fi +]) +dnl for some reason the above statment didn't fall though here? +dnl do scripts have variable scoping? +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +AC_MSG_RESULT($ac_var_val) +]) diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 new file mode 100644 index 00000000000..3c9081a0870 --- /dev/null +++ b/m4/ax_check_classpath.m4 @@ -0,0 +1,60 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASSPATH +# +# DESCRIPTION +# +# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of +# the user. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) +AC_DEFUN([AX_CHECK_CLASSPATH],[ +if test "x$CLASSPATH" = x; then + echo "You have no CLASSPATH, I hope it is good" +else + echo "You have CLASSPATH $CLASSPATH, hope it is correct" +fi +]) diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 new file mode 100644 index 00000000000..cfe8f58928d --- /dev/null +++ b/m4/ax_check_java_home.m4 @@ -0,0 +1,80 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_JAVA_HOME +# +# DESCRIPTION +# +# Check for Sun Java (JDK / JRE) installation, where the 'java' VM is in. +# If found, set environment variable JAVA_HOME = Java installation home, +# else left JAVA_HOME untouch, which in most case means JAVA_HOME is +# empty. +# +# LICENSE +# +# Copyright (c) 2008 Gleen Salmon +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) + +AC_DEFUN([AX_CHECK_JAVA_HOME], +[AC_MSG_CHECKING([for JAVA_HOME]) +# We used a fake loop so that we can use "break" to exit when the result +# is found. +while true +do + # If the user defined JAVA_HOME, don't touch it. + test "${JAVA_HOME+set}" = set && break + + # On Mac OS X 10.5 and following, run /usr/libexec/java_home to get + # the value of JAVA_HOME to use. + # (http://developer.apple.com/library/mac/#qa/qa2001/qa1170.html). + JAVA_HOME=`/usr/libexec/java_home 2>/dev/null` + test x"$JAVA_HOME" != x && break + + # See if we can find the java executable, and compute from there. + TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1` + if test x$TRY_JAVA_HOME != x; then + PATH=$PATH:$TRY_JAVA_HOME/bin + fi + AC_PATH_PROG([JAVA_PATH_NAME], [java]) + if test "x$JAVA_PATH_NAME" != x; then + JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java.*/\1/"` + break + fi + + AC_MSG_NOTICE([Could not compute JAVA_HOME]) + break +done +AC_MSG_RESULT([$JAVA_HOME]) +]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 new file mode 100644 index 00000000000..39b52d1f735 --- /dev/null +++ b/m4/ax_check_junit.m4 @@ -0,0 +1,70 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_JUNIT +# +# DESCRIPTION +# +# AX_CHECK_JUNIT tests the availability of the Junit testing framework, +# and set some variables for conditional compilation of the test suite by +# automake. +# +# If available, JUNIT is set to a command launching the text based user +# interface of Junit, @JAVA_JUNIT@ is set to $JAVA_JUNIT and @TESTS_JUNIT@ +# is set to $TESTS_JUNIT, otherwise they are set to empty values. +# +# You can use these variables in your Makefile.am file like this : +# +# # Some of the following classes are built only if junit is available +# JAVA_JUNIT = Class1Test.java Class2Test.java AllJunitTests.java +# +# noinst_JAVA = Example1.java Example2.java @JAVA_JUNIT@ +# +# EXTRA_JAVA = $(JAVA_JUNIT) +# +# TESTS_JUNIT = AllJunitTests +# +# TESTS = StandaloneTest1 StandaloneTest2 @TESTS_JUNIT@ +# +# EXTRA_TESTS = $(TESTS_JUNIT) +# +# AllJunitTests : +# echo "#! /bin/sh" > $@ +# echo "exec @JUNIT@ my.package.name.AllJunitTests" >> $@ +# chmod +x $@ +# +# LICENSE +# +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) +AC_DEFUN([AX_CHECK_JUNIT],[ +AC_CACHE_VAL(ac_cv_prog_JUNIT,[ +AC_CHECK_CLASS(junit.textui.TestRunner) +if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then + ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner' +fi]) +AC_MSG_CHECKING([for junit]) +if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then + JUNIT="$ac_cv_prog_JUNIT" + JAVA_JUNIT='$(JAVA_JUNIT)' + TESTS_JUNIT='$(TESTS_JUNIT)' +else + JUNIT= + JAVA_JUNIT= + TESTS_JUNIT= +fi +AC_MSG_RESULT($JAVA_JUNIT) +AC_SUBST(JUNIT) +AC_SUBST(JAVA_JUNIT) +AC_SUBST(TESTS_JUNIT)]) diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 new file mode 100644 index 00000000000..8f14241b1bc --- /dev/null +++ b/m4/ax_check_rqrd_class.m4 @@ -0,0 +1,62 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_RQRD_CLASS +# +# DESCRIPTION +# +# AX_CHECK_RQRD_CLASS tests the existence of a given Java class, either in +# a jar or in a '.class' file and fails if it doesn't exist. Its success +# or failure can depend on a proper setting of the CLASSPATH env. +# variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) +AC_DEFUN([AX_CHECK_RQRD_CLASS],[ +CLASS=`echo $1|sed 's/\./_/g'` +AC_CHECK_CLASS($1) +if test "$HAVE_LAST_CLASS" = "no"; then + AC_MSG_ERROR([Required class $1 missing, exiting.]) +fi +]) diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 new file mode 100644 index 00000000000..917638ae4b9 --- /dev/null +++ b/m4/ax_java_check_class.m4 @@ -0,0 +1,85 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JAVA_CHECK_CLASS(,,) +# +# DESCRIPTION +# +# Test if a Java class is available. Based on AX_PROG_JAVAC_WORKS. This +# version uses a cache variable which is both compiler, options and +# classpath dependent (so if you switch from javac to gcj it correctly +# notices and redoes the test). +# +# The macro tries to compile a minimal program importing . Some +# newer compilers moan about the failure to use this but fail or produce a +# class file anyway. All moaing is sunk to /dev/null since I only wanted +# to know if the class could be imported. This is a recommended followup +# to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. +# +# LICENSE +# +# Copyright (c) 2008 Duncan Simpson +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) +AC_DEFUN([AX_JAVA_CHECK_CLASS],[ +m4_define([cache_val],[m4_translit(ax_cv_have_java_class_$1, " ." ,"__")]) +if test "x$CLASSPATH" != "x"; then +xtra=" with classpath ${CLASSPATH}" +xopts=`echo ${CLASSPATH} | ${SED} 's/^ *://'` +xopts="-classpath $xopts" +else xtra=""; xopts=""; fi +cache_var="cache_val"AS_TR_SH([_Jc_${JAVAC}_Cp_${CLASSPATH}]) +AC_CACHE_CHECK([if the $1 class is available$xtra], [$cache_var], [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]xline __oline__ "configure" */ +import $1; +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $xopts $JAVA_TEST) >/dev/null 2>&1; then + eval "${cache_var}=yes" +else + eval "${cache_var}=no" + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +if eval 'test "x$'${cache_var}'" = "xyes"'; then +$2 +true; else +$3 +false; fi]) diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 new file mode 100644 index 00000000000..36c10d922bd --- /dev/null +++ b/m4/ax_java_options.m4 @@ -0,0 +1,48 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JAVA_OPTIONS +# +# DESCRIPTION +# +# AX_JAVA_OPTIONS adds configure command line options used for Java m4 +# macros. This Macro is optional. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) +AC_DEFUN([AX_JAVA_OPTIONS],[ +AC_ARG_WITH(java-prefix, + [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) +AC_ARG_WITH(javac-flags, + [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) +AC_ARG_WITH(java-flags, + [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) +JAVAPREFIX=$with_java_prefix +JAVACFLAGS=$with_javac_flags +JAVAFLAGS=$with_java_flags +AC_SUBST(JAVAPREFIX)dnl +AC_SUBST(JAVACFLAGS)dnl +AC_SUBST(JAVAFLAGS)dnl +AC_SUBST(JAVA)dnl +AC_SUBST(JAVAC)dnl +]) diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 new file mode 100644 index 00000000000..becb33a34a9 --- /dev/null +++ b/m4/ax_jni_include_dir.m4 @@ -0,0 +1,132 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JNI_INCLUDE_DIR +# +# DESCRIPTION +# +# AX_JNI_INCLUDE_DIR finds include directories needed for compiling +# programs using the JNI interface. +# +# JNI include directories are usually in the Java distribution. This is +# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in +# that order. When this macro completes, a list of directories is left in +# the variable JNI_INCLUDE_DIRS. +# +# Example usage follows: +# +# AX_JNI_INCLUDE_DIR +# +# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS +# do +# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" +# done +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_JNI_INCLUDE_DIR +# +# - at the configure level, setenv JAVAC +# +# Note: This macro can work with the autoconf M4 macros for Java programs. +# This particular macro is not part of the original set of macros. +# +# LICENSE +# +# Copyright (c) 2008 Don Anderson +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) +AC_DEFUN([AX_JNI_INCLUDE_DIR],[ + +JNI_INCLUDE_DIRS="" + +if test "x$JAVA_HOME" != x; then + _JTOPDIR="$JAVA_HOME" +else + if test "x$JAVAC" = x; then + JAVAC=javac + fi + AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no]) + if test "x$_ACJNI_JAVAC" = xno; then + AC_MSG_ERROR([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME]) + fi + _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") + _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` +fi + +case "$host_os" in + darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere + case "$_JTOPDIR" in + /System/Library/Frameworks/JavaVM.framework/*) + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + _JINC="$_JTOPDIR/Headers";; + *) _JINC="$_JTOPDIR/include";; + esac;; + *) _JINC="$_JTOPDIR/include";; +esac +_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) +_AS_ECHO_LOG([_JINC=$_JINC]) + +# On Mac OS X 10.6.4, jni.h is a symlink: +# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h +# -> ../../CurrentJDK/Headers/jni.h. +AC_CHECK_FILE([$_JINC/jni.h], + [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], + [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + AC_CHECK_FILE([$_JTOPDIR/include/jni.h], + [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], + AC_MSG_ERROR([cannot find JDK header files])) + ]) + +# get the likely subdirectories for system specific java includes +case "$host_os" in +bsdi*) _JNI_INC_SUBDIRS="bsdos";; +freebsd*) _JNI_INC_SUBDIRS="freebsd";; +darwin*) _JNI_INC_SUBDIRS="darwin";; +linux*) _JNI_INC_SUBDIRS="linux genunix";; +osf*) _JNI_INC_SUBDIRS="alpha";; +solaris*) _JNI_INC_SUBDIRS="solaris";; +mingw*) _JNI_INC_SUBDIRS="win32";; +cygwin*) _JNI_INC_SUBDIRS="win32";; +*) _JNI_INC_SUBDIRS="genunix";; +esac + +# add any subdirectories that are present +for JINCSUBDIR in $_JNI_INC_SUBDIRS +do + if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" + fi +done +]) + +# _ACJNI_FOLLOW_SYMLINKS +# Follows symbolic links on , +# finally setting variable _ACJNI_FOLLOWED +# ---------------------------------------- +AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ +# find the include directory relative to the javac executable +_cur="$1" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + AC_MSG_CHECKING([symlink for $_cur]) + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; + esac + AC_MSG_RESULT([$_cur]) +done +_ACJNI_FOLLOWED="$_cur" +])# _ACJNI diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 new file mode 100644 index 00000000000..3c60fcaf2d4 --- /dev/null +++ b/m4/ax_prog_jar.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAR +# +# DESCRIPTION +# +# AX_PROG_JAR tests for an existing jar program. It uses the environment +# variable JAR then tests in sequence various common jar programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AX_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) +AC_DEFUN([AX_PROG_JAR],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 new file mode 100644 index 00000000000..03961db5b73 --- /dev/null +++ b/m4/ax_prog_java.m4 @@ -0,0 +1,115 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA +# +# DESCRIPTION +# +# Here is a summary of the main macros: +# +# AX_PROG_JAVAC: finds a Java compiler. +# +# AX_PROG_JAVA: finds a Java virtual machine. +# +# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). +# +# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops +# otherwise. +# +# AX_TRY_COMPILE_JAVA: attempt to compile user given source. +# +# AX_TRY_RUN_JAVA: attempt to compile and run user given source. +# +# AX_JAVA_OPTIONS: adds Java configure options. +# +# AX_PROG_JAVA tests an existing Java virtual machine. It uses the +# environment variable JAVA then tests in sequence various common Java +# virtual machines. For political reasons, it starts with the free ones. +# You *must* call [AX_PROG_JAVAC] before. +# +# If you want to force a specific VM: +# +# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA +# +# (but after AC_INIT) +# +# - at the configure level, setenv JAVA +# +# You can use the JAVA variable in your Makefile.in, with @JAVA@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude virtual machines (rationale: most Java programs +# cannot run with some VM like kaffe). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# A Web page, with a link to the latest CVS snapshot is at +# . +# +# This is a sample configure.in Process this file with autoconf to produce +# a configure script. +# +# AC_INIT(UnTag.java) +# +# dnl Checks for programs. +# AC_CHECK_CLASSPATH +# AX_PROG_JAVAC +# AX_PROG_JAVA +# +# dnl Checks for classes +# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) +# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) +# +# AC_OUTPUT(Makefile) +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) +AC_DEFUN([AX_PROG_JAVA],[ +m4_define([m4_ax_prog_java_list], [kaffe java])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) +test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +m4_undefine([m4_ax_prog_java_list])dnl +AX_PROG_JAVA_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 new file mode 100644 index 00000000000..3df064ff663 --- /dev/null +++ b/m4/ax_prog_java_cc.m4 @@ -0,0 +1,104 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_CC +# +# DESCRIPTION +# +# Finds the appropriate java compiler on your path. By preference the java +# compiler is gcj, then jikes then javac. +# +# The macro can take one argument specifying a space separated list of +# java compiler names. +# +# For example: +# +# AX_PROG_JAVA_CC(javac, gcj) +# +# The macro also sets the compiler options variable: JAVA_CC_OPTS to +# something sensible: +# +# - for GCJ it sets it to: @GCJ_OPTS@ +# (if GCJ_OPTS is not yet defined then it is set to "-C") +# +# - no other compiler has applicable options yet +# +# Here's an example configure.in: +# +# AC_INIT(Makefile.in) +# AX_PROG_JAVA_CC() +# AC_OUTPUT(Makefile) +# dnl End. +# +# And here's the start of the Makefile.in: +# +# PROJECT_ROOT := @srcdir@ +# # Tool definitions. +# JAVAC := @JAVA_CC@ +# JAVAC_OPTS := @JAVA_CC_OPTS@ +# JAR_TOOL := @jar_tool@ +# +# LICENSE +# +# Copyright (c) 2008 Nic Ferrier +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 4 + +# AX_PROG_JAVA_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of java compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the java compiler. +AU_ALIAS([AC_PROG_JAVA_CC], [AX_PROG_JAVA_CC]) +AC_DEFUN([AX_PROG_JAVA_CC], +[AC_ARG_VAR([JAVA_CC], [java compiler command])dnl +AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(JAVA_CC, [$1])], +[AC_CHECK_TOOL(JAVA_CC, gcj) +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, javac) +fi +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, jikes) +fi +]) + +if test "$JAVA_CC" = "gcj"; then + if test "$GCJ_OPTS" = ""; then + AC_SUBST(GCJ_OPTS,-C) + fi + AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@, + [Define the compilation options for GCJ]) +fi +test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH]) +])# AX_PROG_JAVA_CC diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 new file mode 100644 index 00000000000..54e132afae6 --- /dev/null +++ b/m4/ax_prog_java_works.m4 @@ -0,0 +1,134 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) +AC_DEFUN([AX_PROG_JAVA_WORKS], [ +AC_PATH_PROG(UUDECODE, uudecode, [no]) +if test x$UUDECODE != xno; then +AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ +dnl /** +dnl * Test.java: used to test if java compiler works. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s +YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG +aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB +AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB +AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= +==== +EOF +if $UUDECODE Test.uue; then + ac_cv_prog_uudecode_base64=yes +else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD + echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD + cat Test.uue >&AS_MESSAGE_LOG_FD + ac_cv_prog_uudecode_base64=no +fi +rm -f Test.uue]) +fi +if test x$ac_cv_prog_uudecode_base64 != xyes; then + rm -f Test.class + AC_MSG_WARN([I have to compile Test.class from scratch]) + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi + if test x$ac_cv_prog_javac_works = x; then + AX_PROG_JAVAC + fi +fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +TEST=Test +changequote(, )dnl +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +public static void main (String args[]) { + System.exit (0); +} } +EOF +changequote([, ])dnl +if test x$ac_cv_prog_uudecode_base64 != xyes; then + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +fi +if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -fr $JAVA_TEST $CLASS_TEST Test.uue +]) +AC_PROVIDE([$0])dnl +] +) diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 new file mode 100644 index 00000000000..d061243cdb0 --- /dev/null +++ b/m4/ax_prog_javac.m4 @@ -0,0 +1,79 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC +# +# DESCRIPTION +# +# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment +# variable JAVAC then tests in sequence various common Java compilers. For +# political reasons, it starts with the free ones. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_PROG_JAVAC +# +# - at the configure level, setenv JAVAC +# +# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude compilers (rationale: most Java programs cannot +# compile with some compilers like guavac). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) +AC_DEFUN([AX_PROG_JAVAC],[ +m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) +m4_undefine([m4_ax_prog_javac_list])dnl +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AX_PROG_JAVAC_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 new file mode 100644 index 00000000000..7dfa1e37d89 --- /dev/null +++ b/m4/ax_prog_javac_works.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) +AC_DEFUN([AX_PROG_JAVAC_WORKS],[ +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 new file mode 100644 index 00000000000..bcb6045a828 --- /dev/null +++ b/m4/ax_prog_javadoc.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVADOC +# +# DESCRIPTION +# +# AX_PROG_JAVADOC tests for an existing javadoc generator. It uses the +# environment variable JAVADOC then tests in sequence various common +# javadoc generator. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVADOC=yourgenerator before calling +# AX_PROG_JAVADOC +# +# - at the configure level, setenv JAVADOC +# +# You can use the JAVADOC variable in your Makefile.in, with @JAVADOC@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) +AC_DEFUN([AX_PROG_JAVADOC],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc])], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc], [], [$JAVAPREFIX/bin])]) +test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 new file mode 100644 index 00000000000..cefc616d4ca --- /dev/null +++ b/m4/ax_prog_javah.m4 @@ -0,0 +1,64 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAH +# +# DESCRIPTION +# +# AX_PROG_JAVAH tests the availability of the javah header generator and +# looks for the jni.h header file. If available, JAVAH is set to the full +# path of javah and CPPFLAGS is updated accordingly. +# +# LICENSE +# +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) +AC_DEFUN([AX_PROG_JAVAH],[ +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_PATH_PROG(JAVAH,javah) +AS_IF([test -n "$ac_cv_path_JAVAH"], + [ + AC_TRY_CPP([#include ],,[ + ac_save_CPPFLAGS="$CPPFLAGS" + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` + ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" + AS_CASE([$build_os], + [cygwin*], + [ac_machdep=win32], + [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) + CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" + AC_TRY_CPP([#include ], + ac_save_CPPFLAGS="$CPPFLAGS", + AC_MSG_WARN([unable to include ])) + CPPFLAGS="$ac_save_CPPFLAGS"]) + ]) +]) + +AC_DEFUN([_ACJAVAH_FOLLOW_SYMLINKS],[ +# find the include directory relative to the javac executable +_cur="$1" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + AC_MSG_CHECKING([symlink for $_cur]) + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; + esac + AC_MSG_RESULT([$_cur]) +done +_ACJAVAH_FOLLOWED="$_cur" +]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 new file mode 100644 index 00000000000..a8ed6b2a368 --- /dev/null +++ b/m4/ax_try_compile_java.m4 @@ -0,0 +1,55 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TRY_COMPILE_JAVA +# +# DESCRIPTION +# +# AX_TRY_COMPILE_JAVA attempt to compile user given source. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) +AC_DEFUN([AX_TRY_COMPILE_JAVA],[ +AC_REQUIRE([AX_PROG_JAVAC])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [import $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat Test.java >&AS_MESSAGE_LOG_FD +ifelse([$4], , , [ rm -fr Test.java Test.class + $4 +])dnl +fi +rm -fr Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 new file mode 100644 index 00000000000..c680f03f2c4 --- /dev/null +++ b/m4/ax_try_run_java.m4 @@ -0,0 +1,56 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TRY_RUN_JAVA +# +# DESCRIPTION +# +# AX_TRY_RUN_JAVA attempt to compile and run user given source. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) +AC_DEFUN([AX_TRY_RUN_JAVA],[ +AC_REQUIRE([AX_PROG_JAVAC])dnl +AC_REQUIRE([AX_PROG_JAVA])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [include $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat Test.java >&AS_MESSAGE_LOG_FD +ifelse([$4], , , [ rm -fr Test.java Test.class + $4 +])dnl +fi +rm -fr Test.java Test.class]) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3647eb976d1..7413e281dd4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -894,7 +894,7 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 3bb2936bd66..b54257f869f 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -60,6 +60,9 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @enable_shared@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@ + JAVA: @HDF_JAVA@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @JAVA_VERSION@ + Features: --------- Parallel HDF5: @PARALLEL@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d2dd2822b68..789844f7ac6 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,7 +51,7 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib") endif (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" @@ -96,7 +96,7 @@ endif (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG ) @@ -127,7 +127,7 @@ endif (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG )