summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-03-10 13:41:14 (GMT)
committerGitHub <noreply@github.com>2021-03-10 13:41:14 (GMT)
commitdd5b8a874757f23a1906d0a80ee77a112ad4a33d (patch)
tree93db0b67058adce2bf52c726a8745f6e2709ecd4 /java
parent2524ad19c0b375ead91b614baf85f556dfce2b41 (diff)
downloadhdf5-dd5b8a874757f23a1906d0a80ee77a112ad4a33d.zip
hdf5-dd5b8a874757f23a1906d0a80ee77a112ad4a33d.tar.gz
hdf5-dd5b8a874757f23a1906d0a80ee77a112ad4a33d.tar.bz2
1 10 Fix java data export functions (#450)
* HDFFV-10865 - merge from dev, HDFArray perf fix. * Remove duplicate setting * Whitespace changes after clang format * Undo version 11 clang format changes * Merge CMake changes from develop * test testing script merge from develop * Update supported platforms * PR#3 merge from develop * Merge gcc 10 diagnostics option from develop * Merge #318 OSX changes from develop * Merge small changes from develop * Minor non-space formatting changes * #386 copyright corrections for java folder * Merges from develop #358 patches from vtk #361 fix header guard spelling * Merge updates #358 patches from vtk #361 fix header guard spelling * format fix * Fix missing underscore and make H5public.h closer to dev * Merges from develop #340 clang -Wformat-security warnings #360 Fixed uninitialized warnings header guard underscore cleanup JNI cleanup * format alignment * Add missing test ref file * Merge #380 from develop * Finish java merges from develop * Fix java issues with tests and javadoc * Correct use of attribute access plist * Remove debug code * Remove unused variable * Change file access to read only for java tests * Split clang format operations. * More javadoc comments * Remove pre-split setting * format source
Diffstat (limited to 'java')
-rw-r--r--java/examples/datasets/H5Ex_D_Alloc.java10
-rw-r--r--java/examples/datasets/H5Ex_D_Checksum.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Chunk.java16
-rw-r--r--java/examples/datasets/H5Ex_D_Compact.java16
-rw-r--r--java/examples/datasets/H5Ex_D_External.java14
-rw-r--r--java/examples/datasets/H5Ex_D_FillValue.java8
-rw-r--r--java/examples/datasets/H5Ex_D_Gzip.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Hyperslab.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Nbit.java16
-rw-r--r--java/examples/datasets/H5Ex_D_ReadWrite.java10
-rw-r--r--java/examples/datasets/H5Ex_D_Shuffle.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Sofloat.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Soint.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Szip.java14
-rw-r--r--java/examples/datasets/H5Ex_D_Transform.java14
-rw-r--r--java/examples/datasets/H5Ex_D_UnlimitedAdd.java20
-rw-r--r--java/examples/datasets/H5Ex_D_UnlimitedGzip.java22
-rw-r--r--java/examples/datasets/H5Ex_D_UnlimitedMod.java20
-rw-r--r--java/examples/datatypes/H5Ex_T_Array.java18
-rw-r--r--java/examples/datatypes/H5Ex_T_ArrayAttribute.java24
-rw-r--r--java/examples/datatypes/H5Ex_T_Bit.java12
-rw-r--r--java/examples/datatypes/H5Ex_T_BitAttribute.java18
-rw-r--r--java/examples/datatypes/H5Ex_T_Commit.java12
-rw-r--r--java/examples/datatypes/H5Ex_T_Compound.java22
-rw-r--r--java/examples/datatypes/H5Ex_T_CompoundAttribute.java28
-rw-r--r--java/examples/datatypes/H5Ex_T_Float.java12
-rw-r--r--java/examples/datatypes/H5Ex_T_FloatAttribute.java18
-rw-r--r--java/examples/datatypes/H5Ex_T_Integer.java12
-rw-r--r--java/examples/datatypes/H5Ex_T_IntegerAttribute.java18
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReference.java24
-rw-r--r--java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java28
-rw-r--r--java/examples/datatypes/H5Ex_T_Opaque.java18
-rw-r--r--java/examples/datatypes/H5Ex_T_OpaqueAttribute.java22
-rw-r--r--java/examples/datatypes/H5Ex_T_String.java20
-rw-r--r--java/examples/datatypes/H5Ex_T_StringAttribute.java26
-rw-r--r--java/examples/datatypes/H5Ex_T_VLString.java14
-rw-r--r--java/examples/groups/H5Ex_G_Compact.java6
-rw-r--r--java/examples/groups/H5Ex_G_Corder.java8
-rw-r--r--java/examples/groups/H5Ex_G_Create.java4
-rw-r--r--java/examples/groups/H5Ex_G_Intermediate.java6
-rw-r--r--java/examples/groups/H5Ex_G_Iterate.java2
-rw-r--r--java/examples/groups/H5Ex_G_Phase.java10
-rw-r--r--java/examples/groups/H5Ex_G_Traverse.java2
-rw-r--r--java/examples/groups/H5Ex_G_Visit.java2
-rw-r--r--java/examples/intro/H5_CreateAttribute.java8
-rw-r--r--java/examples/intro/H5_CreateDataset.java6
-rw-r--r--java/examples/intro/H5_CreateFile.java2
-rw-r--r--java/examples/intro/H5_CreateGroup.java4
-rw-r--r--java/examples/intro/H5_CreateGroupAbsoluteRelative.java8
-rw-r--r--java/examples/intro/H5_CreateGroupDataset.java16
-rw-r--r--java/examples/intro/H5_ReadWrite.java6
-rw-r--r--java/src/hdf/hdf5lib/H5.java27
-rw-r--r--java/src/hdf/hdf5lib/HDF5Constants.java9
-rw-r--r--java/src/hdf/hdf5lib/HDF5GroupInfo.java21
-rw-r--r--java/src/hdf/hdf5lib/HDFArray.java502
-rw-r--r--java/src/hdf/hdf5lib/structs/H5A_info_t.java12
-rw-r--r--java/src/jni/h5Constants.c8
-rw-r--r--java/src/jni/h5dImp.c2
-rw-r--r--java/src/jni/h5util.c202
-rw-r--r--java/src/jni/h5util.h14
-rw-r--r--java/test/CMakeLists.txt2
-rw-r--r--java/test/TestH5.java162
-rw-r--r--java/test/TestH5A.java119
-rw-r--r--java/test/TestH5D.java42
-rw-r--r--java/test/TestH5Dplist.java8
-rw-r--r--java/test/TestH5E.java1
-rw-r--r--java/test/TestH5F.java12
-rw-r--r--java/test/TestH5Fbasic.java16
-rw-r--r--java/test/TestH5Fparams.java12
-rw-r--r--java/test/TestH5Fswmr.java12
-rw-r--r--java/test/TestH5G.java22
-rw-r--r--java/test/TestH5Gbasic.java16
-rw-r--r--java/test/TestH5Giterate.java6
-rw-r--r--java/test/TestH5Lbasic.java2
-rw-r--r--java/test/TestH5Lcreate.java18
-rw-r--r--java/test/TestH5Obasic.java18
-rw-r--r--java/test/TestH5Ocopy.java40
-rw-r--r--java/test/TestH5Ocreate.java26
-rw-r--r--java/test/TestH5P.java30
-rw-r--r--java/test/TestH5PData.java10
-rw-r--r--java/test/TestH5PL.java10
-rw-r--r--java/test/TestH5Pfapl.java28
-rw-r--r--java/test/TestH5Pfaplhdfs.java10
-rw-r--r--java/test/TestH5Pfapls3.java10
-rw-r--r--java/test/TestH5Plist.java32
-rw-r--r--java/test/TestH5Pvirtual.java26
-rw-r--r--java/test/TestH5R.java72
-rw-r--r--java/test/TestH5S.java20
-rw-r--r--java/test/TestH5Sbasic.java24
-rw-r--r--java/test/TestH5T.java22
-rw-r--r--java/test/TestH5Tbasic.java12
-rw-r--r--java/test/junit.sh.in6
-rw-r--r--java/test/testfiles/JUnit-TestH5.txt4
93 files changed, 1309 insertions, 1038 deletions
diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java
index d0e8f81..4e10c23 100644
--- a/java/examples/datasets/H5Ex_D_Alloc.java
+++ b/java/examples/datasets/H5Ex_D_Alloc.java
@@ -64,11 +64,11 @@ public class H5Ex_D_Alloc {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id1 = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id2 = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
int space_status = 0;
diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java
index e0a1638..781dd68 100644
--- a/java/examples/datasets/H5Ex_D_Checksum.java
+++ b/java/examples/datasets/H5Ex_D_Checksum.java
@@ -92,10 +92,10 @@ public class H5Ex_D_Checksum {
}
private static void writeChecksum() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -192,9 +192,9 @@ public class H5Ex_D_Checksum {
}
private static void readChecksum() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java
index 74e7530..2ddf293 100644
--- a/java/examples/datasets/H5Ex_D_Chunk.java
+++ b/java/examples/datasets/H5Ex_D_Chunk.java
@@ -65,10 +65,10 @@ public class H5Ex_D_Chunk {
}
private static void writeChunk() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -200,10 +200,10 @@ public class H5Ex_D_Chunk {
}
private static void readChunk() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java
index 7751db9..0abf8da 100644
--- a/java/examples/datasets/H5Ex_D_Compact.java
+++ b/java/examples/datasets/H5Ex_D_Compact.java
@@ -59,10 +59,10 @@ public class H5Ex_D_Compact {
}
private static void writeCompact() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -162,10 +162,10 @@ public class H5Ex_D_Compact {
}
private static void readCompact() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open file and dataset using the default properties.
diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java
index 1797ec8..9c3787f 100644
--- a/java/examples/datasets/H5Ex_D_External.java
+++ b/java/examples/datasets/H5Ex_D_External.java
@@ -33,10 +33,10 @@ public class H5Ex_D_External {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -137,9 +137,9 @@ public class H5Ex_D_External {
}
private static void readExternal() {
- long file_id = -1;
- long dcpl_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
String[] Xname = new String[1];
diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java
index 4577249..3526993 100644
--- a/java/examples/datasets/H5Ex_D_FillValue.java
+++ b/java/examples/datasets/H5Ex_D_FillValue.java
@@ -39,10 +39,10 @@ public class H5Ex_D_FillValue {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] extdims = { EDIM_X, EDIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java
index 2529b47..404ff05 100644
--- a/java/examples/datasets/H5Ex_D_Gzip.java
+++ b/java/examples/datasets/H5Ex_D_Gzip.java
@@ -94,10 +94,10 @@ public class H5Ex_D_Gzip {
}
private static void writeGzip() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -195,9 +195,9 @@ public class H5Ex_D_Gzip {
}
private static void readGzip() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java
index e77493f..fa3473f 100644
--- a/java/examples/datasets/H5Ex_D_Hyperslab.java
+++ b/java/examples/datasets/H5Ex_D_Hyperslab.java
@@ -33,9 +33,9 @@ public class H5Ex_D_Hyperslab {
private static final int RANK = 2;
private static void writeHyperslab() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -141,10 +141,10 @@ public class H5Ex_D_Hyperslab {
}
private static void readHyperslab() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java
index fbb504b..35d23a9 100644
--- a/java/examples/datasets/H5Ex_D_Nbit.java
+++ b/java/examples/datasets/H5Ex_D_Nbit.java
@@ -95,11 +95,11 @@ public class H5Ex_D_Nbit {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -156,9 +156,9 @@ public class H5Ex_D_Nbit {
}
private static void readData() throws Exception {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java
index da9d0b4..db930d3 100644
--- a/java/examples/datasets/H5Ex_D_ReadWrite.java
+++ b/java/examples/datasets/H5Ex_D_ReadWrite.java
@@ -31,9 +31,9 @@ public class H5Ex_D_ReadWrite {
private static final int RANK = 2;
private static void WriteDataset() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -108,8 +108,8 @@ public class H5Ex_D_ReadWrite {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open file using the default properties.
diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java
index 85192bb..1dd7c6a 100644
--- a/java/examples/datasets/H5Ex_D_Shuffle.java
+++ b/java/examples/datasets/H5Ex_D_Shuffle.java
@@ -121,10 +121,10 @@ public class H5Ex_D_Shuffle {
}
private static void writeShuffle() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -228,9 +228,9 @@ public class H5Ex_D_Shuffle {
}
private static void readShuffle() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java
index c1365f7..a42aba4 100644
--- a/java/examples/datasets/H5Ex_D_Sofloat.java
+++ b/java/examples/datasets/H5Ex_D_Sofloat.java
@@ -95,10 +95,10 @@ public class H5Ex_D_Sofloat {
}
private static void writeData() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
double[][] dset_data = new double[DIM_X][DIM_Y];
@@ -212,9 +212,9 @@ public class H5Ex_D_Sofloat {
}
private static void readData() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
double[][] dset_data = new double[DIM_X][DIM_Y];
// Open file using the default properties.
diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java
index 2192cb9..dd7664f 100644
--- a/java/examples/datasets/H5Ex_D_Soint.java
+++ b/java/examples/datasets/H5Ex_D_Soint.java
@@ -95,10 +95,10 @@ public class H5Ex_D_Soint {
}
private static void writeData() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -194,9 +194,9 @@ public class H5Ex_D_Soint {
}
private static void readData() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open file using the default properties.
diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java
index ad04692..3fdc712 100644
--- a/java/examples/datasets/H5Ex_D_Szip.java
+++ b/java/examples/datasets/H5Ex_D_Szip.java
@@ -94,10 +94,10 @@ public class H5Ex_D_Szip {
}
private static void writeSzip() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -195,9 +195,9 @@ public class H5Ex_D_Szip {
}
private static void readSzip() {
- long file_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file.
diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java
index 0c63afd..069e80b 100644
--- a/java/examples/datasets/H5Ex_D_Transform.java
+++ b/java/examples/datasets/H5Ex_D_Transform.java
@@ -35,10 +35,10 @@ public class H5Ex_D_Transform {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dxpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
@@ -143,9 +143,9 @@ public class H5Ex_D_Transform {
private static void readData() {
- long file_id = -1;
- long dataset_id = -1;
- long dxpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dxpl_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset_data = new int[DIM_X][DIM_Y];
// Open an existing file using the default properties.
diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java
index 2e18b99..c82b2d6 100644
--- a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java
+++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java
@@ -38,10 +38,10 @@ public class H5Ex_D_UnlimitedAdd {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED };
@@ -142,9 +142,9 @@ public class H5Ex_D_UnlimitedAdd {
}
private static void extendUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] extdims = { EDIM_X, EDIM_Y };
long[] start = { 0, 0 };
@@ -292,9 +292,9 @@ public class H5Ex_D_UnlimitedAdd {
}
private static void readUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data;
diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java
index b651621..675b1ba 100644
--- a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java
+++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java
@@ -98,10 +98,10 @@ public class H5Ex_D_UnlimitedGzip {
}
private static void writeUnlimited() {
- long file_id = -1;
- long dcpl_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED };
@@ -199,9 +199,9 @@ public class H5Ex_D_UnlimitedGzip {
}
private static void extendUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] extdims = { EDIM_X, EDIM_Y };
long[] start = { 0, 0 };
@@ -349,10 +349,10 @@ public class H5Ex_D_UnlimitedGzip {
}
private static void readUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data;
diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java
index 68aecc4..273ac3e 100644
--- a/java/examples/datasets/H5Ex_D_UnlimitedMod.java
+++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java
@@ -38,10 +38,10 @@ public class H5Ex_D_UnlimitedMod {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] chunk_dims = { CHUNK_X, CHUNK_Y };
long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED };
@@ -142,9 +142,9 @@ public class H5Ex_D_UnlimitedMod {
}
private static void extendUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
long[] extdims = { EDIM_X, EDIM_Y };
int[][] dset_data;
@@ -278,9 +278,9 @@ public class H5Ex_D_UnlimitedMod {
}
private static void readUnlimited() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java
index 162ac89..3939b38 100644
--- a/java/examples/datatypes/H5Ex_T_Array.java
+++ b/java/examples/datatypes/H5Ex_T_Array.java
@@ -33,11 +33,11 @@ public class H5Ex_T_Array {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
long[] adims = { ADIM0, ADIM1 };
int[][][] dset_data = new int[DIM0][ADIM0][ADIM1];
@@ -151,10 +151,10 @@ public class H5Ex_T_Array {
}
private static void ReadDataset() {
- long file_id = -1;
- long filetype_id = -1;
- long memtype_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
long[] adims = { ADIM0, ADIM1 };
int[][][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
index 14ae9a4..c4c4bc4 100644
--- a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
@@ -34,12 +34,12 @@ public class H5Ex_T_ArrayAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
long[] adims = { ADIM0, ADIM1 };
int[][][] dset_data = new int[DIM0][ADIM0][ADIM1];
@@ -83,7 +83,7 @@ public class H5Ex_T_ArrayAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -174,11 +174,11 @@ public class H5Ex_T_ArrayAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
long[] adims = { ADIM0, ADIM1 };
int[][][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java
index 95968d0..45d4e8a 100644
--- a/java/examples/datatypes/H5Ex_T_Bit.java
+++ b/java/examples/datatypes/H5Ex_T_Bit.java
@@ -31,9 +31,9 @@ public class H5Ex_T_Bit {
private static final int RANK = 2;
private static void CreateDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data = new int[DIM0][DIM1];
@@ -115,9 +115,9 @@ public class H5Ex_T_Bit {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java
index e093453..9b33ca5 100644
--- a/java/examples/datatypes/H5Ex_T_BitAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java
@@ -32,10 +32,10 @@ public class H5Ex_T_BitAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data = new int[DIM0][DIM1];
@@ -65,7 +65,7 @@ public class H5Ex_T_BitAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -138,10 +138,10 @@ public class H5Ex_T_BitAttribute {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
- long attribute_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java
index 204b632..62db5ea 100644
--- a/java/examples/datatypes/H5Ex_T_Commit.java
+++ b/java/examples/datatypes/H5Ex_T_Commit.java
@@ -100,9 +100,9 @@ public class H5Ex_T_Commit {
}
private static void CreateDataType() {
- long file_id = -1;
- long strtype_id = -1;
- long filetype_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long strtype_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
Sensor_Datatype datatypes = new Sensor_Datatype();
// Create a new file using default properties.
try {
@@ -182,9 +182,9 @@ public class H5Ex_T_Commit {
}
private static void ReadDataType() {
- long file_id = -1;
- long typeclass_id = -1;
- long filetype_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long typeclass_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
// Open an existing file.
try {
diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java
index f0fe715..8c83ebb 100644
--- a/java/examples/datatypes/H5Ex_T_Compound.java
+++ b/java/examples/datatypes/H5Ex_T_Compound.java
@@ -121,12 +121,12 @@ public class H5Ex_T_Compound {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long strtype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
Sensor[] object_data = new Sensor[DIM0];
byte[] dset_data = null;
@@ -285,11 +285,11 @@ public class H5Ex_T_Compound {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long strtype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
Sensor[] object_data2;
byte[] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java
index d8fd4a1..58d2fb7 100644
--- a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java
@@ -124,13 +124,13 @@ public class H5Ex_T_CompoundAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long strtype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
Sensor[] object_data = new Sensor[DIM0];
byte[] dset_data = null;
@@ -204,7 +204,7 @@ public class H5Ex_T_CompoundAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -309,12 +309,12 @@ public class H5Ex_T_CompoundAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long strtype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
Sensor[] object_data2;
byte[] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java
index f907b1f..e8da7f6 100644
--- a/java/examples/datatypes/H5Ex_T_Float.java
+++ b/java/examples/datatypes/H5Ex_T_Float.java
@@ -35,9 +35,9 @@ public class H5Ex_T_Float {
private static final int RANK = 2;
private static void CreateDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
double[][] dset_data = new double[DIM0][DIM1];
@@ -119,9 +119,9 @@ public class H5Ex_T_Float {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
double[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java
index 32b5a94..eb8e1f8 100644
--- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java
@@ -36,10 +36,10 @@ public class H5Ex_T_FloatAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
double[][] dset_data = new double[DIM0][DIM1];
@@ -65,7 +65,7 @@ public class H5Ex_T_FloatAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -138,10 +138,10 @@ public class H5Ex_T_FloatAttribute {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
- long attribute_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
double[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java
index ddcc156..bb8e0cb 100644
--- a/java/examples/datatypes/H5Ex_T_Integer.java
+++ b/java/examples/datatypes/H5Ex_T_Integer.java
@@ -33,9 +33,9 @@ public class H5Ex_T_Integer {
private static final int RANK = 2;
private static void CreateDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data = new int[DIM0][DIM1];
@@ -116,9 +116,9 @@ public class H5Ex_T_Integer {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java
index 9024c9e..b0df5e4 100644
--- a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java
@@ -34,10 +34,10 @@ public class H5Ex_T_IntegerAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data = new int[DIM0][DIM1];
@@ -63,7 +63,7 @@ public class H5Ex_T_IntegerAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -136,10 +136,10 @@ public class H5Ex_T_IntegerAttribute {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
- long attribute_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0, DIM1 };
int[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java
index f561aa1..38536b8 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReference.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java
@@ -64,11 +64,11 @@ public class H5Ex_T_ObjectReference {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data = new byte[DIM0][8];
@@ -89,9 +89,9 @@ public class H5Ex_T_ObjectReference {
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
if (dataset_id >= 0)
H5.H5Dclose(dataset_id);
- dataset_id = -1;
+ dataset_id = HDF5Constants.H5I_INVALID_HID;
H5.H5Sclose(dataspace_id);
- dataspace_id = -1;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -105,7 +105,7 @@ public class H5Ex_T_ObjectReference {
HDF5Constants.H5P_DEFAULT);
if (group_id >= 0)
H5.H5Gclose(group_id);
- group_id = -1;
+ group_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Exception e) {
e.printStackTrace();
@@ -186,11 +186,11 @@ public class H5Ex_T_ObjectReference {
}
private static void readObjRef() {
- long file_id = -1;
- long dataset_id = -1;
- long dataspace_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
int object_type = -1;
- long object_id = -1;
+ long object_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
index 8d04454..b38b0a0 100644
--- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java
@@ -66,11 +66,11 @@ public class H5Ex_T_ObjectReferenceAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data = new byte[DIM0][8];
@@ -91,9 +91,9 @@ public class H5Ex_T_ObjectReferenceAttribute {
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
if (dataset_id >= 0)
H5.H5Dclose(dataset_id);
- dataset_id = -1;
+ dataset_id = HDF5Constants.H5I_INVALID_HID;
H5.H5Sclose(dataspace_id);
- dataspace_id = -1;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -107,7 +107,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
HDF5Constants.H5P_DEFAULT);
if (group_id >= 0)
H5.H5Gclose(group_id);
- group_id = -1;
+ group_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Exception e) {
e.printStackTrace();
@@ -138,7 +138,7 @@ public class H5Ex_T_ObjectReferenceAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -211,12 +211,12 @@ public class H5Ex_T_ObjectReferenceAttribute {
}
private static void ReadDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
- long attribute_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
int object_type = -1;
- long object_id = -1;
+ long object_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java
index c4ee39f..e851fb2 100644
--- a/java/examples/datatypes/H5Ex_T_Opaque.java
+++ b/java/examples/datatypes/H5Ex_T_Opaque.java
@@ -31,10 +31,10 @@ public class H5Ex_T_Opaque {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[] dset_data = new byte[DIM0 * LEN];
byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' };
@@ -137,11 +137,11 @@ public class H5Ex_T_Opaque {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long type_len = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[] dset_data;
String tag_name = null;
diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java
index 4407451..3e16ab4 100644
--- a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java
@@ -32,11 +32,11 @@ public class H5Ex_T_OpaqueAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[] dset_data = new byte[DIM0 * LEN];
byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' };
@@ -64,7 +64,7 @@ public class H5Ex_T_OpaqueAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -157,11 +157,11 @@ public class H5Ex_T_OpaqueAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long type_len = -1;
long[] dims = { DIM0 };
byte[] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java
index 7b63c35..e497bd8 100644
--- a/java/examples/datatypes/H5Ex_T_String.java
+++ b/java/examples/datatypes/H5Ex_T_String.java
@@ -31,11 +31,11 @@ public class H5Ex_T_String {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data = new byte[DIM0][SDIM];
StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"),
@@ -155,11 +155,11 @@ public class H5Ex_T_String {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long sdim = 0;
long[] dims = { DIM0 };
byte[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java
index 0c9d40c..700f6a9 100644
--- a/java/examples/datatypes/H5Ex_T_StringAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java
@@ -32,12 +32,12 @@ public class H5Ex_T_StringAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM0 };
byte[][] dset_data = new byte[DIM0][SDIM];
StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"),
@@ -79,7 +79,7 @@ public class H5Ex_T_StringAttribute {
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;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
}
catch (Exception e) {
@@ -178,12 +178,12 @@ public class H5Ex_T_StringAttribute {
}
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long sdim = 0;
long[] dims = { DIM0 };
byte[][] dset_data;
diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java
index 933b0b4..8a29e60 100644
--- a/java/examples/datatypes/H5Ex_T_VLString.java
+++ b/java/examples/datatypes/H5Ex_T_VLString.java
@@ -25,10 +25,10 @@ public class H5Ex_T_VLString
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;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long type_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
int rank = 1;
String[] str_data = { "Parting", "is such", "sweet", "sorrow." };
long[] dims = { str_data.length };
@@ -92,9 +92,9 @@ public class H5Ex_T_VLString
}
private static void readDataset() {
- long file_id = -1;
- long type_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long type_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
String[] str_data = { "", "", "", "" };
try {
diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java
index 0ae98c9..313c9c7 100644
--- a/java/examples/groups/H5Ex_G_Compact.java
+++ b/java/examples/groups/H5Ex_G_Compact.java
@@ -59,9 +59,9 @@ public class H5Ex_G_Compact {
}
public static void CreateGroup() {
- long file_id = -1;
- long group_id = -1;
- long fapl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
H5G_info_t ginfo;
long size;
diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java
index 61b5b7f..5df850e 100644
--- a/java/examples/groups/H5Ex_G_Corder.java
+++ b/java/examples/groups/H5Ex_G_Corder.java
@@ -24,10 +24,10 @@ 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;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long subgroup_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
int status;
H5G_info_t ginfo;
int i;
diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java
index 16b2028..9304538 100644
--- a/java/examples/groups/H5Ex_G_Create.java
+++ b/java/examples/groups/H5Ex_G_Create.java
@@ -24,8 +24,8 @@ public class H5Ex_G_Create {
private static String GROUPNAME = "G1";
private static void CreateGroup() {
- long file_id = -1;
- long group_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
// Create a new file using default properties.
try {
diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java
index 130ec09..9f0eedd 100644
--- a/java/examples/groups/H5Ex_G_Intermediate.java
+++ b/java/examples/groups/H5Ex_G_Intermediate.java
@@ -30,9 +30,9 @@ public class H5Ex_G_Intermediate {
private void CreateGroup() throws Exception {
- long file_id = -1;
- long group_id = -1;
- long gcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
try {
// Create a new file_id using the default properties.
diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java
index 47f55fe..af46712 100644
--- a/java/examples/groups/H5Ex_G_Iterate.java
+++ b/java/examples/groups/H5Ex_G_Iterate.java
@@ -56,7 +56,7 @@ public class H5Ex_G_Iterate {
}
private static void do_iterate() {
- long file_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
// Open a file using default properties.
try {
diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java
index b1c2afc..67a2f53 100644
--- a/java/examples/groups/H5Ex_G_Phase.java
+++ b/java/examples/groups/H5Ex_G_Phase.java
@@ -59,11 +59,11 @@ public class H5Ex_G_Phase {
}
private static void CreateGroup() {
- long file_id = -1;
- long group_id = -1;
- long subgroup_id = -1;
- long fapl_id = -1;
- long gcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long subgroup_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
H5G_info_t ginfo;
String name = "G0"; // Name of subgroup_id
int i;
diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java
index 3410c63..5378778 100644
--- a/java/examples/groups/H5Ex_G_Traverse.java
+++ b/java/examples/groups/H5Ex_G_Traverse.java
@@ -42,7 +42,7 @@ public class H5Ex_G_Traverse {
public static H5L_iterate_cb iter_cb = new H5L_iter_callbackT();
private static void OpenGroup() {
- long file_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
H5O_info_t infobuf;
opdata od = new opdata();
diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java
index 0e935de..9cc8ecd 100644
--- a/java/examples/groups/H5Ex_G_Visit.java
+++ b/java/examples/groups/H5Ex_G_Visit.java
@@ -46,7 +46,7 @@ public class H5Ex_G_Visit {
private void VisitGroup() throws Exception {
- long file_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
try {
// Open file
diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java
index 12a09a6..949a770 100644
--- a/java/examples/intro/H5_CreateAttribute.java
+++ b/java/examples/intro/H5_CreateAttribute.java
@@ -27,10 +27,10 @@ public class H5_CreateAttribute {
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 file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
long[] dims1 = { DIM_X, DIM_Y };
long[] dims = { 2 };
int[] attr_data = { 100, 200 };
diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java
index f26e6b3..f938be2 100644
--- a/java/examples/intro/H5_CreateDataset.java
+++ b/java/examples/intro/H5_CreateDataset.java
@@ -26,9 +26,9 @@ public class H5_CreateDataset {
private static final int DIM_Y = 6;
private static void CreateDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
// Create a new file using default properties.
diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java
index 078d1d7..d48ba6c 100644
--- a/java/examples/intro/H5_CreateFile.java
+++ b/java/examples/intro/H5_CreateFile.java
@@ -23,7 +23,7 @@ public class H5_CreateFile {
static final String FILENAME = "H5_CreateFile.h5";
private static void CreateFile() {
- long file_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
// Create a new file using default properties.
try {
diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java
index 640e5f6..c0bb954 100644
--- a/java/examples/intro/H5_CreateGroup.java
+++ b/java/examples/intro/H5_CreateGroup.java
@@ -24,8 +24,8 @@ public class H5_CreateGroup {
private static String GROUPNAME = "MyGroup";
private static void CreateGroup() {
- long file_id = -1;
- long group_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
// Create a new file using default properties.
try {
diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java
index a445604..f2c6168 100644
--- a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java
+++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java
@@ -26,10 +26,10 @@ public class H5_CreateGroupAbsoluteRelative {
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;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long group1_id = HDF5Constants.H5I_INVALID_HID;
+ long group2_id = HDF5Constants.H5I_INVALID_HID;
+ long group3_id = HDF5Constants.H5I_INVALID_HID;
// Create a new file using default properties.
try {
diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java
index 22874a8..f1d1cba 100644
--- a/java/examples/intro/H5_CreateGroupDataset.java
+++ b/java/examples/intro/H5_CreateGroupDataset.java
@@ -31,12 +31,12 @@ public class H5_CreateGroupDataset {
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;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
+ long group1_id = HDF5Constants.H5I_INVALID_HID;
+ long group2_id = HDF5Constants.H5I_INVALID_HID;
int[][] dset1_data = new int[DIM1_X][DIM1_Y];
int[][] dset2_data = new int[DIM2_X][DIM2_Y];
long[] dims1 = { DIM1_X, DIM1_Y };
@@ -107,7 +107,7 @@ public class H5_CreateGroupDataset {
try {
if (dataspace_id >= 0)
H5.H5Sclose(dataspace_id);
- dataspace_id = -1;
+ dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Exception e) {
e.printStackTrace();
@@ -117,7 +117,7 @@ public class H5_CreateGroupDataset {
try {
if (dataset_id >= 0)
H5.H5Dclose(dataset_id);
- dataset_id = -1;
+ dataset_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Exception e) {
e.printStackTrace();
diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java
index 6ba3bc2..67e1ac5 100644
--- a/java/examples/intro/H5_ReadWrite.java
+++ b/java/examples/intro/H5_ReadWrite.java
@@ -26,9 +26,9 @@ public class H5_ReadWrite {
private static final int DIM_Y = 6;
private static void ReadWriteDataset() {
- long file_id = -1;
- long dataspace_id = -1;
- long dataset_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long[] dims = { DIM_X, DIM_Y };
int[][] dset_data = new int[DIM_X][DIM_Y];
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 2d0ad76..db9350e 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -510,8 +510,8 @@ public class H5 implements java.io.Serializable {
*
* @param file_export_name
* The file name to export data into.
- * @param file_name
- * The name of the HDF5 file containing the dataset.
+ * @param file_id
+ * The identifier of the HDF5 file containing the dataset.
* @param object_path
* The full path of the dataset to be exported.
* @param binary_order
@@ -523,7 +523,28 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public synchronized static native void H5export_dataset(String file_export_name, String file_name,
+ public synchronized static native void H5export_dataset(String file_export_name, long file_id,
+ String object_path, int binary_order) throws HDF5LibraryException;
+
+ /**
+ * H5export_attribute is a utility function to save data in a file.
+ *
+ * @param file_export_name
+ * The file name to export data into.
+ * @param dataset_id
+ * The identifier of the dataset containing the attribute.
+ * @param object_path
+ * The attribute 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_attribute(String file_export_name, long dataset_id,
String object_path, int binary_order) throws HDF5LibraryException;
/**
diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java
index 5f72aee..ad9ed70 100644
--- a/java/src/hdf/hdf5lib/HDF5Constants.java
+++ b/java/src/hdf/hdf5lib/HDF5Constants.java
@@ -45,14 +45,23 @@ public class HDF5Constants {
public static final int H5_SZIP_ALLOW_K13_OPTION_MASK = H5_SZIP_ALLOW_K13_OPTION_MASK();
/** Special parameters for szip compression */
public static final int H5_SZIP_CHIP_OPTION_MASK = H5_SZIP_CHIP_OPTION_MASK();
+ /** indices on links, unknown index type */
public static final int H5_INDEX_UNKNOWN = H5_INDEX_UNKNOWN();
+ /** indices on links, index on names */
public static final int H5_INDEX_NAME = H5_INDEX_NAME();
+ /** indices on links, index on creation order */
public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER();
+ /** indices on links, number of indices defined */
public static final int H5_INDEX_N = H5_INDEX_N();
+ /** Common iteration orders, Unknown order */
public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN();
+ /** Common iteration orders, Increasing order */
public static final int H5_ITER_INC = H5_ITER_INC();
+ /** Common iteration orders, Decreasing order */
public static final int H5_ITER_DEC = H5_ITER_DEC();
+ /** Common iteration orders, No particular order, whatever is fastest */
public static final int H5_ITER_NATIVE = H5_ITER_NATIVE();
+ /** Common iteration orders, Number of iteration orders */
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();
diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java
index 44b41bb..4c31af7 100644
--- a/java/src/hdf/hdf5lib/HDF5GroupInfo.java
+++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java
@@ -41,6 +41,8 @@ public class HDF5GroupInfo {
long mtime;
int linklen;
+ /** Container for the information reported about an HDF5 Object
+ * from the H5Gget_obj_info() method */
public HDF5GroupInfo() {
fileno = new long[2];
objno = new long[2];
@@ -88,27 +90,44 @@ public class HDF5GroupInfo {
linklen = 0;
}
- /* accessors */
+ /** fileno accessors
+ * @return the file number if successful
+ */
public long[] getFileno() {
return fileno;
}
+ /** accessors
+ * @return the object number if successful
+ */
public long[] getObjno() {
return objno;
}
+ /** accessors
+ * @return type of group if successful
+ */
public int getType() {
return type;
}
+ /** accessors
+ * @return the number of links in the group if successful
+ */
public int getNlink() {
return nlink;
}
+ /** accessors
+ * @return the modified time value if successful
+ */
public long getMtime() {
return mtime;
}
+ /** accessors
+ * @return a length of link name if successful
+ */
public int getLinklen() {
return linklen;
}
diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java
index 96291b3..bb9357e 100644
--- a/java/src/hdf/hdf5lib/HDFArray.java
+++ b/java/src/hdf/hdf5lib/HDFArray.java
@@ -20,19 +20,16 @@ import java.util.Arrays;
/**
* This is a class for handling multidimensional arrays for HDF.
* <p>
- * The purpose is to allow the storage and retrieval of arbitrary array types
- * containing scientific data.
+ * The purpose is to allow the storage and retrieval of arbitrary array types containing scientific data.
* <p>
- * 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.
+ * 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.
* <p>
- * This class heavily uses the <a
- * href="./hdf.hdf5lib.HDFNativeData.html">HDFNativeData</a> class to
- * convert between Java and C representations.
+ * This class heavily uses the <a href="./hdf.hdf5lib.HDFNativeData.html">HDFNativeData</a> class to convert between
+ * Java and C representations.
*/
public class HDFArray {
-
private Object _theArray = null;
private ArrayDescriptor _desc = null;
private byte[] _barray = null;
@@ -40,31 +37,27 @@ public class HDFArray {
// public HDFArray() {}
/**
- * The input must be a Java Array (possibly multidimensional) of primitive
- * numbers or sub-classes of Number.
+ * The input must be a Java Array (possibly multidimensional) of primitive numbers or sub-classes of Number.
* <p>
- * The input is analysed to determine the number of dimensions and size of
- * each dimension, as well as the type of the elements.
+ * The input is analysed to determine the number of dimensions and size of each dimension, as well as the type of
+ * the elements.
* <p>
* The description is saved in private variables, and used to convert data.
*
* @param anArray
- * The array object.
- *
+ * The array object.
* @exception hdf.hdf5lib.exceptions.HDF5Exception
- * object is not an array.
+ * object is not an array.
*/
- public HDFArray(Object anArray) throws HDF5Exception {
-
+ public HDFArray(Object anArray) throws HDF5Exception
+ {
if (anArray == null) {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: array is 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?: ");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: not an array?: ");
throw (ex);
}
_theArray = anArray;
@@ -72,8 +65,7 @@ public class HDFArray {
/* extra error checking -- probably not needed */
if (_desc == null) {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: internal error: array description failed?: ");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: internal error: array description failed?: ");
throw (ex);
}
}
@@ -81,49 +73,48 @@ public class HDFArray {
/**
* 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.
+ * @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.
+ * Allocation failed.
*/
- public byte[] emptyBytes() throws HDF5JavaException {
+ public byte[] emptyBytes()
+ throws HDF5JavaException
+ {
byte[] b = null;
- if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) {
+ 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");
+ 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.
+ * 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.
+ * @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.
+ * the object not an array or other internal error.
*/
- public byte[] byteify() throws HDF5JavaException {
-
+ 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?: ");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify not an array?: ");
throw (ex);
}
@@ -140,73 +131,53 @@ public class HDFArray {
byte[] therow;
if (ArrayDescriptor.NT == 'I') {
- therow = HDFNativeData.intToByte(0,
- ArrayDescriptor.dimlen[1], (int[]) _theArray);
+ therow = HDFNativeData.intToByte(0, ArrayDescriptor.dimlen[1], (int[]) _theArray);
}
else if (ArrayDescriptor.NT == 'S') {
- therow = HDFNativeData.shortToByte(0,
- ArrayDescriptor.dimlen[1], (short[]) _theArray);
+ therow = HDFNativeData.shortToByte(0, ArrayDescriptor.dimlen[1], (short[]) _theArray);
}
else if (ArrayDescriptor.NT == 'F') {
- therow = HDFNativeData.floatToByte(0,
- ArrayDescriptor.dimlen[1], (float[]) _theArray);
+ therow = HDFNativeData.floatToByte(0, ArrayDescriptor.dimlen[1], (float[]) _theArray);
}
else if (ArrayDescriptor.NT == 'J') {
- therow = HDFNativeData.longToByte(0,
- ArrayDescriptor.dimlen[1], (long[]) _theArray);
+ therow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[1], (long[]) _theArray);
}
else if (ArrayDescriptor.NT == 'D') {
- therow = HDFNativeData
- .doubleToByte(0, ArrayDescriptor.dimlen[1],
- (double[]) _theArray);
+ 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")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
therow = IntegerToByte((Integer[]) _theArray);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Short")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Short")) {
therow = ShortToByte((Short[]) _theArray);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Float")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Float")) {
therow = FloatObjToByte((Float[]) _theArray);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Double")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Double")) {
therow = DoubleObjToByte((Double[]) _theArray);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Long")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Long")) {
therow = LongObjToByte((Long[]) _theArray);
}
else {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: unknown type of Object?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of Object?");
throw (ex);
}
}
else {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: unknown type of data?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of data?");
throw (ex);
}
- System
- .arraycopy(
- therow,
- 0,
- _barray,
- 0,
- (ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize));
+ 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?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?");
throw (ex);
}
}
@@ -216,8 +187,7 @@ public class HDFArray {
_barray = new byte[ArrayDescriptor.totalSize];
}
catch (OutOfMemoryError err) {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: byteify array too big?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?");
throw (ex);
}
@@ -240,8 +210,7 @@ public class HDFArray {
else {
/* check range of index */
if (index > (ArrayDescriptor.dimlen[i] - 1)) {
- throw new java.lang.IndexOutOfBoundsException(
- "HDFArray: byteify index OOB?");
+ throw new java.lang.IndexOutOfBoundsException("HDFArray: byteify index OOB?");
}
oo = java.lang.reflect.Array.get(oo, index);
ArrayDescriptor.currentindex[i] = index;
@@ -253,144 +222,107 @@ public class HDFArray {
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]);
+ 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]);
+ 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]);
+ 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]);
+ 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]);
+ 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")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
arow = IntegerToByte((Integer[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Short")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Short")) {
arow = ShortToByte((Short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Float")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Float")) {
arow = FloatObjToByte((Float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]);
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Double")) {
+ 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?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify Object type not implemented?");
throw (ex);
}
}
else {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: byteify unknown type not implemented?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify unknown type not implemented?");
throw (ex);
}
- System
- .arraycopy(
- arow,
- 0,
- _barray,
- n,
- (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize));
+ 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?");
+ 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));
+ 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) + " ?)"));
+ "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.
+ * 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.
+ * 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 {
-
+ public Object arrayify(byte[] bytes) throws HDF5JavaException
+ {
if (_theArray == null) {
/* exception: not an array */
- HDF5JavaException ex = new HDF5JavaException(
- "arrayify: 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?: ");
+ HDF5JavaException ex = new HDF5JavaException("arrayify: array is wrong size?: ");
throw (ex);
}
_barray = bytes; /* hope that the bytes are correct.... */
@@ -401,95 +333,76 @@ public class HDFArray {
try {
if (ArrayDescriptor.NT == 'I') {
int[] x = HDFNativeData.byteToInt(_barray);
- System.arraycopy(x, 0, _theArray, 0,
- ArrayDescriptor.dimlen[1]);
+ 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]);
+ 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]);
+ 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]);
+ 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]);
+ 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]);
+ 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]);
+ System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]);
return _theArray;
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Integer")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Integer")) {
Integer I[] = ByteToInteger(_barray);
- System.arraycopy(I, 0, _theArray, 0,
- ArrayDescriptor.dimlen[1]);
+ System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]);
return _theArray;
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Short")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Short")) {
Short I[] = ByteToShort(_barray);
- System.arraycopy(I, 0, _theArray, 0,
- ArrayDescriptor.dimlen[1]);
+ System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]);
return _theArray;
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Float")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Float")) {
Float I[] = ByteToFloatObj(_barray);
- System.arraycopy(I, 0, _theArray, 0,
- ArrayDescriptor.dimlen[1]);
+ System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]);
return _theArray;
}
- else if (ArrayDescriptor.className
- .equals("java.lang.Double")) {
+ else if (ArrayDescriptor.className.equals("java.lang.Double")) {
Double I[] = ByteToDoubleObj(_barray);
- System.arraycopy(I, 0, _theArray, 0,
- ArrayDescriptor.dimlen[1]);
+ 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]);
+ System.arraycopy(I, 0, _theArray, 0, ArrayDescriptor.dimlen[1]);
return _theArray;
}
else {
- HDF5JavaException ex = new HDF5JavaException(
- "arrayify: Object type not implemented yet...");
+ HDF5JavaException ex = new HDF5JavaException("arrayify: Object type not implemented yet...");
throw (ex);
}
}
else {
- HDF5JavaException ex = new HDF5JavaException(
- "arrayify: unknown type not implemented yet...");
+ HDF5JavaException ex = new HDF5JavaException("arrayify: unknown type not implemented yet...");
throw (ex);
}
}
catch (OutOfMemoryError err) {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: arrayify array too big?");
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: arrayify array too big?");
throw (ex);
}
}
@@ -501,6 +414,7 @@ public class HDFArray {
int index = 0;
int i;
Object flattenedArray = null;
+
switch (ArrayDescriptor.NT) {
case 'J':
flattenedArray = (Object) HDFNativeData.byteToLong(_barray);
@@ -521,36 +435,27 @@ public class HDFArray {
flattenedArray = (Object) _barray;
break;
case 'L':
- switch (ArrayDescriptor.className) {
- case "java.lang.Byte":
- flattenedArray = (Object) ByteToByteObj(_barray);
- break;
- case "java.lang.Short":
- flattenedArray = (Object) ByteToShort(_barray);
- break;
- case "java.lang.Integer":
- flattenedArray = (Object) ByteToInteger(_barray);
- break;
- case "java.lang.Long":
- flattenedArray = (Object) ByteToLongObj(_barray);
- break;
- case "java.lang.Float":
- flattenedArray = (Object) ByteToFloatObj(_barray);
- break;
- case "java.lang.Double":
- flattenedArray = (Object) ByteToDoubleObj(_barray);
- break;
- default:
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: unsupported Object type: "
- + ArrayDescriptor.NT);
- throw (ex);
- } // end of switch statement for arrays of boxed objects
- default:
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: unknown or unsupported type: "
- + ArrayDescriptor.NT);
- throw (ex);
+ {
+ if (ArrayDescriptor.className.equals("java.lang.Byte"))
+ flattenedArray = (Object) ByteToByteObj(_barray);
+ else if (ArrayDescriptor.className.equals("java.lang.Short"))
+ flattenedArray = (Object) ByteToShort(_barray);
+ else if (ArrayDescriptor.className.equals("java.lang.Integer"))
+ flattenedArray = (Object) ByteToInteger(_barray);
+ else if (ArrayDescriptor.className.equals("java.lang.Long"))
+ flattenedArray = (Object) ByteToLongObj(_barray);
+ else if (ArrayDescriptor.className.equals("java.lang.Float"))
+ flattenedArray = (Object) ByteToFloatObj(_barray);
+ else if (ArrayDescriptor.className.equals("java.lang.Double"))
+ flattenedArray = (Object) ByteToDoubleObj(_barray);
+ else {
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: unsupported Object type: " + ArrayDescriptor.NT);
+ throw (ex);
+ }
+ } // end of statement for arrays of boxed objects
+ default:
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown or unsupported type: " + ArrayDescriptor.NT);
+ throw (ex);
} // end of switch statement for arrays of primitives
while (n < ArrayDescriptor.totalSize) {
@@ -579,7 +484,6 @@ public class HDFArray {
/* array-ify */
try {
-
Object arow = null;
int mm = m + ArrayDescriptor.dimlen[ArrayDescriptor.dims];
switch (ArrayDescriptor.NT) {
@@ -602,75 +506,64 @@ public class HDFArray {
arow = (Object) Arrays.copyOfRange((double[]) flattenedArray, m, mm);
break;
case 'L':
- switch (ArrayDescriptor.className) {
- case "java.lang.Byte":
- arow = (Object) Arrays.copyOfRange((Byte[])flattenedArray, m, mm);
- break;
- case "java.lang.Short":
- arow = (Object) Arrays.copyOfRange((Short[])flattenedArray, m, mm);
- break;
- case "java.lang.Integer":
- arow = (Object) Arrays.copyOfRange((Integer[])flattenedArray, m, mm);
- break;
- case "java.lang.Long":
- arow = (Object) Arrays.copyOfRange((Long[])flattenedArray, m, mm);
- break;
- case "java.lang.Float":
- arow = (Object) Arrays.copyOfRange((Float[])flattenedArray, m, mm);
- break;
- case "java.lang.Double":
- arow = (Object) Arrays.copyOfRange((Double[])flattenedArray, m, mm);
- break;
- } // end of switch statement for arrays of boxed numerics
+ {
+ if (ArrayDescriptor.className.equals("java.lang.Byte"))
+ arow = (Object) Arrays.copyOfRange((Byte[]) flattenedArray, m, mm);
+ else if (ArrayDescriptor.className.equals("java.lang.Short"))
+ arow = (Object) Arrays.copyOfRange((Short[]) flattenedArray, m, mm);
+ else if (ArrayDescriptor.className.equals("java.lang.Integer"))
+ arow = (Object) Arrays.copyOfRange((Integer[]) flattenedArray, m, mm);
+ else if (ArrayDescriptor.className.equals("java.lang.Long"))
+ arow = (Object) Arrays.copyOfRange((Long[]) flattenedArray, m, mm);
+ else if (ArrayDescriptor.className.equals("java.lang.Float"))
+ arow = (Object) Arrays.copyOfRange((Float[]) flattenedArray, m, mm);
+ else if (ArrayDescriptor.className.equals("java.lang.Double"))
+ arow = (Object) Arrays.copyOfRange((Double[]) flattenedArray, m, mm);
+ else {
+ HDF5JavaException ex = new HDF5JavaException("HDFArray: unsupported Object type: " + ArrayDescriptor.NT);
+ throw (ex);
+ }
+ } // end of statement for arrays of boxed numerics
} // end of switch statement for arrays of primitives
- java.lang.reflect.Array.set(
- ArrayDescriptor.objs[ArrayDescriptor.dims - 2],
- (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]),
- arow);
+ 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]++;
m = mm;
}
catch (OutOfMemoryError err) {
- HDF5JavaException ex = new HDF5JavaException(
- "HDFArray: arrayify array too big?");
+ 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));
+ 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) + "?"));
+ 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.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])
- + "?"));
+ 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]) + "?"));
}
-
return _theArray;
}
- private byte[] IntegerToByte(Integer in[]) {
+ private byte[] IntegerToByte(Integer in[])
+ {
int nelems = java.lang.reflect.Array.getLength(in);
int[] out = new int[nelems];
@@ -680,7 +573,8 @@ public class HDFArray {
return HDFNativeData.intToByte(0, nelems, out);
}
- private Integer[] ByteToInteger(byte[] bin) {
+ private Integer[] ByteToInteger(byte[] bin)
+ {
int in[] = HDFNativeData.byteToInt(bin);
int nelems = java.lang.reflect.Array.getLength(in);
Integer[] out = new Integer[nelems];
@@ -691,7 +585,8 @@ public class HDFArray {
return out;
}
- private Integer[] ByteToInteger(int start, int len, byte[] bin) {
+ 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];
@@ -702,7 +597,8 @@ public class HDFArray {
return out;
}
- private byte[] ShortToByte(Short in[]) {
+ private byte[] ShortToByte(Short in[])
+ {
int nelems = java.lang.reflect.Array.getLength(in);
short[] out = new short[nelems];
@@ -712,7 +608,8 @@ public class HDFArray {
return HDFNativeData.shortToByte(0, nelems, out);
}
- private Short[] ByteToShort(byte[] bin) {
+ private Short[] ByteToShort(byte[] bin)
+ {
short in[] = HDFNativeData.byteToShort(bin);
int nelems = java.lang.reflect.Array.getLength((Object) in);
Short[] out = new Short[nelems];
@@ -723,7 +620,8 @@ public class HDFArray {
return out;
}
- private Short[] ByteToShort(int start, int len, byte[] bin) {
+ 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];
@@ -734,7 +632,8 @@ public class HDFArray {
return out;
}
- private byte[] ByteObjToByte(Byte in[]) {
+ private byte[] ByteObjToByte(Byte in[])
+ {
int nelems = java.lang.reflect.Array.getLength((Object) in);
byte[] out = new byte[nelems];
@@ -744,7 +643,8 @@ public class HDFArray {
return out;
}
- private Byte[] ByteToByteObj(byte[] bin) {
+ private Byte[] ByteToByteObj(byte[] bin)
+ {
int nelems = java.lang.reflect.Array.getLength((Object) bin);
Byte[] out = new Byte[nelems];
@@ -754,7 +654,8 @@ public class HDFArray {
return out;
}
- private Byte[] ByteToByteObj(int start, int len, byte[] bin) {
+ private Byte[] ByteToByteObj(int start, int len, byte[] bin)
+ {
Byte[] out = new Byte[len];
for (int i = 0; i < len; i++) {
@@ -763,7 +664,8 @@ public class HDFArray {
return out;
}
- private byte[] FloatObjToByte(Float in[]) {
+ private byte[] FloatObjToByte(Float in[])
+ {
int nelems = java.lang.reflect.Array.getLength((Object) in);
float[] out = new float[nelems];
@@ -773,7 +675,8 @@ public class HDFArray {
return HDFNativeData.floatToByte(0, nelems, out);
}
- private Float[] ByteToFloatObj(byte[] bin) {
+ 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];
@@ -784,7 +687,8 @@ public class HDFArray {
return out;
}
- private Float[] ByteToFloatObj(int start, int len, byte[] bin) {
+ 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];
@@ -795,7 +699,8 @@ public class HDFArray {
return out;
}
- private byte[] DoubleObjToByte(Double in[]) {
+ private byte[] DoubleObjToByte(Double in[])
+ {
int nelems = java.lang.reflect.Array.getLength((Object) in);
double[] out = new double[nelems];
@@ -805,7 +710,8 @@ public class HDFArray {
return HDFNativeData.doubleToByte(0, nelems, out);
}
- private Double[] ByteToDoubleObj(byte[] bin) {
+ 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];
@@ -816,7 +722,8 @@ public class HDFArray {
return out;
}
- private Double[] ByteToDoubleObj(int start, int len, byte[] bin) {
+ 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];
@@ -827,7 +734,8 @@ public class HDFArray {
return out;
}
- private byte[] LongObjToByte(Long in[]) {
+ private byte[] LongObjToByte(Long in[])
+ {
int nelems = java.lang.reflect.Array.getLength((Object) in);
long[] out = new long[nelems];
@@ -837,7 +745,8 @@ public class HDFArray {
return HDFNativeData.longToByte(0, nelems, out);
}
- private Long[] ByteToLongObj(byte[] bin) {
+ 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];
@@ -848,7 +757,8 @@ public class HDFArray {
return out;
}
- private Long[] ByteToLongObj(int start, int len, byte[] bin) {
+ 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];
@@ -861,13 +771,11 @@ public class HDFArray {
}
/**
- * This private class is used by HDFArray to discover the shape and type of an
- * arbitrary array.
+ * This private class is used by HDFArray to discover the shape and type of an arbitrary array.
* <p>
* We use java.lang.reflection here.
*/
class ArrayDescriptor {
-
static String theType = "";
static Class theClass = null;
static int[] dimlen = null;
@@ -882,13 +790,12 @@ class ArrayDescriptor {
static int dims = 0;
static String className;
- public ArrayDescriptor(Object anArray) throws HDF5Exception {
-
+ 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?: ");
+ HDF5Exception ex = new HDF5JavaException("ArrayDescriptor: not an array?: ");
throw (ex);
}
@@ -960,16 +867,14 @@ class ArrayDescriptor {
NT = 'L';
className = "java.lang.String";
NTsize = 1;
- throw new HDF5JavaException(new String(
- "ArrayDesciptor: Warning: String array not fully supported yet"));
+ throw new HDF5JavaException(new String("ArrayDesciptor: Warning: String array not fully supported yet"));
}
else {
/*
* exception: not a numeric type
*/
- throw new HDF5JavaException(new String(
- "ArrayDesciptor: Error: array is not numeric (type is "
- + css + ") ?"));
+ throw new HDF5JavaException(
+ new String("ArrayDesciptor: Error: array is not numeric (type is " + css + ") ?"));
}
/* fill in the table */
@@ -1013,7 +918,8 @@ class ArrayDescriptor {
/**
* Debug dump
*/
- public void dumpInfo() {
+ public void dumpInfo()
+ {
System.out.println("Type: " + theType);
System.out.println("Class: " + theClass);
System.out.println("NT: " + NT + " NTsize: " + NTsize);
@@ -1023,10 +929,8 @@ class ArrayDescriptor {
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);
+ 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/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java
index 4bc1b0d..f2c10f0 100644
--- a/java/src/hdf/hdf5lib/structs/H5A_info_t.java
+++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java
@@ -20,10 +20,14 @@ import java.io.Serializable;
*/
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
+ /** Indicate if creation order is valid */
+ public boolean corder_valid;
+ /** Creation order of attribute */
+ public long corder;
+ /** Character set of attribute name */
+ public int cset;
+ /** Size of raw data */
+ public long data_size;
H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) {
this.corder_valid = corder_valid;
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index 590f51a..c3307a8 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -1362,7 +1362,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls)
#ifdef H5_HAVE_DIRECT
return H5FD_DIRECT;
#else
- return -1;
+ return H5I_INVALID_HID;
#endif
}
JNIEXPORT jlong JNICALL
@@ -1376,7 +1376,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1HDFS(JNIEnv *env, jclass cls)
#ifdef H5_HAVE_LIBHDFS
return H5FD_HDFS;
#else
- return -1;
+ return H5I_INVALID_HID;
#endif
}
JNIEXPORT jlong JNICALL
@@ -1405,7 +1405,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1ROS3(JNIEnv *env, jclass cls)
#ifdef H5_HAVE_ROS3_VFD
return H5FD_ROS3;
#else
- return -1;
+ return H5I_INVALID_HID;
#endif
}
JNIEXPORT jlong JNICALL
@@ -1419,7 +1419,7 @@ Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls)
#ifdef H5_HAVE_WINDOWS
return H5FD_DIRECT;
#else
- return -1;
+ return H5I_INVALID_HID;
#endif
}
JNIEXPORT jint JNICALL
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index 24d0714..24263a5 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -1657,7 +1657,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref(JNIEnv *env, jclass clss, jlong dataset_id
for (i = 0; i < n; i++) {
h5str.s[0] = '\0';
- if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, &ref_data[i], 0))
+ if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, (void *)&ref_data[i], 0))
CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index c4021ec..e21b1ad 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -52,6 +52,8 @@ void * edata;
/* Local Prototypes */
/********************/
+int h5str_region_dataset(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_buf, int expand_data);
+
static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj,
int expand_data);
static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj,
@@ -644,7 +646,6 @@ h5str_region_dataset(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_b
H5S_sel_type region_type = H5S_SEL_ERROR;
hid_t region_obj = H5I_INVALID_HID;
hid_t region_sid = H5I_INVALID_HID;
- char ref_name[1024];
int ret_value = FAIL;
@@ -654,14 +655,6 @@ h5str_region_dataset(JNIEnv *env, h5str_t *out_str, hid_t container, void *ref_b
if ((region_sid = H5Rget_region(container, H5R_DATASET_REGION, ref_buf)) < 0)
H5_LIBRARY_ERROR(ENVONLY);
- if (expand_data) {
- if (H5Rget_name(region_obj, H5R_DATASET_REGION, ref_buf, (char *)ref_name, 1024) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
- if (!h5str_append(out_str, ref_name))
- H5_ASSERTION_ERROR(ENVONLY, "Unable to append string.");
- }
-
if ((region_type = H5Sget_select_type(region_sid)) > H5S_SEL_ERROR) {
if (H5S_SEL_POINTS == region_type) {
if (h5str_dump_region_points(ENVONLY, out_str, region_sid, region_obj, expand_data) < 0)
@@ -2691,6 +2684,125 @@ done:
return ret_value;
} /* end h5str_dump_simple_dset */
+int
+h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr_id, int binary_order)
+{
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hsize_t alloc_size;
+ int ndims; /* rank of dataspace */
+ unsigned i; /* counters */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hsize_t p_nelmts; /* total selected elmts */
+
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+
+ int ret_value = 0;
+
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
+
+ if (attr_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_dump_simple_mem: attr ID < 0");
+
+ if ((f_type = H5Aget_type(attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ switch (binary_order) {
+ case 1: {
+ if ((p_type = h5str_get_native_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case 2: {
+ if ((p_type = h5str_get_little_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case 3: {
+ if ((p_type = h5str_get_big_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ default: {
+ if ((p_type = H5Tcopy(f_type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ break;
+ }
+ }
+
+ if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) {
+ if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Calculate the number of elements we're going to print */
+ p_nelmts = 1;
+
+ if (ndims > 0) {
+ for (i = 0; i < (size_t)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;
+
+ alloc_size = p_nelmts * H5Tget_size(p_type);
+ if (NULL == (sm_buf = (unsigned char *)HDmalloc((size_t)alloc_size)))
+ H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_dump_simple_mem: failed to allocate sm_buf");
+
+ /* Read the data */
+ if (H5Aread(attr_id, p_type, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (binary_order == 99) {
+ if (h5str_dump_simple_data(ENVONLY, stream, attr_id, p_type, sm_buf, p_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else {
+ if (h5str_render_bin_output(stream, attr_id, p_type, sm_buf, p_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data) {
+ if (H5Dvlen_reclaim(p_type, f_space, H5P_DEFAULT, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ }
+ }
+
+ ret_value = SUCCEED;
+
+done:
+ if (sm_buf)
+ HDfree(sm_buf);
+ if (f_space >= 0)
+ H5Sclose(f_space);
+ if (p_type >= 0)
+ H5Tclose(p_type);
+ if (f_type >= 0)
+ H5Tclose(f_type);
+
+ return ret_value;
+}
+
htri_t
H5Tdetect_variable_str(hid_t tid)
{
@@ -3323,18 +3435,16 @@ done:
/*
* Class: hdf_hdf5lib_H5
* Method: H5export_dataset
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
+ * Signature: (Ljava/lang/String;JLjava/lang/String;I)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_export_name, jstring file_name,
+Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_export_name, jlong file_id,
jstring object_path, jint binary_order)
{
const char *file_export = NULL;
const char *object_name = NULL;
- const char *fileName = NULL;
jboolean isCopy;
herr_t ret_val = FAIL;
- hid_t file_id = H5I_INVALID_HID;
hid_t dataset_id = H5I_INVALID_HID;
FILE * stream = NULL;
@@ -3343,17 +3453,9 @@ Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass clss, jstring file_exp
if (NULL == file_export_name)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL");
- if (NULL == file_name)
- H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_name is NULL");
-
if (NULL == object_path)
H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL");
- PIN_JAVA_STRING(ENVONLY, file_name, fileName, NULL, "H5export_dataset: file name not pinned");
-
- if ((file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT)) < 0)
- H5_LIBRARY_ERROR(ENVONLY);
-
PIN_JAVA_STRING(ENVONLY, object_path, object_name, &isCopy, "H5export_dataset: object_path not pinned");
if ((dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT)) < 0)
@@ -3380,14 +3482,64 @@ done:
UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export);
if (object_name)
UNPIN_JAVA_STRING(ENVONLY, object_path, object_name);
- if (fileName)
- UNPIN_JAVA_STRING(ENVONLY, file_name, fileName);
if (dataset_id >= 0)
H5Dclose(dataset_id);
- if (file_id >= 0)
- H5Fclose(file_id);
} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5export_attribute
+ * Signature: (Ljava/lang/String;JLjava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5export_1attribute(JNIEnv *env, jclass clss, jstring file_export_name, jlong dset_id,
+ jstring object_path, jint binary_order)
+{
+ const char *file_export = NULL;
+ const char *object_name = NULL;
+ jboolean isCopy;
+ herr_t ret_val = FAIL;
+ hid_t attr_id = H5I_INVALID_HID;
+ FILE * stream = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == file_export_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL");
+
+ if (NULL == object_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, object_path, object_name, &isCopy, "H5export_dataset: object_path not pinned");
+
+ if ((attr_id = H5Aopen(dset_id, object_name, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL,
+ "H5export_dataset: file_export name not pinned");
+
+ if (NULL == (stream = HDfopen(file_export, "w+")))
+ H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed");
+
+ if ((ret_val = h5str_dump_simple_mem(ENVONLY, stream, attr_id, binary_order)) < 0)
+ H5_ASSERTION_ERROR(ENVONLY, "h5str_dump_simple_dset failed");
+
+ if (stream) {
+ HDfclose(stream);
+ stream = NULL;
+ }
+
+done:
+ if (stream)
+ HDfclose(stream);
+ if (file_export)
+ UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export);
+ if (object_name)
+ UNPIN_JAVA_STRING(ENVONLY, object_path, object_name);
+ if (attr_id >= 0)
+ H5Aclose(attr_id);
+} /* end Java_hdf_hdf5lib_H5_H5export_1attribute */
+
#ifdef __cplusplus
}
#endif
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index 19415b4..64913a7 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -45,6 +45,7 @@ extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_
int expand_data);
extern void h5str_array_free(char **strs, size_t len);
extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
+extern int h5str_dump_simple_mem(JNIEnv *env, FILE *stream, hid_t attr, int binary_order);
extern htri_t H5Tdetect_variable_str(hid_t tid);
@@ -103,9 +104,16 @@ JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max(JNIEnv *, jcla
/*
* Class: hdf_hdf5lib_H5
* Method: H5export_dataset
- * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V
+ * Signature: (Ljava/lang/String;JLjava/lang/String;I)V
*/
-JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *, jclass, jstring, jstring, jstring,
- jint);
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *, jclass, jstring, jlong, jstring, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5export_attribute
+ * Signature: (Ljava/lang/String;JLjava/lang/String;I)V
+ */
+JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1attribute(JNIEnv *, jclass, jstring, jlong, jstring,
+ jint);
#endif /* H5UTIL_H__ */
diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt
index d6d5da6..8dd0b9a 100644
--- a/java/test/CMakeLists.txt
+++ b/java/test/CMakeLists.txt
@@ -92,6 +92,8 @@ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateL2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO1.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig" "${PROJECT_BINARY_DIR}/h5ex_g_iterateO2.hdf" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tdatareg.h5" "${PROJECT_BINARY_DIR}/trefer_reg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
+HDFTEST_COPY_FILE("${HDF5_TOOLS_DIR}/testfiles/tattrreg.h5" "${PROJECT_BINARY_DIR}/tattrreg.h5" "${HDF5_JAVA_TEST_LIB_TARGET}_files")
add_custom_target(${HDF5_JAVA_TEST_LIB_TARGET}_files ALL COMMENT "Copying files needed by ${HDF5_JAVA_TEST_LIB_TARGET} tests" DEPENDS ${${HDF5_JAVA_TEST_LIB_TARGET}_files_list})
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index ae8e039..2916aac 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -31,6 +31,7 @@ import java.io.StreamTokenizer;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
import org.junit.After;
@@ -46,22 +47,21 @@ import org.junit.rules.TestName;
*/
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();
- }
private static final String H5_FILE = "testData.h5";
private static final String EXPORT_FILE = "testExport.txt";
+ private static final String H5_DREG_FILE = "trefer_reg.h5";
+ private static final String EXPORT_DREG_FILE = "testExportReg.txt";
+ private static final String H5_AREG_FILE = "tattrreg.h5";
+ private static final String EXPORT_AREG_FILE = "testExportAReg.txt";
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
+ private static final int DIM_BLKS = 36;
+ private static final int DIM_PNTS = 10;
+ private static final int DIM_ATTR = 12;
private static final int RANK = 2;
- long H5fid = -1;
- long H5dsid = -1;
- long H5did = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -77,7 +77,7 @@ public class TestH5 {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -114,22 +114,64 @@ public class TestH5 {
}
}
- public final void _closeH5File() throws HDF5LibraryException {
+ private final void _closeH5File() {
if (H5did >= 0)
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
if (H5dsid > 0)
try {H5.H5Sclose(H5dsid);} catch (Exception ex) {}
if (H5fid > 0)
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
- H5dsid = -1;
- H5did = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
+ H5dsid = HDF5Constants.H5I_INVALID_HID;
+ H5did = HDF5Constants.H5I_INVALID_HID;
+ }
+
+ public void _openH5File(String filename, String dsetname) {
+ try {
+ H5fid = H5.H5Fopen(filename,
+ HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Fopen: ", H5fid >= 0);
+ try {
+ H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Dopen: ", H5did >= 0);
+ try {
+ H5dsid = H5.H5Dget_space(H5did);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("TestH5._openH5file: " + err);
+ }
+ assertTrue("TestH5._openH5file: H5.H5Screate_simple: ",H5dsid > 0);
}
public final void _deleteH5file() {
+ _closeH5File();
_deleteFile(H5_FILE);
}
+ @After
+ public void closeH5File() throws HDF5LibraryException {
+ _closeH5File();
+ System.out.println();
+ }
+
+ @Before
+ public void verifyCount()
+ throws NullPointerException, HDF5Exception {
+ assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0);
+ System.out.print(testname.getMethodName());
+ }
+
/**
* Test method for {@link hdf.hdf5lib.H5#J2C(int)}.
* NOTE:
@@ -373,8 +415,10 @@ public class TestH5 {
_closeH5File();
+ _openH5File(H5_FILE, "/dset");
+
try {
- H5.H5export_dataset(EXPORT_FILE, H5_FILE, "/dset", 99);
+ H5.H5export_dataset(EXPORT_FILE, H5fid, "/dset", 99);
}
catch (HDF5LibraryException err) {
err.printStackTrace();
@@ -410,4 +454,88 @@ public class TestH5 {
}
_deleteH5file();
}
+
+ @Test
+ public void testH5export_regdataset() {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
+ 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
+ String objName = "/Dataset1";
+
+ _openH5File(H5_DREG_FILE, objName);
+
+ try {
+ H5.H5export_dataset(EXPORT_DREG_FILE, H5fid, objName, 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_dataset failed: " + err);
+ }
+
+ File file = new File(EXPORT_DREG_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_DREG_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx] = (int)streamTokenizer.nval;
+ indx++;
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_regdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ }
+
+ @Test
+ public void testH5export_attrdataset() {
+ int[] dset_data_expect = {66, 69, 72, 75, 78, 81, 96, 99, 102, 105, 108,
+ 111, 126, 129, 132, 135, 138, 141, 156, 159, 162, 165, 168, 171,
+ 186, 189, 192, 195, 198, 201, 216, 219, 222, 225, 228, 231,
+ 207, 66, 252, 48, 84, 96, 12, 14, 213, 99};
+ int[] dset_indata = new int[DIM_BLKS+DIM_PNTS];
+ String dsetName = "/Dataset1";
+ String objName = "Attribute1";
+
+ _openH5File(H5_AREG_FILE, dsetName);
+
+ try {
+ H5.H5export_attribute(EXPORT_AREG_FILE, H5did, objName, 99);
+ }
+ catch (HDF5LibraryException err) {
+ err.printStackTrace();
+ fail("H5export_attribute failed: " + err);
+ }
+
+ File file = new File(EXPORT_AREG_FILE);
+
+ try {
+ Reader reader = new FileReader(EXPORT_AREG_FILE);
+ StreamTokenizer streamTokenizer = new StreamTokenizer(reader);
+ int indx = 0;
+ int jndx = 0;
+ while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){
+ if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) {
+ dset_indata[indx] = (int)streamTokenizer.nval;
+ indx++;
+ }
+ }
+ reader.close();
+ }
+ catch (IOException err) {
+ err.printStackTrace();
+ fail("read file failed: " + err);
+ }
+ for(int row = 0; row < DIM_X; row++)
+ assertTrue("testH5export_attrdataset: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]);
+ }
}
diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java
index 58e5ca6..8d343ec 100644
--- a/java/test/TestH5A.java
+++ b/java/test/TestH5A.java
@@ -42,13 +42,13 @@ public class TestH5A {
private static final String H5_FILE = "testA.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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
- long type_id = -1;
- long space_id = -1;
- long lapl_id = -1;
+ long type_id = HDF5Constants.H5I_INVALID_HID;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -59,7 +59,7 @@ public class TestH5A {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -126,7 +126,7 @@ public class TestH5A {
@Test
public void testH5Acreate2() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
assertTrue("testH5Acreate2", attr_id >= 0);
@@ -154,8 +154,8 @@ public class TestH5A {
@Test
public void testH5Aopen() {
String attr_name = "dset";
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id,
@@ -191,9 +191,8 @@ public class TestH5A {
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;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "file", type_id, space_id,
@@ -212,7 +211,7 @@ public class TestH5A {
try {
n = 5;
H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n,
- aapl_id, lapl_id);
+ HDF5Constants.H5P_DEFAULT, lapl_id);
fail("Negative Test Failed:- Error not Thrown when n is invalid.");
}
catch (AssertionError err) {
@@ -227,7 +226,7 @@ public class TestH5A {
n = 0;
obj_name = "file";
H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n,
- aapl_id, lapl_id);
+ HDF5Constants.H5P_DEFAULT, lapl_id);
fail("Negative Test Failed:- Error not Thrown when attribute name is invalid.");
}
catch (AssertionError err) {
@@ -251,7 +250,7 @@ public class TestH5A {
public void testH5Acreate_by_name() {
String obj_name = ".";
String attr_name = "DATASET";
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
boolean bool_val = false;
try {
@@ -283,12 +282,12 @@ public class TestH5A {
long loc_id = H5fid;
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
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);
+ attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name);
@@ -321,7 +320,7 @@ public class TestH5A {
String obj_name = ".";
String old_attr_name = "old";
String new_attr_name = "new";
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int ret_val = -1;
boolean bool_val = false;
@@ -363,7 +362,7 @@ public class TestH5A {
String obj_name = ".";
String attr_name = "DATASET1";
String ret_name = null;
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
@@ -393,8 +392,8 @@ public class TestH5A {
int idx_type = HDF5Constants.H5_INDEX_NAME;
int order = HDF5Constants.H5_ITER_INC;
int n = 0;
- long attr1_id = -1;
- long attr2_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name,
@@ -430,8 +429,8 @@ public class TestH5A {
@Test
public void testH5Aget_storage_size() {
- long attr_id = -1;
- long attr_size = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_size = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
@@ -453,8 +452,8 @@ public class TestH5A {
@Test
public void testH5Aget_info() {
H5A_info_t attr_info = null;
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
try {
attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id,
@@ -485,8 +484,8 @@ public class TestH5A {
@Test
public void testH5Aget_info1() {
H5A_info_t attr_info = null;
- long attribute_id = -1;
- long attr_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int order = HDF5Constants.H5_ITER_INC;
try {
@@ -521,8 +520,8 @@ public class TestH5A {
@Test
public void testH5Aget_info_by_idx() {
- long attr_id = -1;
- long attr2_id = -1;;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;;
H5A_info_t attr_info = null;
try {
@@ -577,7 +576,7 @@ public class TestH5A {
@Test
public void testH5Aget_info_by_name() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
H5A_info_t attr_info = null;
String obj_name = ".";
String attr_name = "DATASET";
@@ -602,7 +601,7 @@ public class TestH5A {
@Test
public void testH5Adelete_by_name() {
- long attr_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
int ret_val = -1;
boolean bool_val = false;
boolean exists = false;
@@ -645,8 +644,8 @@ public class TestH5A {
@Test
public void testH5Aexists() {
boolean exists = false;
- long attr_id = -1;
- long attribute_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
exists = H5.H5Aexists(H5fid, "None");
@@ -684,10 +683,10 @@ public class TestH5A {
@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;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -726,9 +725,9 @@ public class TestH5A {
@Test
public void testH5Adelete_by_idx_name1() {
boolean exists = false;
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -761,10 +760,10 @@ public class TestH5A {
@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;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
try {
attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1",
@@ -816,8 +815,8 @@ public class TestH5A {
public void testH5Aopen_by_name() {
String obj_name = ".";
String attr_name = "DATASET";
- long attribute_id = -1;
- long aid = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long aid = HDF5Constants.H5I_INVALID_HID;
try {
attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name,
@@ -851,9 +850,9 @@ public class TestH5A {
@Test
public void testH5Awrite_readVL() {
String attr_name = "VLdata";
- long attr_id = -1;
- long atype_id = -1;
- long aspace_id = -1;
+ long attr_id = HDF5Constants.H5I_INVALID_HID;
+ long atype_id = HDF5Constants.H5I_INVALID_HID;
+ long aspace_id = HDF5Constants.H5I_INVALID_HID;
String[] str_data = { "Parting", "is such", "sweet", "sorrow." };
long[] dims = { str_data.length };
long lsize = 1;
@@ -918,8 +917,8 @@ public class TestH5A {
public void testH5Aget_create_plist() {
String attr_name = "DATASET1";
int char_encoding = 0;
- long plist_id = -1;
- long attribute_id = -1;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE);
@@ -979,10 +978,10 @@ public class TestH5A {
@Test
public void testH5Aiterate() {
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
class idata {
public String attr_name = null;
@@ -1047,10 +1046,10 @@ public class TestH5A {
@Test
public void testH5Aiterate_by_name() {
- long attr1_id = -1;
- long attr2_id = -1;
- long attr3_id = -1;
- long attr4_id = -1;
+ long attr1_id = HDF5Constants.H5I_INVALID_HID;
+ long attr2_id = HDF5Constants.H5I_INVALID_HID;
+ long attr3_id = HDF5Constants.H5I_INVALID_HID;
+ long attr4_id = HDF5Constants.H5I_INVALID_HID;
class idata {
public String attr_name = null;
diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java
index 74040ee..dac3a9c 100644
--- a/java/test/TestH5D.java
+++ b/java/test/TestH5D.java
@@ -38,13 +38,13 @@ public class TestH5D {
private static final int DIM_X = 4;
private static final int DIM_Y = 6;
private static final int RANK = 2;
- long H5fid = -1;
- long H5faplid = -1;
- long H5dsid = -1;
- long H5dtid = -1;
- long H5did = -1;
- long H5did0 = -1;
- long H5dcpl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5faplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dtid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5did0 = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
// Values for the status of space allocation
@@ -194,10 +194,10 @@ public class TestH5D {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
}
- private final void _openH5file(String name, long dapl) {
+ private final void _openH5file(String filename, String dsetname, long dapl) {
try {
- H5fid = H5.H5Fopen(H5_FILE,
- HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT);
+ H5fid = H5.H5Fopen(filename,
+ HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
err.printStackTrace();
@@ -205,7 +205,7 @@ public class TestH5D {
}
assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0);
try {
- H5did = H5.H5Dopen(H5fid, name, dapl);
+ H5did = H5.H5Dopen(H5fid, dsetname, dapl);
}
catch (Throwable err) {
err.printStackTrace();
@@ -267,7 +267,7 @@ public class TestH5D {
@Test
public void testH5Dcreate() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -291,7 +291,7 @@ public class TestH5D {
@Test
public void testH5Dcreate_anon() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE,
H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -314,12 +314,12 @@ public class TestH5D {
@Test
public void testH5Dopen() {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
H5.H5Dclose(H5did);
- H5did = -1;
+ H5did = HDF5Constants.H5I_INVALID_HID;
dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT);
}
catch (Exception err) {
@@ -387,8 +387,8 @@ public class TestH5D {
@Test
public void testH5Dget_access_plist() {
- long dapl_id = -1;
- long test_dapl_id = -1;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long test_dapl_id = HDF5Constants.H5I_INVALID_HID;
int[] mdc_nelmts1 = {0};
int[] mdc_nelmts2 = {0};
long[] rdcc_nelmts1 = {0};
@@ -499,7 +499,7 @@ public class TestH5D {
@Test(expected = HDF5LibraryException.class)
public void testH5Dget_space_closed() throws Throwable {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -517,7 +517,7 @@ public class TestH5D {
@Test
public void testH5Dget_space() {
- long dataspace_id = -1;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
@@ -541,7 +541,7 @@ public class TestH5D {
@Test(expected = HDF5LibraryException.class)
public void testH5Dget_type_closed() throws Throwable {
- long dataset_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
try {
dataset_id = H5.H5Dcreate(H5fid, "dset",
HDF5Constants.H5T_STD_I32BE, H5dsid,
@@ -559,7 +559,7 @@ public class TestH5D {
@Test
public void testH5Dget_type() {
- long datatype_id = -1;
+ long datatype_id = HDF5Constants.H5I_INVALID_HID;
_createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
try {
diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java
index 6d516a4..774b9dd 100644
--- a/java/test/TestH5Dplist.java
+++ b/java/test/TestH5Dplist.java
@@ -41,10 +41,10 @@ public class TestH5Dplist {
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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcpl_id = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
long[] H5extdims = { EDIM_X, EDIM_Y };
long[] H5chunk_dims = { CHUNK_X, CHUNK_Y };
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 696e458..6ef8dc1 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -76,7 +76,6 @@ public class TestH5E {
@Test
public void testH5Eget_msg_major() {
-
try {
H5.H5Fopen("test", 0, 1);
}
diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java
index e3ea166..f8712b3 100644
--- a/java/test/TestH5F.java
+++ b/java/test/TestH5F.java
@@ -46,7 +46,7 @@ public class TestH5F {
HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP,
HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR,
HDF5Constants.H5F_OBJ_ALL };
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -71,7 +71,7 @@ public class TestH5F {
public void deleteH5file() throws HDF5LibraryException {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
System.out.println();
@@ -79,7 +79,7 @@ public class TestH5F {
@Test
public void testH5Fget_create_plist() {
- long plist = -1;
+ long plist = HDF5Constants.H5I_INVALID_HID;
try {
plist = H5.H5Fget_create_plist(H5fid);
@@ -103,7 +103,7 @@ public class TestH5F {
@Test
public void testH5Fget_access_plist() {
- long plist = -1;
+ long plist = HDF5Constants.H5I_INVALID_HID;
try {
plist = H5.H5Fget_access_plist(H5fid);
@@ -131,7 +131,7 @@ public class TestH5F {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
@@ -156,7 +156,7 @@ public class TestH5F {
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
try {
diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java
index d0b4425..366eefc 100644
--- a/java/test/TestH5Fbasic.java
+++ b/java/test/TestH5Fbasic.java
@@ -34,7 +34,7 @@ public class TestH5Fbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testFb.h5";
private static final String TXT_FILE = "testFb.txt";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -89,7 +89,7 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Fopen_read_only() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -124,8 +124,8 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Freopen_closed() throws Throwable {
- long fid = -1;
- long fid2 = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -147,8 +147,8 @@ public class TestH5Fbasic {
@Test
public void testH5Freopen() {
- long fid = -1;
- long fid2 = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
+ long fid2 = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -181,7 +181,7 @@ public class TestH5Fbasic {
@Test
public void testH5Fclose() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
@@ -201,7 +201,7 @@ public class TestH5Fbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Fclose_twice() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR,
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index ac54e2c..77069db 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -104,7 +104,7 @@ public class TestH5Fparams {
@Test
public void testH5Fcreate() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
File file = null;
try {
@@ -131,7 +131,7 @@ public class TestH5Fparams {
@Test
public void testH5Fflush_global() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
@@ -157,7 +157,7 @@ public class TestH5Fparams {
@Test
public void testH5Fflush_local() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
@@ -183,7 +183,7 @@ public class TestH5Fparams {
@Test
public void testH5Fget_info() {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -214,7 +214,7 @@ public class TestH5Fparams {
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
@@ -233,7 +233,7 @@ public class TestH5Fparams {
@Ignore//(expected = HDF5FunctionArgumentException.class)
public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
- long fid = -1;
+ long fid = HDF5Constants.H5I_INVALID_HID;
try {
try {
diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java
index 2057886..1ec78fe 100644
--- a/java/test/TestH5Fswmr.java
+++ b/java/test/TestH5Fswmr.java
@@ -32,9 +32,9 @@ public class TestH5Fswmr {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testswmr.h5";
- long H5fid = -1;
- long H5fapl = -1;
- long H5fcpl = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fapl = HDF5Constants.H5I_INVALID_HID;
+ long H5fcpl = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -62,15 +62,15 @@ public class TestH5Fswmr {
public void deleteH5file() throws HDF5LibraryException {
if (H5fapl > 0) {
try {H5.H5Pclose(H5fapl);} catch (Exception ex) {}
- H5fapl = -1;
+ H5fapl = HDF5Constants.H5I_INVALID_HID;
}
if (H5fcpl > 0) {
try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {}
- H5fcpl = -1;
+ H5fcpl = HDF5Constants.H5I_INVALID_HID;
}
if (H5fid > 0) {
try {H5.H5Fclose(H5fid);} catch (Exception ex) {}
- H5fid = -1;
+ H5fid = HDF5Constants.H5I_INVALID_HID;
}
_deleteFile(H5_FILE);
System.out.println();
diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java
index 2f0d1b7..c31b5f1 100644
--- a/java/test/TestH5G.java
+++ b/java/test/TestH5G.java
@@ -37,11 +37,11 @@ public class TestH5G {
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;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -56,8 +56,8 @@ public class TestH5G {
}
private final long _createGroup2(long fid, String name) {
- long gid = -1;
- long gcpl = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
+ long gcpl = HDF5Constants.H5I_INVALID_HID;
try {
gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl
}
@@ -90,12 +90,12 @@ public class TestH5G {
}
private final long _openGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- gid = -1;
+ gid = HDF5Constants.H5I_INVALID_HID;
err.printStackTrace();
fail("H5.H5Gopen: " + err);
}
@@ -132,7 +132,7 @@ public class TestH5G {
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0);
assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0);
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
gid = _createGroup(H5fid, GROUPS[i]);
@@ -163,7 +163,7 @@ public class TestH5G {
@Test
public void testH5Gopen() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
try {
gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT);
@@ -183,8 +183,8 @@ public class TestH5G {
@Test
public void testH5Gget_create_plist() {
- long gid = -1;
- long pid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
+ long pid = HDF5Constants.H5I_INVALID_HID;
for (int i = 0; i < GROUPS.length; i++) {
try {
diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java
index db6fd5e..6e2e450 100644
--- a/java/test/TestH5Gbasic.java
+++ b/java/test/TestH5Gbasic.java
@@ -32,10 +32,10 @@ import org.junit.rules.TestName;
public class TestH5Gbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testGb.h5";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -84,7 +84,7 @@ public class TestH5Gbasic {
@Test(expected = NullPointerException.class)
public void testH5Gcreate_null() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
// it should fail because the group name is null
gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT,
@@ -101,7 +101,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gcreate() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(H5fid, "/testH5Gcreate",
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
@@ -144,7 +144,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gcreate_anon() {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
@@ -160,7 +160,7 @@ public class TestH5Gbasic {
@Test(expected = NullPointerException.class)
public void testH5Gopen_null() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT);
@@ -174,7 +174,7 @@ public class TestH5Gbasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Gopen_not_exists() throws Throwable {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
@@ -208,7 +208,7 @@ public class TestH5Gbasic {
@Test
public void testH5Gget_create_plist() {
- long pid = -1;
+ long pid = HDF5Constants.H5I_INVALID_HID;
long gid = _createGroup(H5fid, "/testH5Gcreate");
assertTrue(gid > 0);
diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java
index da687c1..3c137f5 100644
--- a/java/test/TestH5Giterate.java
+++ b/java/test/TestH5Giterate.java
@@ -29,15 +29,15 @@ 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;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
private final long _openGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT);
}
catch (Throwable err) {
- gid = -1;
+ gid = HDF5Constants.H5I_INVALID_HID;
err.printStackTrace();
fail("H5.H5Gcreate: " + err);
}
diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java
index ecdd6c4..8866a6b 100644
--- a/java/test/TestH5Lbasic.java
+++ b/java/test/TestH5Lbasic.java
@@ -34,7 +34,7 @@ import org.junit.rules.TestName;
public class TestH5Lbasic {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "h5ex_g_iterateL1.hdf";
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
public void openH5file()
diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java
index e40b7ce..c35c780 100644
--- a/java/test/TestH5Lcreate.java
+++ b/java/test/TestH5Lcreate.java
@@ -40,13 +40,13 @@ public class TestH5Lcreate {
private static final String H5_FILE = "testL.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 H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -63,7 +63,7 @@ public class TestH5Lcreate {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -79,7 +79,7 @@ public class TestH5Lcreate {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java
index bd951c3..3ceade1 100644
--- a/java/test/TestH5Obasic.java
+++ b/java/test/TestH5Obasic.java
@@ -38,7 +38,7 @@ public class TestH5Obasic {
private static long H5la_l1 = -1;
private static long H5la_dt1 = -1;
private static long H5la_g1 = -1;
- long H5fid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
@Before
public void openH5file()
@@ -66,7 +66,7 @@ public class TestH5Obasic {
@Test(expected = HDF5LibraryException.class)
public void testH5Oopen_not_exists() throws Throwable {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT);
@@ -75,7 +75,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_dataset() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
@@ -93,7 +93,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_hardlink() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -110,7 +110,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_group() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT);
@@ -127,7 +127,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_datatype() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT);
@@ -257,7 +257,7 @@ public class TestH5Obasic {
@Test
public void testH5Oget_info_by_idx_n3() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT);
@@ -409,7 +409,7 @@ public class TestH5Obasic {
@Test
public void testH5Oopen_by_idx_n0() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
@@ -447,7 +447,7 @@ public class TestH5Obasic {
@Test
public void testH5Oopen_by_idx_n3() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java
index 5a52f12..b3b1acd 100644
--- a/java/test/TestH5Ocopy.java
+++ b/java/test/TestH5Ocopy.java
@@ -35,13 +35,13 @@ public class TestH5Ocopy {
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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid2 = HDF5Constants.H5I_INVALID_HID;
long[] dims = { 2 };
private final void _deleteFile(String filename) {
@@ -58,7 +58,7 @@ public class TestH5Ocopy {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -74,7 +74,7 @@ public class TestH5Ocopy {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
@@ -135,10 +135,10 @@ public class TestH5Ocopy {
@Test
public void testH5OcopyRefsAttr() {
- long ocp_plist_id = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
byte rbuf0[]=null , rbuf1[] = null;
byte[] dset_data = new byte[16];
- long attribute_id = -1;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
try {
@@ -183,9 +183,9 @@ public class TestH5Ocopy {
public void testH5OcopyRefsDatasettodiffFile() {
byte rbuf1[] = null;
byte[] dset_data = new byte[16];
- long ocp_plist_id = -1;
- long dataset_id = -1;
- long H5fid2 = -1;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long H5fid2 = HDF5Constants.H5I_INVALID_HID;
try {
rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1);
@@ -243,9 +243,9 @@ public class TestH5Ocopy {
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;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long did = HDF5Constants.H5I_INVALID_HID;
int obj_type = -1;
byte[] read_data = new byte[16];
@@ -327,9 +327,9 @@ public class TestH5Ocopy {
// @Test(expected = HDF5LibraryException.class)
// public void testH5OcopyInvalidRef() throws Throwable {
// final long _pid_ = HDF5Constants.H5P_DEFAULT;
-// long sid = -1;
-// long did = -1;
-// long aid = -1;
+// long sid = HDF5Constants.H5I_INVALID_HID;
+// long did = HDF5Constants.H5I_INVALID_HID;
+// long aid = HDF5Constants.H5I_INVALID_HID;
//
// try {
// sid = H5.H5Screate_simple(1, new long[] {1}, null);
diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java
index 8b644db..79849f6 100644
--- a/java/test/TestH5Ocreate.java
+++ b/java/test/TestH5Ocreate.java
@@ -40,13 +40,13 @@ public class TestH5Ocreate {
private static final String H5_FILE = "testO.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 H5fcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did1 = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
+ long H5gcpl = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
private final void _deleteFile(String filename) {
@@ -63,7 +63,7 @@ public class TestH5Ocreate {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -79,7 +79,7 @@ public class TestH5Ocreate {
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
H5gcpl = HDF5Constants.H5P_DEFAULT;
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
@@ -292,7 +292,7 @@ public class TestH5Ocreate {
@Test
public void testH5Olink() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
H5O_info_t dst_obj_info = null;
try {
@@ -379,7 +379,7 @@ public class TestH5Ocreate {
@Test
public void testH5Ocomment() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -404,7 +404,7 @@ public class TestH5Ocreate {
@Test
public void testH5Ocomment_clear() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
String obj_comment = null;
try {
oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT);
@@ -505,7 +505,7 @@ public class TestH5Ocreate {
@Test
public void testH5Oinc_dec_count() {
- long oid = -1;
+ long oid = HDF5Constants.H5I_INVALID_HID;
H5O_info_t obj_info = null;
try {
try {
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index b61f3ad..3879128 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -40,20 +40,20 @@ public class TestH5P {
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;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long lapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long fcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocpl_id = HDF5Constants.H5I_INVALID_HID;
+ long ocp_plist_id = HDF5Constants.H5I_INVALID_HID;
+ long lcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long gapl_id = HDF5Constants.H5I_INVALID_HID;
+ long gcpl_id = HDF5Constants.H5I_INVALID_HID;
+ long acpl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -64,7 +64,7 @@ public class TestH5P {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java
index 18d8b92..8b04629 100644
--- a/java/test/TestH5PData.java
+++ b/java/test/TestH5PData.java
@@ -36,10 +36,10 @@ public class TestH5PData {
private static final String H5_FILE = "testPD.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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
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},
@@ -65,7 +65,7 @@ public class TestH5PData {
}
private final long _createFloatDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java
index ac8c083..d44cc0b 100644
--- a/java/test/TestH5PL.java
+++ b/java/test/TestH5PL.java
@@ -146,11 +146,11 @@ public class TestH5PL {
@Ignore
public void TestH5PLdlopen() {
- long file_id = -1;
- long filespace_id = -1;
- long dataset_id = -1;
- long fapl_id = -1;
- long dcpl_id = -1;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filespace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dcpl_id = HDF5Constants.H5I_INVALID_HID;
try {
int[] cd_values = {9, 0, 0, 0};
int[] libversion = {0, 0, 0};
diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index 7e704a9..cc674e2 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -46,17 +46,17 @@ public class TestH5Pfapl {
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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdsid = HDF5Constants.H5I_INVALID_HID;
+ long H5Fdid = HDF5Constants.H5I_INVALID_HID;
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 fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
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},
@@ -129,7 +129,7 @@ public class TestH5Pfapl {
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl);
@@ -384,7 +384,7 @@ public class TestH5Pfapl {
@Test
public void testH5Pget_elink_fapl() {
- long ret_val_id = -1;
+ long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
assertTrue("H5Pget_elink_fapl", ret_val_id >= 0);
@@ -402,7 +402,7 @@ public class TestH5Pfapl {
@Test
public void testH5P_elink_fapl() {
- long ret_val_id = -1;
+ long ret_val_id = HDF5Constants.H5I_INVALID_HID;
try {
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
ret_val_id = H5.H5Pget_elink_fapl(plapl_id);
@@ -420,7 +420,7 @@ public class TestH5Pfapl {
@Test
public void testH5P_elink_file_cache_size() {
- long elink_fapl_id = -1;
+ long elink_fapl_id = HDF5Constants.H5I_INVALID_HID;
int efc_size = 0;
try {
H5.H5Pset_elink_fapl(plapl_id, fapl_id );
diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java
index d358ed3..d922666 100644
--- a/java/test/TestH5Pfaplhdfs.java
+++ b/java/test/TestH5Pfaplhdfs.java
@@ -33,11 +33,11 @@ import org.junit.rules.TestName;
public class TestH5Pfaplhdfs {
@Rule public TestName testname = new TestName();
- long fapl_id = -1;
- long plapl_id = -1;
- long dapl_id = -1;
- long plist_id = -1;
- long btplist_id = -1;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createFileAccess() throws NullPointerException, HDF5Exception
diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java
index 1c7b3ca..dda2716 100644
--- a/java/test/TestH5Pfapls3.java
+++ b/java/test/TestH5Pfapls3.java
@@ -33,11 +33,11 @@ import org.junit.rules.TestName;
public class TestH5Pfapls3 {
@Rule public TestName testname = new TestName();
- long fapl_id = -1;
- long plapl_id = -1;
- long dapl_id = -1;
- long plist_id = -1;
- long btplist_id = -1;
+ long fapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plapl_id = HDF5Constants.H5I_INVALID_HID;
+ long dapl_id = HDF5Constants.H5I_INVALID_HID;
+ long plist_id = HDF5Constants.H5I_INVALID_HID;
+ long btplist_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createFileAccess() throws NullPointerException, HDF5Exception
diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java
index 5778565..0d53071 100644
--- a/java/test/TestH5Plist.java
+++ b/java/test/TestH5Plist.java
@@ -84,7 +84,7 @@ public class TestH5Plist {
PROP3_NAME,
PROP4_NAME};
- long plist_class_id = -1;
+ long plist_class_id = HDF5Constants.H5I_INVALID_HID;
@Before
public void createPropClass()throws NullPointerException, HDF5Exception
@@ -113,9 +113,9 @@ public class TestH5Plist {
@Test
public void testH5P_genprop_basic_class() {
int status = -1;
- long cid1 = -1; // Generic Property class ID
- long cid2 = -1; // Generic Property class ID
- long cid3 = -1; // Generic Property class ID
+ long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+ long cid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
String name = null; // Name of class
try {
@@ -161,7 +161,7 @@ public class TestH5Plist {
// Close parent class
try {
H5.H5Pclose_class(cid2);
- cid2 = -1;
+ cid2 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -171,7 +171,7 @@ public class TestH5Plist {
// Close class
try {
H5.H5Pclose_class(plist_class_id);
- plist_class_id = -1;
+ plist_class_id = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -241,7 +241,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid3);
- cid3 = -1;
+ cid3 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -251,7 +251,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid2);
- cid2 = -1;
+ cid2 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -261,7 +261,7 @@ public class TestH5Plist {
// Close parent class's parent
try {
H5.H5Pclose_class(cid1);
- cid1 = -1;
+ cid1 = HDF5Constants.H5I_INVALID_HID;
}
catch (Throwable err) {
err.printStackTrace();
@@ -633,7 +633,7 @@ public class TestH5Plist {
@Test
public void testH5P_genprop_basic_list_prop() {
boolean status = false;
- long lid1 = -1; // Generic Property list ID
+ long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
long nprops = -1; // Number of properties in class
try {
@@ -759,7 +759,7 @@ public class TestH5Plist {
// @Test
// public void testH5P_genprop_class_callback() {
// class cdata {
-// public long cls_id = -1;
+// public long cls_id = HDF5Constants.H5I_INVALID_HID;
// public int cls_count = -1;
// cdata(long id, int count) {
// this.cls_id = id;
@@ -812,11 +812,11 @@ public class TestH5Plist {
// }
// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback();
//
-// long cid1 = -1; // Generic Property class ID
-// long cid2 = -1; // Generic Property class ID
-// long lid1 = -1; // Generic Property list ID
-// long lid2 = -1; // Generic Property list ID
-// long lid3 = -1; // Generic Property list ID
+// long cid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+// long cid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property class ID
+// long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+// long lid2 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
+// long lid3 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID
// long nprops = -1; // Number of properties in class
//
// try {
diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java
index abc0f3d..0478356 100644
--- a/java/test/TestH5Pvirtual.java
+++ b/java/test/TestH5Pvirtual.java
@@ -51,13 +51,13 @@ public class TestH5Pvirtual {
private static final int fill_value = -1;
long[] H5dims = { DIM_Y };
long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y };
- long H5fid = -1;
- long H5dsid = -1;
- long H5dssid = -1;
- long H5dvsid = -1;
- long H5did = -1;
- long H5dcplid = -1;
- long H5dapl_id = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5dssid = HDF5Constants.H5I_INVALID_HID;
+ long H5dvsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5dcplid = HDF5Constants.H5I_INVALID_HID;
+ long H5dapl_id = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = new File(filename);
@@ -68,8 +68,8 @@ public class TestH5Pvirtual {
}
private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) {
- long did = -1;
- long space_id = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
long[] start = {0, 0};
long[] stride = null;
long[] count = {1, 1};
@@ -99,9 +99,9 @@ public class TestH5Pvirtual {
int[] dset_data = new int[DIM_Y];
// Create source files and datasets
for (int i=0; i < 3; i++) {
- long space_id = -1;
- long dset_id = -1;
- long file_id = -1;
+ long space_id = HDF5Constants.H5I_INVALID_HID;
+ long dset_id = HDF5Constants.H5I_INVALID_HID;
+ long file_id = HDF5Constants.H5I_INVALID_HID;
for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1;
try {
@@ -264,7 +264,7 @@ public class TestH5Pvirtual {
@Test
public void testH5Pget_selection_source_dataset() throws Throwable {
- long src_space = -1;
+ long src_space = HDF5Constants.H5I_INVALID_HID;
long src_selection = -1;
H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id);
diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java
index eae795c..dd0c072 100644
--- a/java/test/TestH5R.java
+++ b/java/test/TestH5R.java
@@ -13,6 +13,7 @@
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;
@@ -23,9 +24,11 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -35,12 +38,14 @@ public class TestH5R {
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 H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5dsid = HDF5Constants.H5I_INVALID_HID;
+ long H5did = HDF5Constants.H5I_INVALID_HID;
+ long H5gid = HDF5Constants.H5I_INVALID_HID;
+ long H5did2 = HDF5Constants.H5I_INVALID_HID;
long[] H5dims = { DIM_X, DIM_Y };
+ int[][] dset_data = new int[DIM_X][DIM_Y];
+ int FILLVAL = 99;
private final void _deleteFile(String filename) {
File file = null;
@@ -50,12 +55,13 @@ public class TestH5R {
catch (Throwable err) {}
if (file.exists()) {
- try {file.delete();} catch (SecurityException e) {}
+ try {file.delete();} catch (SecurityException e) {e.printStackTrace();}
}
+ assertFalse("TestH5R._deleteFile file still exists ", file.exists());
}
private final long _createDataset(long fid, long dsid, String name, long dapl) {
- long did = -1;
+ long did = HDF5Constants.H5I_INVALID_HID;
try {
did = H5.H5Dcreate(fid, name,
HDF5Constants.H5T_STD_I32BE, dsid,
@@ -65,13 +71,13 @@ public class TestH5R {
err.printStackTrace();
fail("H5.H5Dcreate: " + err);
}
- assertTrue("TestH5R._createDataset: ",did > 0);
+ assertTrue("TestH5R._createDataset: ", did > 0);
return did;
}
private final long _createGroup(long fid, String name) {
- long gid = -1;
+ long gid = HDF5Constants.H5I_INVALID_HID;
try {
gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
@@ -99,6 +105,21 @@ public class TestH5R {
H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT);
H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT);
+ // Initialize the dataset.
+ for (int indx = 0; indx < DIM_X; indx++)
+ for (int jndx = 0; jndx < DIM_Y; jndx++)
+ dset_data[indx][jndx] = FILLVAL;
+
+ try {
+ if (H5did >= 0)
+ H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT,
+ HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
+ HDF5Constants.H5P_DEFAULT, dset_data[0]);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
}
catch (Throwable err) {
err.printStackTrace();
@@ -130,11 +151,11 @@ public class TestH5R {
@Test
public void testH5Rget_name() {
- long loc_id=H5fid;
- int ref_type=HDF5Constants.H5R_OBJECT;
- long ret_val=-1;
- byte[] ref=null;
- String[] name= {""};
+ long loc_id = H5fid;
+ int ref_type = HDF5Constants.H5R_OBJECT;
+ long ret_val = -1;
+ byte[] ref = null;
+ String[] name = {""};
String objName = "/dset";
try {
@@ -159,9 +180,8 @@ public class TestH5R {
@Test
public void testH5Rget_obj_type2() {
- int ref_type=HDF5Constants.H5R_OBJECT;
- byte[] ref=null;
-
+ int ref_type = HDF5Constants.H5R_OBJECT;
+ byte[] ref = null;
String objName = "/dset";
int obj_type = -1;;
@@ -213,20 +233,20 @@ public class TestH5R {
public void testH5Rdereference() {
byte[] ref1 = null;
byte[] ref2 = null;
- long dataset_id = -1;
- long group_id = -1;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long group_id = HDF5Constants.H5I_INVALID_HID;
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);
+ 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);
+ group_id = H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2);
assertNotNull(ref1);
assertNotNull(ref2);
- assertTrue(dataset_id>=0);
- assertTrue(group_id>=0);
+ assertTrue(dataset_id >= 0);
+ assertTrue(group_id >= 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -241,12 +261,12 @@ public class TestH5R {
@Test
public void testH5Rget_region() {
byte[] ref = null;
- long dsid = -1;
+ long dsid = HDF5Constants.H5I_INVALID_HID;
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);
+ assertTrue(dsid >= 0);
}
catch (Throwable err) {
err.printStackTrace();
@@ -260,7 +280,7 @@ public class TestH5R {
@Test(expected = IllegalArgumentException.class)
public void testH5Rget_name_Invalidreftype() throws Throwable {
byte[] ref = null;
- String[] name= {""};
+ String[] name = {""};
ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1);
H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16);
}
diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java
index 9e890c0..7eeed7a 100644
--- a/java/test/TestH5S.java
+++ b/java/test/TestH5S.java
@@ -29,7 +29,7 @@ import org.junit.rules.TestName;
public class TestH5S {
@Rule public TestName testname = new TestName();
- long H5sid = -1;
+ long H5sid = HDF5Constants.H5I_INVALID_HID;
int H5rank = 2;
long H5dims[] = {5, 5};
long H5maxdims[] = {10, 10};
@@ -180,7 +180,7 @@ public class TestH5S {
@Test
public void testH5Scopy() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int read_rank = -1;
try {
@@ -200,7 +200,7 @@ public class TestH5S {
@Test
public void testH5Sextent_copy() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
@@ -221,7 +221,7 @@ public class TestH5S {
@Test
public void testH5Sextent_equal() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
boolean result = false;
try {
@@ -251,8 +251,8 @@ public class TestH5S {
@Test
public void testH5Sencode_decode_null_dataspace() {
- long sid = -1;
- long decoded_sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] null_sbuf = null;
boolean result = false;
@@ -298,8 +298,8 @@ public class TestH5S {
@Test
public void testH5Sencode_decode_scalar_dataspace() {
- long sid = -1;
- long decoded_sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
+ long decoded_sid = HDF5Constants.H5I_INVALID_HID;
byte[] scalar_sbuf = null;
boolean result = false;
int iresult = -1;
@@ -469,7 +469,7 @@ public class TestH5S {
@Test
public void testH5Sget_select_hyper() {
- long space1 = -1;
+ long space1 = HDF5Constants.H5I_INVALID_HID;
long start[] = {0,0};
long stride[] = {1,1};
long count[] = {1,1};
@@ -507,7 +507,7 @@ public class TestH5S {
@Test
public void testH5Sget_select_valid() {
- long space1 = -1;
+ long space1 = HDF5Constants.H5I_INVALID_HID;
long start[] = {1,0};
long stride[] = {1,1};
long count[] = {2,3};
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index be05bde..548ac95 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.java
@@ -55,7 +55,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_scalar() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_SCALAR);
@@ -74,7 +74,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_null() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
try {
sid = H5.H5Screate(HDF5Constants.H5S_NULL);
@@ -124,7 +124,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 2;
long dims[] = {5, 5};
@@ -147,7 +147,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_unlimted() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 2;
long dims[] = {5, 5};
@@ -170,7 +170,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_unlimted_1d() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int class_type = -1;
int rank = 1;
long dims[] = {5};
@@ -193,7 +193,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_max_default() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int rank = 2;
long dims[] = {5, 5};
@@ -212,7 +212,7 @@ public class TestH5Sbasic {
@Test
public void testH5Screate_simple_extent() {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
int rank = 2;
long dims[] = {5, 5};
long maxdims[] = {10, 10};
@@ -269,7 +269,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_adjust_rank_offset() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long offset[][] = {{0,1},{2,4},{5,6}};
try {
@@ -291,7 +291,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_intersect_block_rank_start() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = new long[2];
long end[] = null;
@@ -307,7 +307,7 @@ public class TestH5Sbasic {
@Test(expected = IllegalArgumentException.class)
public void testH5Sselect_intersect_block_rank_end() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = null;
long end[] = new long[2];
@@ -335,7 +335,7 @@ public class TestH5Sbasic {
@Test(expected = NullPointerException.class)
public void testH5Scombine_hyperslab_null_start() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = null;
long stride[] = null;
long count[] = new long[2];
@@ -353,7 +353,7 @@ public class TestH5Sbasic {
@Test(expected = NullPointerException.class)
public void testH5Scombine_hyperslab_null_count() throws Throwable {
- long sid = -1;
+ long sid = HDF5Constants.H5I_INVALID_HID;
long start[] = new long[2];
long stride[] = null;
long count[] = null;
diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java
index cca68ca..ed4e2a9 100644
--- a/java/test/TestH5T.java
+++ b/java/test/TestH5T.java
@@ -32,8 +32,8 @@ import org.junit.rules.TestName;
public class TestH5T {
@Rule public TestName testname = new TestName();
private static final String H5_FILE = "testT.h5";
- long H5fid = -1;
- long H5strdid = -1;
+ long H5fid = HDF5Constants.H5I_INVALID_HID;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
private final void _deleteFile(String filename) {
File file = null;
@@ -128,7 +128,7 @@ public class TestH5T {
@Test
public void testH5Tarray_create() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
long[] adims = { 3, 5 };
try {
@@ -147,7 +147,7 @@ public class TestH5T {
@Test
public void testH5Tget_array_ndims() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
int ndims = 0;
long[] adims = { 3, 5 };
@@ -175,7 +175,7 @@ public class TestH5T {
@Test
public void testH5Tget_array_dims() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
int ndims = 0;
long[] adims = { 3, 5 };
long[] rdims = new long[2];
@@ -206,7 +206,7 @@ public class TestH5T {
@Test
public void testH5Tenum_functions() {
- long filetype_id =-1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
String enum_type ="Enum_type";
byte[] enum_val = new byte[1];
String enum_name = null;
@@ -274,7 +274,7 @@ public class TestH5T {
@Test
public void testH5Tenum_create_functions() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
byte[] enum_val = new byte[1];
// Create a enumerate datatype
@@ -314,7 +314,7 @@ public class TestH5T {
@Test
public void testH5Topaque_functions() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
String opaque_name = null;
// Create a opaque datatype
@@ -344,7 +344,7 @@ public class TestH5T {
@Test
public void testH5Tvlen_create() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
try {
filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1);
@@ -367,7 +367,7 @@ public class TestH5T {
@Test
public void testH5Tis_variable_str() {
- long filetype_id = -1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
try {
filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
@@ -398,7 +398,7 @@ public class TestH5T {
@Test
public void testH5Tcompound_functions() {
- long filetype_id =-1;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
// Create a compound datatype
try {
diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java
index bb71bc8..7aac2ab 100644
--- a/java/test/TestH5Tbasic.java
+++ b/java/test/TestH5Tbasic.java
@@ -39,7 +39,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tcopy() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -56,7 +56,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tequal() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -75,7 +75,7 @@ public class TestH5Tbasic {
@Test
public void testH5Tequal_not() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE);
assertTrue("H5.H5Tcopy",H5strdid > 0);
@@ -97,8 +97,8 @@ public class TestH5Tbasic {
String[] strs = {"a1234","b1234"};
int srcLen = 5;
int dstLen = 10;
- long srcId = -1;
- long dstId = -1;
+ long srcId = HDF5Constants.H5I_INVALID_HID;
+ long dstId = HDF5Constants.H5I_INVALID_HID;
int dimSize = strs.length;
byte[] buf = new byte[dimSize*dstLen];
@@ -130,7 +130,7 @@ public class TestH5Tbasic {
@Test
public void testH5Torder_size() {
- long H5strdid = -1;
+ long H5strdid = HDF5Constants.H5I_INVALID_HID;
try {
// Fixed length string
H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1);
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index a3a52af..9bb2ba8 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -45,6 +45,8 @@ HDFLIB_HOME="$top_srcdir/java/lib"
BLDDIR="."
BLDLIBDIR="$BLDDIR/testlibs"
HDFTEST_HOME="$top_srcdir/java/test"
+TOOLS_TESTFILES="$top_srcdir/tools/testfiles"
+
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
TESTJARFILE=jar@PACKAGE_TARNAME@test.jar
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
@@ -144,7 +146,7 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
- if [ "$IS_DARWIN" = "yes" ]; then
+ if [ "$IS_DARWIN" = "yes" ]; then
(cd testlibs; \
install_name_tool -add_rpath @loader_path libhdf5_java.dylib; \
exist_path=` otool -l libhdf5_java.dylib | grep libhdf5 | grep -v java | awk '{print $2}'`; \
@@ -246,6 +248,8 @@ COPY_DATAFILES_TO_BLDDIR()
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateL2.hdf
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO1.hdf
$CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterateO2.hdf
+ $CP -f $TOOLS_TESTFILES/tdatareg.h5 $BLDDIR/trefer_reg.h5
+ $CP -f $TOOLS_TESTFILES/tattrreg.h5 $BLDDIR/tattrreg.h5
}
CLEAN_DATAFILES_AND_BLDDIR()
diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt
index 4bab633..59765d9 100644
--- a/java/test/testfiles/JUnit-TestH5.txt
+++ b/java/test/testfiles/JUnit-TestH5.txt
@@ -3,8 +3,10 @@ JUnit version 4.11
.testJ2C
.testH5export_dataset
.testIsSerializable
+.testH5export_attrdataset
.testH5garbage_collect
.testH5error_off
+.testH5export_regdataset
.serializeToDisk
.testH5open
.testH5check_version
@@ -13,5 +15,5 @@ JUnit version 4.11
Time: XXXX
-OK (11 tests)
+OK (13 tests)