diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-04-19 18:08:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-19 18:08:09 (GMT) |
commit | 03c3a5469542688a52d5a20242d2334408f8ba33 (patch) | |
tree | 46e30ea4aa99b68279fe80c9ad56b1a6bbfcfe7c /java | |
parent | 32ef796e470da3e4de364d8dc469b03f5f6fafdc (diff) | |
download | hdf5-03c3a5469542688a52d5a20242d2334408f8ba33.zip hdf5-03c3a5469542688a52d5a20242d2334408f8ba33.tar.gz hdf5-03c3a5469542688a52d5a20242d2334408f8ba33.tar.bz2 |
Develop clang format java (#1653)
Diffstat (limited to 'java')
157 files changed, 13343 insertions, 10078 deletions
diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 8198135..e63ead0 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -62,6 +62,13 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_${example}_SRC_FORMAT ${example}.java) + endif () endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java index 4e10c23..4853cc0 100644 --- a/java/examples/datasets/H5Ex_D_Alloc.java +++ b/java/examples/datasets/H5Ex_D_Alloc.java @@ -29,49 +29,47 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Alloc { - private static String FILENAME = "H5Ex_D_Alloc.h5"; + private static String FILENAME = "H5Ex_D_Alloc.h5"; private static String DATASETNAME1 = "DS1"; private static String DATASETNAME2 = "DS2"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int FILLVAL = 99; - private static final int RANK = 2; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int FILLVAL = 99; + private static final int RANK = 2; // Values for the status of space allocation enum H5D_space_status { - H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED(1), H5D_SPACE_STATUS_ALLOCATED( - 2); + H5D_SPACE_STATUS_ERROR(-1), + H5D_SPACE_STATUS_NOT_ALLOCATED(0), + H5D_SPACE_STATUS_PART_ALLOCATED(1), + H5D_SPACE_STATUS_ALLOCATED(2); private static final Map<Integer, H5D_space_status> lookup = new HashMap<Integer, H5D_space_status>(); - static { + static + { for (H5D_space_status s : EnumSet.allOf(H5D_space_status.class)) lookup.put(s.getCode(), s); } private int code; - H5D_space_status(int space_status) { - this.code = space_status; - } + H5D_space_status(int space_status) { this.code = space_status; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5D_space_status get(int code) { - return lookup.get(code); - } + public static H5D_space_status get(int code) { return lookup.get(code); } } - private static void allocation() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void allocation() + { + 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 }; + 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; + int space_status = 0; long storage_size = 0; // Initialize the dataset. @@ -82,7 +80,7 @@ public class H5Ex_D_Alloc { // Create a file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -125,7 +123,8 @@ public class H5Ex_D_Alloc { try { if ((file_id >= 0) && (filespace_id >= 0)) dataset_id1 = H5.H5Dcreate(file_id, DATASETNAME1, HDF5Constants.H5T_NATIVE_INT, filespace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -135,7 +134,7 @@ public class H5Ex_D_Alloc { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id2 = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_NATIVE_INT, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -190,16 +189,16 @@ public class H5Ex_D_Alloc { // Write the data to the datasets. try { if (dataset_id1 >= 0) - H5.H5Dwrite(dataset_id1, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data[0]); + H5.H5Dwrite(dataset_id1, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data[0]); } catch (Exception e) { e.printStackTrace(); } try { if (dataset_id2 >= 0) - H5.H5Dwrite(dataset_id2, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data[0]); + H5.H5Dwrite(dataset_id2, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data[0]); } catch (Exception e) { e.printStackTrace(); @@ -291,8 +290,5 @@ public class H5Ex_D_Alloc { } } - public static void main(String[] args) { - H5Ex_D_Alloc.allocation(); - } - + public static void main(String[] args) { H5Ex_D_Alloc.allocation(); } } diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java index 781dd68..7b01176 100644 --- a/java/examples/datasets/H5Ex_D_Checksum.java +++ b/java/examples/datasets/H5Ex_D_Checksum.java @@ -30,42 +30,46 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Checksum { - private static String FILENAME = "H5Ex_D_Checksum.h5"; + private static String FILENAME = "H5Ex_D_Checksum.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(-1), H5Z_FILTER_NONE(0), H5Z_FILTER_DEFLATE(1), H5Z_FILTER_SHUFFLE(2), H5Z_FILTER_FLETCHER32(3), H5Z_FILTER_SZIP( - 4), H5Z_FILTER_NBIT(5), H5Z_FILTER_SCALEOFFSET(6), H5Z_FILTER_RESERVED(256), H5Z_FILTER_MAX(65535); + H5Z_FILTER_ERROR(-1), + H5Z_FILTER_NONE(0), + H5Z_FILTER_DEFLATE(1), + H5Z_FILTER_SHUFFLE(2), + H5Z_FILTER_FLETCHER32(3), + H5Z_FILTER_SZIP(4), + H5Z_FILTER_NBIT(5), + H5Z_FILTER_SCALEOFFSET(6), + H5Z_FILTER_RESERVED(256), + H5Z_FILTER_MAX(65535); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkFletcher32Filter() { + private static boolean checkFletcher32Filter() + { try { int available = H5.H5Zfilter_avail(H5Z_filter.H5Z_FILTER_FLETCHER32.getCode()); if (available == 0) { @@ -79,8 +83,8 @@ public class H5Ex_D_Checksum { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("N-Bit filter not available for encoding and decoding."); return false; } @@ -91,13 +95,14 @@ public class H5Ex_D_Checksum { return true; } - private static void writeChecksum() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeChecksum() + { + 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 }; + 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]; // Initialize data. @@ -108,7 +113,7 @@ public class H5Ex_D_Checksum { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -140,7 +145,7 @@ public class H5Ex_D_Checksum { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -149,8 +154,8 @@ public class H5Ex_D_Checksum { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -191,10 +196,11 @@ public class H5Ex_D_Checksum { } } - private static void readChecksum() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readChecksum() + { + 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. @@ -228,14 +234,14 @@ public class H5Ex_D_Checksum { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -264,7 +270,7 @@ public class H5Ex_D_Checksum { try { if (dataset_id >= 0) { int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, - HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); // Check if the read was successful. Normally we do not perform // error checking in these examples for the sake of clarity, but in // this case we will make an exception because this is how the @@ -328,7 +334,8 @@ public class H5Ex_D_Checksum { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if the Fletcher32 filter is available and can be used for // both encoding and decoding. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -340,5 +347,4 @@ public class H5Ex_D_Checksum { H5Ex_D_Checksum.readChecksum(); } } - } diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java index 2ddf293..fbfc148 100644 --- a/java/examples/datasets/H5Ex_D_Chunk.java +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -30,47 +30,48 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Chunk { - private static String FILENAME = "H5Ex_D_Chunk.h5"; + private static String FILENAME = "H5Ex_D_Chunk.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 6; - private static final int DIM_Y = 8; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5D_layout { - H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_VIRTUAL(3), H5D_NLAYOUTS(4); + H5D_LAYOUT_ERROR(-1), + H5D_COMPACT(0), + H5D_CONTIGUOUS(1), + H5D_CHUNKED(2), + H5D_VIRTUAL(3), + H5D_NLAYOUTS(4); private static final Map<Integer, H5D_layout> lookup = new HashMap<Integer, H5D_layout>(); - static { + static + { for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) lookup.put(s.getCode(), s); } private int code; - H5D_layout(int layout_type) { - this.code = layout_type; - } + H5D_layout(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5D_layout get(int code) { - return lookup.get(code); - } + public static H5D_layout get(int code) { return lookup.get(code); } } - private static void writeChunk() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeChunk() + { + 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 }; + 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]; // Initialize data to "1", to make it easier to see the selections. @@ -91,7 +92,7 @@ public class H5Ex_D_Chunk { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -127,20 +128,21 @@ public class H5Ex_D_Chunk { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } // Define and select the first part of the hyperslab selection. - long[] start = { 0, 0 }; - long[] stride = { 3, 3 }; - long[] count = { 2, 3 }; - long[] block = { 2, 2 }; + long[] start = {0, 0}; + long[] stride = {3, 3}; + long[] count = {2, 3}; + long[] block = {2, 2}; try { if ((filespace_id >= 0)) - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, + block); } catch (Exception e) { e.printStackTrace(); @@ -152,12 +154,13 @@ public class H5Ex_D_Chunk { block[1] = 1; try { if ((filespace_id >= 0)) { - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, + block); // Write the data to the dataset. if (dataset_id >= 0) H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } } catch (Exception e) { @@ -199,11 +202,12 @@ public class H5Ex_D_Chunk { } } - private static void readChunk() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readChunk() + { + 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 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. @@ -267,8 +271,8 @@ public class H5Ex_D_Chunk { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -294,18 +298,19 @@ public class H5Ex_D_Chunk { if (dataset_id >= 0) { filespace_id = H5.H5Dget_space(dataset_id); - long[] start = { 0, 1 }; - long[] stride = { 4, 4 }; - long[] count = { 2, 2 }; - long[] block = { 2, 3 }; + long[] start = {0, 1}; + long[] stride = {4, 4}; + long[] count = {2, 2}; + long[] block = {2, 3}; if (filespace_id >= 0) { - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, + block); // Read the data using the previously defined hyperslab. if ((dataset_id >= 0) && (filespace_id >= 0)) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + filespace_id, HDF5Constants.H5P_DEFAULT, dset_data); } } } @@ -358,9 +363,9 @@ public class H5Ex_D_Chunk { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_Chunk.writeChunk(); H5Ex_D_Chunk.readChunk(); } - } diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java index 0abf8da..3a60283 100644 --- a/java/examples/datasets/H5Ex_D_Compact.java +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -27,43 +27,44 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Compact { - private static String FILENAME = "H5Ex_D_Compact.h5"; + private static String FILENAME = "H5Ex_D_Compact.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int RANK = 2; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; // Values for the status of space allocation enum H5D_layout { - H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_VIRTUAL(3), H5D_NLAYOUTS(4); + H5D_LAYOUT_ERROR(-1), + H5D_COMPACT(0), + H5D_CONTIGUOUS(1), + H5D_CHUNKED(2), + H5D_VIRTUAL(3), + H5D_NLAYOUTS(4); private static final Map<Integer, H5D_layout> lookup = new HashMap<Integer, H5D_layout>(); - static { + static + { for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) lookup.put(s.getCode(), s); } private int code; - H5D_layout(int layout_type) { - this.code = layout_type; - } + H5D_layout(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5D_layout get(int code) { - return lookup.get(code); - } + public static H5D_layout get(int code) { return lookup.get(code); } } - private static void writeCompact() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeCompact() + { + 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 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]; // Initialize data. @@ -74,7 +75,7 @@ public class H5Ex_D_Compact { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -110,7 +111,7 @@ public class H5Ex_D_Compact { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -119,8 +120,8 @@ public class H5Ex_D_Compact { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -161,11 +162,12 @@ public class H5Ex_D_Compact { } } - private static void readCompact() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readCompact() + { + 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 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. @@ -229,8 +231,8 @@ public class H5Ex_D_Compact { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -281,9 +283,9 @@ public class H5Ex_D_Compact { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_Compact.writeCompact(); H5Ex_D_Compact.readCompact(); } - } diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java index 9c3787f..d706fb7 100644 --- a/java/examples/datasets/H5Ex_D_External.java +++ b/java/examples/datasets/H5Ex_D_External.java @@ -24,20 +24,21 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_External { - private static String FILENAME = "H5Ex_D_External.h5"; - private static String EXTERNALNAME = "H5Ex_D_External.data"; - private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int RANK = 2; + private static String FILENAME = "H5Ex_D_External.h5"; + private static String EXTERNALNAME = "H5Ex_D_External.data"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; private static final int NAME_BUF_SIZE = 32; - private static void writeExternal() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void writeExternal() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize the dataset. @@ -48,7 +49,7 @@ public class H5Ex_D_External { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -84,7 +85,7 @@ public class H5Ex_D_External { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -92,8 +93,8 @@ public class H5Ex_D_External { // Write the dataset. try { - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -133,15 +134,15 @@ public class H5Ex_D_External { catch (Exception e) { e.printStackTrace(); } - } - private static void readExternal() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + private static void readExternal() + { + 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]; + String[] Xname = new String[1]; // Open file using the default properties. try { @@ -183,8 +184,8 @@ public class H5Ex_D_External { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -227,9 +228,9 @@ public class H5Ex_D_External { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_External.writeExternal(); H5Ex_D_External.readExternal(); } - } diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java index 3526993..db4dff7 100644 --- a/java/examples/datasets/H5Ex_D_FillValue.java +++ b/java/examples/datasets/H5Ex_D_FillValue.java @@ -26,29 +26,30 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_FillValue { - private static String FILENAME = "H5Ex_D_FillValue.h5"; + private static String FILENAME = "H5Ex_D_FillValue.h5"; private static String DATASETNAME = "ExtendibleArray"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int EDIM_X = 6; - private static final int EDIM_Y = 10; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; - private static final int FILLVAL = 99; - - private static void fillValue() { - long file_id = 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 }; - long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; - int[][] write_dset_data = new int[DIM_X][DIM_Y]; - int[][] read_dset_data = new int[DIM_X][DIM_Y]; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + + private static void fillValue() + { + long file_id = 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}; + long[] maxdims = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED}; + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; // Initialize the dataset. @@ -59,7 +60,7 @@ public class H5Ex_D_FillValue { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -92,7 +93,7 @@ public class H5Ex_D_FillValue { // Set the fill value for the dataset try { - int[] fill_value = { FILLVAL }; + int[] fill_value = {FILLVAL}; if (dcpl_id >= 0) H5.H5Pset_fill_value(dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); } @@ -115,7 +116,7 @@ public class H5Ex_D_FillValue { try { if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -124,8 +125,8 @@ public class H5Ex_D_FillValue { // Read values from the dataset, which has not been written to yet. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, read_dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_dset_data); } catch (Exception e) { e.printStackTrace(); @@ -144,8 +145,8 @@ public class H5Ex_D_FillValue { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, write_dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, write_dset_data); } catch (Exception e) { e.printStackTrace(); @@ -154,8 +155,8 @@ public class H5Ex_D_FillValue { // Read the data back. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, read_dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_dset_data); } catch (Exception e) { e.printStackTrace(); @@ -183,8 +184,8 @@ public class H5Ex_D_FillValue { // Read from the extended dataset. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, extend_dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, extend_dset_data); } catch (Exception e) { e.printStackTrace(); @@ -233,11 +234,7 @@ public class H5Ex_D_FillValue { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5Ex_D_FillValue.fillValue(); } + public static void main(String[] args) { H5Ex_D_FillValue.fillValue(); } } diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java index 404ff05..0a94254 100644 --- a/java/examples/datasets/H5Ex_D_Gzip.java +++ b/java/examples/datasets/H5Ex_D_Gzip.java @@ -29,45 +29,46 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Gzip { - private static String FILENAME = "H5Ex_D_Gzip.h5"; + private static String FILENAME = "H5Ex_D_Gzip.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkGzipFilter() { + private static boolean checkGzipFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); if (available == 0) { @@ -81,8 +82,8 @@ public class H5Ex_D_Gzip { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("gzip filter not available for encoding and decoding."); return false; } @@ -93,13 +94,14 @@ public class H5Ex_D_Gzip { return true; } - private static void writeGzip() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeGzip() + { + 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 }; + 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]; // Initialize data. @@ -110,7 +112,7 @@ public class H5Ex_D_Gzip { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -143,7 +145,7 @@ public class H5Ex_D_Gzip { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -152,8 +154,8 @@ public class H5Ex_D_Gzip { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -194,10 +196,11 @@ public class H5Ex_D_Gzip { } } - private static void readGzip() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readGzip() + { + 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. @@ -231,14 +234,14 @@ public class H5Ex_D_Gzip { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -272,8 +275,8 @@ public class H5Ex_D_Gzip { // Read the data using the default properties. try { if (dataset_id >= 0) { - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } } catch (Exception e) { @@ -318,7 +321,8 @@ public class H5Ex_D_Gzip { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if gzip compression is available and can be used for both // compression and decompression. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -329,5 +333,4 @@ public class H5Ex_D_Gzip { H5Ex_D_Gzip.readGzip(); } } - } diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java index fa3473f..0575d50 100644 --- a/java/examples/datasets/H5Ex_D_Hyperslab.java +++ b/java/examples/datasets/H5Ex_D_Hyperslab.java @@ -26,17 +26,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Hyperslab { - private static String FILENAME = "H5Ex_D_Hyperslab.h5"; + private static String FILENAME = "H5Ex_D_Hyperslab.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 6; - private static final int DIM_Y = 8; - private static final int RANK = 2; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int RANK = 2; - private static void writeHyperslab() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeHyperslab() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize data to "1", to make it easier to see the selections. @@ -57,7 +58,7 @@ public class H5Ex_D_Hyperslab { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -76,20 +77,22 @@ public class H5Ex_D_Hyperslab { try { if ((file_id >= 0) && (filespace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } // Define and select the first part of the hyperslab selection. - long[] start = { 0, 0 }; - long[] stride = { 3, 3 }; - long[] count = { 2, 3 }; - long[] block = { 2, 2 }; + long[] start = {0, 0}; + long[] stride = {3, 3}; + long[] count = {2, 3}; + long[] block = {2, 2}; try { if ((filespace_id >= 0)) - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, + block); } catch (Exception e) { e.printStackTrace(); @@ -101,12 +104,13 @@ public class H5Ex_D_Hyperslab { block[1] = 1; try { if ((filespace_id >= 0)) { - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, + block); // Write the data to the dataset. if (dataset_id >= 0) H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } } catch (Exception e) { @@ -140,11 +144,12 @@ public class H5Ex_D_Hyperslab { } } - private static void readHyperslab() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readHyperslab() + { + 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 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. @@ -167,8 +172,8 @@ public class H5Ex_D_Hyperslab { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -194,18 +199,19 @@ public class H5Ex_D_Hyperslab { if (dataset_id >= 0) { filespace_id = H5.H5Dget_space(dataset_id); - long[] start = { 0, 1 }; - long[] stride = { 4, 4 }; - long[] count = { 2, 2 }; - long[] block = { 2, 3 }; + long[] start = {0, 1}; + long[] stride = {4, 4}; + long[] count = {2, 2}; + long[] block = {2, 3}; if (filespace_id >= 0) { - H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, + block); // Read the data using the previously defined hyperslab. if ((dataset_id >= 0) && (filespace_id >= 0)) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + filespace_id, HDF5Constants.H5P_DEFAULT, dset_data); } } } @@ -258,9 +264,9 @@ public class H5Ex_D_Hyperslab { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_Hyperslab.writeHyperslab(); H5Ex_D_Hyperslab.readHyperslab(); } - } diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java index 35d23a9..d54ce21 100644 --- a/java/examples/datasets/H5Ex_D_Nbit.java +++ b/java/examples/datasets/H5Ex_D_Nbit.java @@ -29,45 +29,46 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Nbit { - private static String FILENAME = "H5Ex_D_Nbit.h5"; + private static String FILENAME = "H5Ex_D_Nbit.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkNbitFilter() { + private static boolean checkNbitFilter() + { try { // Check if N-Bit compression is available and can be used for both compression and decompression. int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); @@ -82,8 +83,8 @@ public class H5Ex_D_Nbit { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("N-Bit filter not available for encoding and decoding."); return false; } @@ -94,14 +95,15 @@ public class H5Ex_D_Nbit { return true; } - private static void writeData() throws Exception { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeData() throws Exception + { + 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 }; + 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]; // Initialize data. @@ -112,7 +114,7 @@ public class H5Ex_D_Nbit { try { // Create a new file using the default properties. file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); // Create dataspace. Setting maximum size to NULL sets the maximum // size to be the current size. @@ -130,12 +132,12 @@ public class H5Ex_D_Nbit { H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); // Create the dataset. - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, dtype_id, filespace_id, HDF5Constants.H5P_DEFAULT, dcpl_id, - HDF5Constants.H5P_DEFAULT); + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, dtype_id, filespace_id, HDF5Constants.H5P_DEFAULT, + dcpl_id, HDF5Constants.H5P_DEFAULT); // Write the data to the dataset. - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -155,10 +157,11 @@ public class H5Ex_D_Nbit { } } - private static void readData() throws Exception { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readData() throws Exception + { + 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. @@ -192,14 +195,14 @@ public class H5Ex_D_Nbit { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -234,7 +237,7 @@ public class H5Ex_D_Nbit { try { if (dataset_id >= 0) { int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, - HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); // Check if the read was successful. if (status < 0) System.out.print("Dataset read failed!"); @@ -280,14 +283,14 @@ public class H5Ex_D_Nbit { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { /* - * Check if N-Bit compression is available and can be used for both compression and decompression. Normally we - * do not perform error checking in these examples for the sake of clarity, but in this case we will make an - * exception because this filter is an optional part of the hdf5 library. + * Check if N-Bit compression is available and can be used for both compression and decompression. + * Normally we do not perform error checking in these examples for the sake of clarity, but in this + * case we will make an exception because this filter is an optional part of the hdf5 library. */ try { if (H5Ex_D_Nbit.checkNbitFilter()) { diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java index db930d3..4b26a2c 100644 --- a/java/examples/datasets/H5Ex_D_ReadWrite.java +++ b/java/examples/datasets/H5Ex_D_ReadWrite.java @@ -24,17 +24,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_ReadWrite { - private static String FILENAME = "H5Ex_D_ReadWrite.h5"; + private static String FILENAME = "H5Ex_D_ReadWrite.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int RANK = 2; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; - private static void WriteDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void WriteDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize data. @@ -45,7 +46,7 @@ public class H5Ex_D_ReadWrite { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -64,7 +65,8 @@ public class H5Ex_D_ReadWrite { try { if ((file_id >= 0) && (filespace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -73,8 +75,8 @@ public class H5Ex_D_ReadWrite { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -107,9 +109,10 @@ public class H5Ex_D_ReadWrite { } } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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. @@ -132,8 +135,8 @@ public class H5Ex_D_ReadWrite { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -168,9 +171,9 @@ public class H5Ex_D_ReadWrite { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_ReadWrite.WriteDataset(); H5Ex_D_ReadWrite.ReadDataset(); } - } diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java index 1dd7c6a..54a77c7 100644 --- a/java/examples/datasets/H5Ex_D_Shuffle.java +++ b/java/examples/datasets/H5Ex_D_Shuffle.java @@ -30,45 +30,46 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Shuffle { - private static String FILENAME = "H5Ex_D_Shuffle.h5"; + private static String FILENAME = "H5Ex_D_Shuffle.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkGzipFilter() { + private static boolean checkGzipFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); if (available == 0) { @@ -82,8 +83,8 @@ public class H5Ex_D_Shuffle { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("gzip filter not available for encoding and decoding."); return false; } @@ -94,7 +95,8 @@ public class H5Ex_D_Shuffle { return true; } - private static boolean checkShuffleFilter() { + private static boolean checkShuffleFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); if (available == 0) { @@ -108,8 +110,8 @@ public class H5Ex_D_Shuffle { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("Shuffle filter not available for encoding and decoding."); return false; } @@ -120,13 +122,14 @@ public class H5Ex_D_Shuffle { return true; } - private static void writeShuffle() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeShuffle() + { + 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 }; + 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]; // Initialize data. @@ -137,7 +140,7 @@ public class H5Ex_D_Shuffle { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -176,7 +179,7 @@ public class H5Ex_D_Shuffle { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -185,8 +188,8 @@ public class H5Ex_D_Shuffle { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -227,10 +230,11 @@ public class H5Ex_D_Shuffle { } } - private static void readShuffle() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readShuffle() + { + 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. @@ -266,14 +270,14 @@ public class H5Ex_D_Shuffle { int nfilters = H5.H5Pget_nfilters(dcpl_id); for (int indx = 0; indx < nfilters; indx++) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - filter_type = H5.H5Pget_filter(dcpl_id, indx, flags, cd_nelmts, cd_values, 120, filter_name, - filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, indx, flags, cd_nelmts, cd_values, 120, + filter_name, filter_config); System.out.print("Filter " + indx + ": Type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -308,8 +312,8 @@ public class H5Ex_D_Shuffle { // Read the data using the default properties. try { if (dataset_id >= 0) { - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } } catch (Exception e) { @@ -354,7 +358,8 @@ public class H5Ex_D_Shuffle { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if gzip compression is available and can be used for both // compression and decompression. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -366,5 +371,4 @@ public class H5Ex_D_Shuffle { H5Ex_D_Shuffle.readShuffle(); } } - } diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java index 8edde09..a5f5cd8 100644 --- a/java/examples/datasets/H5Ex_D_Sofloat.java +++ b/java/examples/datasets/H5Ex_D_Sofloat.java @@ -23,9 +23,9 @@ package examples.datasets; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; -import java.util.Locale; import java.util.EnumSet; import java.util.HashMap; +import java.util.Locale; import java.util.Map; import hdf.hdf5lib.H5; @@ -33,45 +33,46 @@ import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Sofloat { - private static String FILENAME = "H5Ex_D_Sofloat.h5"; + private static String FILENAME = "H5Ex_D_Sofloat.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkScaleoffsetFilter() { + private static boolean checkScaleoffsetFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); if (available == 0) { @@ -85,8 +86,8 @@ public class H5Ex_D_Sofloat { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("Scale-Offset filter not available for encoding and decoding."); return false; } @@ -97,20 +98,21 @@ public class H5Ex_D_Sofloat { return true; } - private static void writeData() { - 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 }; + private static void writeData() + { + 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]; // Initialize data. for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) { - double x = indx; - double y = jndx; + double x = indx; + double y = jndx; dset_data[indx][jndx] = (x + 1) / (y + 0.3) + y; } @@ -133,7 +135,7 @@ public class H5Ex_D_Sofloat { // Create a new file using the default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -164,7 +166,7 @@ public class H5Ex_D_Sofloat { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -173,8 +175,8 @@ public class H5Ex_D_Sofloat { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -215,10 +217,11 @@ public class H5Ex_D_Sofloat { } } - private static void readData() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readData() + { + 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. @@ -251,15 +254,15 @@ public class H5Ex_D_Sofloat { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -293,8 +296,8 @@ public class H5Ex_D_Sofloat { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -343,7 +346,8 @@ public class H5Ex_D_Sofloat { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if Scale-Offset compression is available and can be used // for both compression and decompression. Normally we do not diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java index dd7664f..3eb8e37 100644 --- a/java/examples/datasets/H5Ex_D_Soint.java +++ b/java/examples/datasets/H5Ex_D_Soint.java @@ -30,45 +30,46 @@ import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Soint { - private static String FILENAME = "H5Ex_D_Soint.h5"; + private static String FILENAME = "H5Ex_D_Soint.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkScaleoffsetFilter() { + private static boolean checkScaleoffsetFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); if (available == 0) { @@ -82,8 +83,8 @@ public class H5Ex_D_Soint { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("Scale-Offset filter not available for encoding and decoding."); return false; } @@ -94,13 +95,14 @@ public class H5Ex_D_Soint { return true; } - private static void writeData() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeData() + { + 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 }; + 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]; // Initialize data. @@ -111,7 +113,7 @@ public class H5Ex_D_Soint { // Create a new file using the default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -130,7 +132,8 @@ public class H5Ex_D_Soint { try { dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); if (dcpl_id >= 0) { - H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_INT, HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT); + H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_INT, + HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT); H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); } } @@ -142,7 +145,7 @@ public class H5Ex_D_Soint { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -151,8 +154,8 @@ public class H5Ex_D_Soint { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -193,10 +196,11 @@ public class H5Ex_D_Soint { } } - private static void readData() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readData() + { + 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. @@ -229,15 +233,15 @@ public class H5Ex_D_Soint { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -271,8 +275,8 @@ public class H5Ex_D_Soint { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -316,7 +320,8 @@ public class H5Ex_D_Soint { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if Scale-Offset compression is available and can be used // for both compression and decompression. Normally we do not @@ -328,5 +333,4 @@ public class H5Ex_D_Soint { H5Ex_D_Soint.readData(); } } - } diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java index 3fdc712..0426a87 100644 --- a/java/examples/datasets/H5Ex_D_Szip.java +++ b/java/examples/datasets/H5Ex_D_Szip.java @@ -29,45 +29,46 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Szip { - private static String FILENAME = "H5Ex_D_Szip.h5"; + private static String FILENAME = "H5Ex_D_Szip.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 32; - private static final int DIM_Y = 64; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 8; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkSzipFilter() { + private static boolean checkSzipFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); if (available == 0) { @@ -81,8 +82,8 @@ public class H5Ex_D_Szip { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("szip filter not available for encoding and decoding."); return false; } @@ -93,13 +94,14 @@ public class H5Ex_D_Szip { return true; } - private static void writeSzip() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeSzip() + { + 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 }; + 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]; // Initialize data. @@ -110,7 +112,7 @@ public class H5Ex_D_Szip { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -143,7 +145,7 @@ public class H5Ex_D_Szip { try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -152,8 +154,8 @@ public class H5Ex_D_Szip { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -194,10 +196,11 @@ public class H5Ex_D_Szip { } } - private static void readSzip() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void readSzip() + { + 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. @@ -231,15 +234,15 @@ public class H5Ex_D_Szip { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -273,8 +276,8 @@ public class H5Ex_D_Szip { // Read the data using the default properties. try { if (dataset_id >= 0) { - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } } catch (Exception e) { @@ -319,7 +322,8 @@ public class H5Ex_D_Szip { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if gzip compression is available and can be used for both // compression and decompression. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -330,5 +334,4 @@ public class H5Ex_D_Szip { H5Ex_D_Szip.readSzip(); } } - } diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java index 069e80b..16ab423 100644 --- a/java/examples/datasets/H5Ex_D_Transform.java +++ b/java/examples/datasets/H5Ex_D_Transform.java @@ -27,20 +27,21 @@ import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_Transform { - private static String FILE = "H5Ex_D_Transform.h5"; - private static String DATASET = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static String TRANSFORM = "x+1"; + private static String FILE = "H5Ex_D_Transform.h5"; + private static String DATASET = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static String TRANSFORM = "x+1"; private static String RTRANSFORM = "x-1"; - private static void writeData() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void writeData() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long dxpl_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM_X, DIM_Y }; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize data. @@ -60,7 +61,7 @@ public class H5Ex_D_Transform { // Create a new file using the default properties. try { file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -90,7 +91,8 @@ public class H5Ex_D_Transform { try { if ((file_id >= 0) && (filespace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASET, HDF5Constants.H5T_NATIVE_INT, filespace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -99,8 +101,8 @@ public class H5Ex_D_Transform { // Write the data to the dataset using the dataset transfer property list. try { if ((dataset_id >= 0) && (dxpl_id >= 0)) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - dxpl_id, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, dxpl_id, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -141,11 +143,12 @@ public class H5Ex_D_Transform { } } - private static void readData() { + private static void readData() + { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long dxpl_id = HDF5Constants.H5I_INVALID_HID; + 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. @@ -168,8 +171,8 @@ public class H5Ex_D_Transform { // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -197,8 +200,8 @@ public class H5Ex_D_Transform { // Read the data using the dataset transfer property list. try { if ((dataset_id >= 0) && (dxpl_id >= 0)) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - dxpl_id, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, dxpl_id, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -206,8 +209,8 @@ public class H5Ex_D_Transform { // Output the data to the screen. - System.out.println("Data as written with transform '" + TRANSFORM + "' and read with transform '" - + RTRANSFORM + "'"); + System.out.println("Data as written with transform '" + TRANSFORM + "' and read with transform '" + + RTRANSFORM + "'"); for (int i = 0; i < DIM_X; i++) { System.out.print(" ["); for (int j = 0; j < DIM_Y; j++) @@ -239,9 +242,9 @@ public class H5Ex_D_Transform { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_Transform.writeData(); H5Ex_D_Transform.readData(); } - } diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java index c82b2d6..4154cf3 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java @@ -26,25 +26,26 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_UnlimitedAdd { - private static String FILENAME = "H5Ex_D_UnlimitedAdd.h5"; + private static String FILENAME = "H5Ex_D_UnlimitedAdd.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int EDIM_X = 6; - private static final int EDIM_Y = 10; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; - - private static void writeUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() + { + long file_id = 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 }; + 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}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize the dataset. @@ -55,7 +56,7 @@ public class H5Ex_D_UnlimitedAdd { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -90,7 +91,7 @@ public class H5Ex_D_UnlimitedAdd { try { if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -99,8 +100,8 @@ public class H5Ex_D_UnlimitedAdd { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -141,14 +142,15 @@ public class H5Ex_D_UnlimitedAdd { } } - private static void extendUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void extendUnlimited() + { + 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 }; - long[] count = new long[2]; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; + long[] extdims = {EDIM_X, EDIM_Y}; + long[] start = {0, 0}; + long[] count = new long[2]; int[][] dset_data; int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; @@ -189,13 +191,13 @@ public class H5Ex_D_UnlimitedAdd { } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -257,7 +259,7 @@ public class H5Ex_D_UnlimitedAdd { // Write the data to the selected portion of the dataset. if (dataset_id >= 0) H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, - HDF5Constants.H5P_DEFAULT, extend_dset_data); + HDF5Constants.H5P_DEFAULT, extend_dset_data); } } catch (Exception e) { @@ -291,11 +293,12 @@ public class H5Ex_D_UnlimitedAdd { } } - private static void readUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readUnlimited() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data; // Open an existing file. @@ -332,13 +335,13 @@ public class H5Ex_D_UnlimitedAdd { e.printStackTrace(); } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -381,10 +384,10 @@ public class H5Ex_D_UnlimitedAdd { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_UnlimitedAdd.writeUnlimited(); H5Ex_D_UnlimitedAdd.extendUnlimited(); H5Ex_D_UnlimitedAdd.readUnlimited(); } - } diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java index 675b1ba..e084641 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java @@ -31,47 +31,48 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_UnlimitedGzip { - private static String FILENAME = "H5Ex_D_UnlimitedGzip.h5"; + private static String FILENAME = "H5Ex_D_UnlimitedGzip.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int EDIM_X = 6; - private static final int EDIM_Y = 10; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; // Values for the status of space allocation enum H5Z_filter { - H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( - HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( - HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( - HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( - HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), + H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), + H5Z_FILTER_DEFLATE(HDF5Constants.H5Z_FILTER_DEFLATE), + H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), + H5Z_FILTER_FLETCHER32(HDF5Constants.H5Z_FILTER_FLETCHER32), + H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), + H5Z_FILTER_NBIT(HDF5Constants.H5Z_FILTER_NBIT), + H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), + H5Z_FILTER_RESERVED(HDF5Constants.H5Z_FILTER_RESERVED), + H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); private static final Map<Integer, H5Z_filter> lookup = new HashMap<Integer, H5Z_filter>(); - static { + static + { for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) lookup.put(s.getCode(), s); } private int code; - H5Z_filter(int layout_type) { - this.code = layout_type; - } + H5Z_filter(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5Z_filter get(int code) { - return lookup.get(code); - } + public static H5Z_filter get(int code) { return lookup.get(code); } } - private static boolean checkGzipFilter() { + private static boolean checkGzipFilter() + { try { int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); if (available == 0) { @@ -85,8 +86,8 @@ public class H5Ex_D_UnlimitedGzip { try { int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) - || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) || + ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { System.out.println("gzip filter not available for encoding and decoding."); return false; } @@ -97,14 +98,15 @@ public class H5Ex_D_UnlimitedGzip { return true; } - private static void writeUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static void writeUnlimited() + { + 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 }; + 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}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize the dataset. @@ -115,7 +117,7 @@ public class H5Ex_D_UnlimitedGzip { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -147,7 +149,7 @@ public class H5Ex_D_UnlimitedGzip { try { if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -156,8 +158,8 @@ public class H5Ex_D_UnlimitedGzip { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -198,14 +200,15 @@ public class H5Ex_D_UnlimitedGzip { } } - private static void extendUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void extendUnlimited() + { + 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 }; - long[] count = new long[2]; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; + long[] extdims = {EDIM_X, EDIM_Y}; + long[] start = {0, 0}; + long[] count = new long[2]; int[][] dset_data; int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; @@ -246,13 +249,13 @@ public class H5Ex_D_UnlimitedGzip { } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -314,7 +317,7 @@ public class H5Ex_D_UnlimitedGzip { // Write the data to the selected portion of the dataset. if (dataset_id >= 0) H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, - HDF5Constants.H5P_DEFAULT, extend_dset_data); + HDF5Constants.H5P_DEFAULT, extend_dset_data); } } catch (Exception e) { @@ -348,12 +351,13 @@ public class H5Ex_D_UnlimitedGzip { } } - private static void readUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readUnlimited() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dcpl_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data; // Open an existing file. @@ -387,14 +391,14 @@ public class H5Ex_D_UnlimitedGzip { try { if (dcpl_id >= 0) { // Java lib requires a valid filter_name object and cd_values - int[] flags = { 0 }; - long[] cd_nelmts = { 1 }; - int[] cd_values = { 0 }; - String[] filter_name = { "" }; - int[] filter_config = { 0 }; - int filter_type = -1; - filter_type = H5 - .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + int[] flags = {0}; + long[] cd_nelmts = {1}; + int[] cd_values = {0}; + String[] filter_name = {""}; + int[] filter_config = {0}; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); System.out.print("Filter type is: "); switch (H5Z_filter.get(filter_type)) { case H5Z_FILTER_DEFLATE: @@ -436,13 +440,13 @@ public class H5Ex_D_UnlimitedGzip { e.printStackTrace(); } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -485,7 +489,8 @@ public class H5Ex_D_UnlimitedGzip { } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if gzip compression is available and can be used for both // compression and decompression. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -497,5 +502,4 @@ public class H5Ex_D_UnlimitedGzip { H5Ex_D_UnlimitedGzip.readUnlimited(); } } - } diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java index 0708898..ccabcdd 100644 --- a/java/examples/datasets/H5Ex_D_UnlimitedMod.java +++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java @@ -26,25 +26,26 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_D_UnlimitedMod { - private static String FILENAME = "H5Ex_D_UnlimitedMod.h5"; + private static String FILENAME = "H5Ex_D_UnlimitedMod.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int EDIM_X = 6; - private static final int EDIM_Y = 10; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; - - private static void writeUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dcpl_id = HDF5Constants.H5I_INVALID_HID; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() + { + long file_id = 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 }; + 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}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize the dataset. @@ -55,7 +56,7 @@ public class H5Ex_D_UnlimitedMod { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -90,7 +91,7 @@ public class H5Ex_D_UnlimitedMod { try { if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -99,8 +100,8 @@ public class H5Ex_D_UnlimitedMod { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -141,12 +142,13 @@ public class H5Ex_D_UnlimitedMod { } } - private static void extendUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void extendUnlimited() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; + long[] extdims = {EDIM_X, EDIM_Y}; int[][] dset_data; int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; @@ -187,13 +189,13 @@ public class H5Ex_D_UnlimitedMod { } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -244,7 +246,7 @@ public class H5Ex_D_UnlimitedMod { try { if ((dataspace_id >= 0) && (dataset_id >= 0)) H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, - HDF5Constants.H5P_DEFAULT, extend_dset_data); + HDF5Constants.H5P_DEFAULT, extend_dset_data); } catch (Exception e) { e.printStackTrace(); @@ -277,11 +279,12 @@ public class H5Ex_D_UnlimitedMod { } } - private static void readUnlimited() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void readUnlimited() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data; // Open an existing file. @@ -318,13 +321,13 @@ public class H5Ex_D_UnlimitedMod { e.printStackTrace(); } // Allocate array of pointers to rows. - dset_data = new int[(int) dims[0]][(int) dims[1]]; + dset_data = new int[(int)dims[0]][(int)dims[1]]; // Read the data using the default properties. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -367,10 +370,10 @@ public class H5Ex_D_UnlimitedMod { } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_D_UnlimitedMod.writeUnlimited(); H5Ex_D_UnlimitedMod.extendUnlimited(); H5Ex_D_UnlimitedMod.readUnlimited(); } - } diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt index 6997b2e..4512221 100644 --- a/java/examples/datatypes/CMakeLists.txt +++ b/java/examples/datatypes/CMakeLists.txt @@ -47,6 +47,13 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_${example}_SRC_FORMAT ${example}.java) + endif () endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java index 3939b38..4e9de2a 100644 --- a/java/examples/datatypes/H5Ex_T_Array.java +++ b/java/examples/datatypes/H5Ex_T_Array.java @@ -24,22 +24,23 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_Array { - private static String FILENAME = "H5Ex_T_Array.h5"; + private static String FILENAME = "H5Ex_T_Array.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int ADIM0 = 3; - private static final int ADIM1 = 5; - private static final int RANK = 1; - private static final int NDIMS = 2; - - private static void CreateDataset() { - long file_id = 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 }; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() + { + long file_id = 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]; // Initialize data. indx is the element in the dataspace, jndx and kndx the @@ -52,7 +53,7 @@ public class H5Ex_T_Array { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -86,8 +87,9 @@ public class H5Ex_T_Array { // Create the dataset. try { if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -97,7 +99,7 @@ public class H5Ex_T_Array { try { if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -147,16 +149,16 @@ public class H5Ex_T_Array { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long memtype_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0}; + long[] adims = {ADIM0, ADIM1}; int[][][] dset_data; // Open an existing file. @@ -196,7 +198,7 @@ public class H5Ex_T_Array { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + dset_data = new int[(int)dims[0]][(int)(adims[0])][(int)(adims[1])]; // Create array datatypes for memory. try { @@ -210,7 +212,7 @@ public class H5Ex_T_Array { try { if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -264,10 +266,10 @@ public class H5Ex_T_Array { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Array.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -275,5 +277,4 @@ public class H5Ex_T_Array { // data using malloc(). H5Ex_T_Array.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java index c4c4bc4..45b44c1 100644 --- a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java @@ -24,24 +24,25 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_ArrayAttribute { - private static String FILENAME = "H5Ex_T_ArrayAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_ArrayAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int ADIM0 = 3; - private static final int ADIM1 = 5; - private static final int RANK = 1; - private static final int NDIMS = 2; - - private static void CreateDataset() { - long file_id = 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 }; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() + { + long file_id = 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]; // Initialize data. indx is the element in the dataspace, jndx and kndx the @@ -54,7 +55,7 @@ public class H5Ex_T_ArrayAttribute { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -81,7 +82,8 @@ public class H5Ex_T_ArrayAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -103,7 +105,7 @@ public class H5Ex_T_ArrayAttribute { try { if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -170,17 +172,17 @@ public class H5Ex_T_ArrayAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - 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; + private static void ReadDataset() + { + 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 }; + long[] dims = {DIM0}; + long[] adims = {ADIM0, ADIM1}; int[][][] dset_data; // Open an existing file. @@ -203,7 +205,7 @@ public class H5Ex_T_ArrayAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -229,7 +231,7 @@ public class H5Ex_T_ArrayAttribute { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + dset_data = new int[(int)dims[0]][(int)(adims[0])][(int)(adims[1])]; // Create array datatypes for memory. try { @@ -304,10 +306,10 @@ public class H5Ex_T_ArrayAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_ArrayAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -315,5 +317,4 @@ public class H5Ex_T_ArrayAttribute { // data using malloc(). H5Ex_T_ArrayAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java index 45d4e8a..6d1a253 100644 --- a/java/examples/datatypes/H5Ex_T_Bit.java +++ b/java/examples/datatypes/H5Ex_T_Bit.java @@ -24,17 +24,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_Bit { - private static String FILENAME = "H5Ex_T_Bit.h5"; + private static String FILENAME = "H5Ex_T_Bit.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0, DIM1}; int[][] dset_data = new int[DIM0][DIM1]; // Initialize data. @@ -42,15 +43,15 @@ public class H5Ex_T_Bit { for (int jndx = 0; jndx < DIM1; jndx++) { dset_data[indx][jndx] = 0; dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ - dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ - dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ } // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -69,7 +70,8 @@ public class H5Ex_T_Bit { try { if ((file_id >= 0) && (dataspace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -78,8 +80,8 @@ public class H5Ex_T_Bit { // Write the bitfield data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -111,14 +113,14 @@ public class H5Ex_T_Bit { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0, DIM1}; int[][] dset_data; // Open an existing file. @@ -157,13 +159,13 @@ public class H5Ex_T_Bit { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (dims[1])]; + dset_data = new int[(int)dims[0]][(int)(dims[1])]; // Read data. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -209,10 +211,10 @@ public class H5Ex_T_Bit { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Bit.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -220,5 +222,4 @@ public class H5Ex_T_Bit { // data using malloc(). H5Ex_T_Bit.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java index 9b33ca5..3ad643a 100644 --- a/java/examples/datatypes/H5Ex_T_BitAttribute.java +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -24,19 +24,20 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_BitAttribute { - private static String FILENAME = "H5Ex_T_BitAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_BitAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data = new int[DIM0][DIM1]; // Initialize data. @@ -44,15 +45,15 @@ public class H5Ex_T_BitAttribute { for (int jndx = 0; jndx < DIM1; jndx++) { dset_data[indx][jndx] = 0; dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ - dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ - dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ } // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -63,7 +64,8 @@ public class H5Ex_T_BitAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -84,8 +86,9 @@ public class H5Ex_T_BitAttribute { // Create the attribute and write the array data to it. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -134,15 +137,15 @@ public class H5Ex_T_BitAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data; // Open an existing file. @@ -165,7 +168,7 @@ public class H5Ex_T_BitAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -190,7 +193,7 @@ public class H5Ex_T_BitAttribute { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (dims[1])]; + dset_data = new int[(int)dims[0]][(int)(dims[1])]; // Read data. try { @@ -249,10 +252,10 @@ public class H5Ex_T_BitAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_BitAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -260,5 +263,4 @@ public class H5Ex_T_BitAttribute { // data using malloc(). H5Ex_T_BitAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java index 62db5ea..44586ef 100644 --- a/java/examples/datatypes/H5Ex_T_Commit.java +++ b/java/examples/datatypes/H5Ex_T_Commit.java @@ -21,77 +21,74 @@ package examples.datatypes; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; - import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + public class H5Ex_T_Commit { - private static String FILENAME = "H5Ex_T_Commit.h5"; - private static String DATATYPENAME = "Sensor_Type"; - protected static final int INTEGERSIZE = 4; - protected static final int DOUBLESIZE = 8; + private static String FILENAME = "H5Ex_T_Commit.h5"; + private static String DATATYPENAME = "Sensor_Type"; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; protected final static int MAXSTRINGSIZE = 80; // Values for the various classes of datatypes enum H5T_class { - H5T_NO_CLASS(HDF5Constants.H5T_NO_CLASS), // error - H5T_INTEGER(HDF5Constants.H5T_INTEGER), // integer types - H5T_FLOAT(HDF5Constants.H5T_FLOAT), // floating-point types - H5T_TIME(HDF5Constants.H5T_TIME), // date and time types - H5T_STRING(HDF5Constants.H5T_STRING), // character string types - H5T_BITFIELD(HDF5Constants.H5T_BITFIELD), // bit field types - H5T_OPAQUE(HDF5Constants.H5T_OPAQUE), // opaque types - H5T_COMPOUND(HDF5Constants.H5T_COMPOUND), // compound types + H5T_NO_CLASS(HDF5Constants.H5T_NO_CLASS), // error + H5T_INTEGER(HDF5Constants.H5T_INTEGER), // integer types + H5T_FLOAT(HDF5Constants.H5T_FLOAT), // floating-point types + H5T_TIME(HDF5Constants.H5T_TIME), // date and time types + H5T_STRING(HDF5Constants.H5T_STRING), // character string types + H5T_BITFIELD(HDF5Constants.H5T_BITFIELD), // bit field types + H5T_OPAQUE(HDF5Constants.H5T_OPAQUE), // opaque types + H5T_COMPOUND(HDF5Constants.H5T_COMPOUND), // compound types H5T_REFERENCE(HDF5Constants.H5T_REFERENCE), // reference types - H5T_ENUM(HDF5Constants.H5T_ENUM), // enumeration types - H5T_VLEN(HDF5Constants.H5T_VLEN), // Variable-Length types - H5T_ARRAY(HDF5Constants.H5T_ARRAY), // Array types - H5T_NCLASSES(11); // this must be last + H5T_ENUM(HDF5Constants.H5T_ENUM), // enumeration types + H5T_VLEN(HDF5Constants.H5T_VLEN), // Variable-Length types + H5T_ARRAY(HDF5Constants.H5T_ARRAY), // Array types + H5T_NCLASSES(11); // this must be last private static final Map<Long, H5T_class> lookup = new HashMap<Long, H5T_class>(); - static { + static + { for (H5T_class s : EnumSet.allOf(H5T_class.class)) lookup.put(s.getCode(), s); } private long code; - H5T_class(long layout_type) { - this.code = layout_type; - } + H5T_class(long layout_type) { this.code = layout_type; } - public long getCode() { - return this.code; - } + public long getCode() { return this.code; } - public static H5T_class get(long typeclass_id) { - return lookup.get(typeclass_id); - } + public static H5T_class get(long typeclass_id) { return lookup.get(typeclass_id); } } // The supporting Sensor_Datatype class. private static class Sensor_Datatype { static int numberMembers = 4; - static int[] memberDims = { 1, 1, 1, 1 }; + static int[] memberDims = {1, 1, 1, 1}; - String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; - long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, HDF5Constants.H5T_IEEE_F64BE, - HDF5Constants.H5T_IEEE_F64BE }; - static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + String[] memberNames = {"Serial number", "Location", "Temperature (F)", "Pressure (inHg)"}; + long[] memberFileTypes = {HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE}; + static int[] memberStorage = {INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE}; // Data size is the storage size for the members not the object. - static long getDataSize() { + static long getDataSize() + { long data_size = 0; for (int indx = 0; indx < numberMembers; indx++) data_size += memberStorage[indx] * memberDims[indx]; return data_size; } - static int getOffset(int memberItem) { + static int getOffset(int memberItem) + { int data_offset = 0; for (int indx = 0; indx < memberItem; indx++) data_offset += memberStorage[indx]; @@ -99,15 +96,16 @@ public class H5Ex_T_Commit { } } - private static void CreateDataType() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long strtype_id = HDF5Constants.H5I_INVALID_HID; - long filetype_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataType() + { + 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 { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -134,7 +132,8 @@ public class H5Ex_T_Commit { long type_id = datatypes.memberFileTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(filetype_id, datatypes.memberNames[indx], Sensor_Datatype.getOffset(indx), type_id); + H5.H5Tinsert(filetype_id, datatypes.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); } } } @@ -145,8 +144,8 @@ public class H5Ex_T_Commit { // Commit the compound datatype to the file, creating a named datatype. try { if ((file_id >= 0) && (filetype_id >= 0)) - H5.H5Tcommit(file_id, DATATYPENAME, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + H5.H5Tcommit(file_id, DATATYPENAME, filetype_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -178,13 +177,13 @@ public class H5Ex_T_Commit { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataType() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataType() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long typeclass_id = HDF5Constants.H5I_INVALID_HID; - long filetype_id = HDF5Constants.H5I_INVALID_HID; + long filetype_id = HDF5Constants.H5I_INVALID_HID; // Open an existing file. try { @@ -247,10 +246,10 @@ public class H5Ex_T_Commit { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Commit.CreateDataType(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -258,5 +257,4 @@ public class H5Ex_T_Commit { // data using malloc(). H5Ex_T_Commit.ReadDataType(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java index 8c83ebb..a78d0e3 100644 --- a/java/examples/datatypes/H5Ex_T_Compound.java +++ b/java/examples/datatypes/H5Ex_T_Compound.java @@ -20,49 +20,52 @@ package examples.datatypes; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; - import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + public class H5Ex_T_Compound { - private static String FILENAME = "H5Ex_T_Compound.h5"; - private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int RANK = 1; - protected static final int INTEGERSIZE = 4; - protected static final int DOUBLESIZE = 8; + private static String FILENAME = "H5Ex_T_Compound.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; protected final static int MAXSTRINGSIZE = 80; static class Sensor_Datatype { static int numberMembers = 4; - static int[] memberDims = { 1, 1, 1, 1 }; + static int[] memberDims = {1, 1, 1, 1}; - static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; - static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, - HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; - static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, - HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; - static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + static String[] memberNames = {"Serial number", "Location", "Temperature (F)", "Pressure (inHg)"}; + static long[] memberMemTypes = {HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE}; + static long[] memberFileTypes = {HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE}; + static int[] memberStorage = {INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE}; // Data size is the storage size for the members. - static long getTotalDataSize() { + static long getTotalDataSize() + { long data_size = 0; for (int indx = 0; indx < numberMembers; indx++) data_size += memberStorage[indx] * memberDims[indx]; return DIM0 * data_size; } - static long getDataSize() { + static long getDataSize() + { long data_size = 0; for (int indx = 0; indx < numberMembers; indx++) data_size += memberStorage[indx] * memberDims[indx]; return data_size; } - static int getOffset(int memberItem) { + static int getOffset(int memberItem) + { int data_offset = 0; for (int indx = 0; indx < memberItem; indx++) data_offset += memberStorage[indx]; @@ -76,60 +79,63 @@ public class H5Ex_T_Compound { public double temperature; public double pressure; - Sensor(int serial_no, String location, double temperature, double pressure) { - this.serial_no = serial_no; - this.location = location; + Sensor(int serial_no, String location, double temperature, double pressure) + { + this.serial_no = serial_no; + this.location = location; this.temperature = temperature; - this.pressure = pressure; + this.pressure = pressure; } - Sensor(ByteBuffer databuf, int dbposition) { - readBuffer(databuf, dbposition); - } + Sensor(ByteBuffer databuf, int dbposition) { readBuffer(databuf, dbposition); } - void writeBuffer(ByteBuffer databuf, int dbposition) { + void writeBuffer(ByteBuffer databuf, int dbposition) + { databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); - int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; for (int ndx = 0; ndx < arraylen; ndx++) databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) - databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte)0); databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); } - void readBuffer(ByteBuffer databuf, int dbposition) { - this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + void readBuffer(ByteBuffer databuf, int dbposition) + { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); ByteBuffer stringbuf = databuf.duplicate(); stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); byte[] bytearr = new byte[stringbuf.remaining()]; stringbuf.get(bytearr); - this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); - this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); } @Override - public String toString() { - return String.format("Serial number : " + serial_no + "%n" + - "Location : " + location + "%n" + - "Temperature (F) : " + temperature + "%n" + - "Pressure (inHg) : " + pressure + "%n"); + public String toString() + { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); } } - private static void CreateDataset() { - long file_id = 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 }; + private static void CreateDataset() + { + 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; + byte[] dset_data = null; // Initialize data. object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); @@ -140,7 +146,7 @@ public class H5Ex_T_Compound { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -164,8 +170,8 @@ public class H5Ex_T_Compound { long type_id = Sensor_Datatype.memberMemTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -184,8 +190,8 @@ public class H5Ex_T_Compound { long type_id = Sensor_Datatype.memberFileTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -205,8 +211,9 @@ public class H5Ex_T_Compound { // Create the dataset. try { if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -214,16 +221,16 @@ public class H5Ex_T_Compound { // Write the compound data to the dataset. // allocate memory for read buffer. - dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; ByteBuffer outBuf = ByteBuffer.wrap(dset_data); outBuf.order(ByteOrder.nativeOrder()); - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); } try { if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -281,16 +288,16 @@ public class H5Ex_T_Compound { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long strtype_id = HDF5Constants.H5I_INVALID_HID; - long memtype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0}; Sensor[] object_data2; byte[] dset_data; @@ -346,8 +353,8 @@ public class H5Ex_T_Compound { long type_id = Sensor_Datatype.memberMemTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -356,19 +363,19 @@ public class H5Ex_T_Compound { } // allocate memory for read buffer. - dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; - object_data2 = new Sensor[(int) dims[0]]; + object_data2 = new Sensor[(int)dims[0]]; // Read data. try { if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); ByteBuffer inBuf = ByteBuffer.wrap(dset_data); inBuf.order(ByteOrder.nativeOrder()); - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); } } @@ -425,10 +432,10 @@ public class H5Ex_T_Compound { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Compound.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -436,5 +443,4 @@ public class H5Ex_T_Compound { // data using malloc(). H5Ex_T_Compound.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java index 58d2fb7..f331a1e 100644 --- a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java +++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java @@ -20,52 +20,55 @@ package examples.datatypes; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; - import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.charset.Charset; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + public class H5Ex_T_CompoundAttribute { - private static String FILENAME = "H5Ex_T_CompoundAttribute.h5"; - private static String DATASETNAME = "DS1"; - private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int RANK = 1; - protected static final int INTEGERSIZE = 4; - protected static final int DOUBLESIZE = 8; + private static String FILENAME = "H5Ex_T_CompoundAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; protected final static int MAXSTRINGSIZE = 80; // Using Java Externalization will add a two-byte object header in // the stream, which needs to be called out in the datatypes. static class Sensor_Datatype { static int numberMembers = 4; - static int[] memberDims = { 1, 1, 1, 1 }; + static int[] memberDims = {1, 1, 1, 1}; - static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; - static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, - HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; - static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, - HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; - static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + static String[] memberNames = {"Serial number", "Location", "Temperature (F)", "Pressure (inHg)"}; + static long[] memberMemTypes = {HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE}; + static long[] memberFileTypes = {HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE}; + static int[] memberStorage = {INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE}; // Data size is the storage size for the members not the object. - static long getTotalDataSize() { + static long getTotalDataSize() + { long data_size = 0; for (int indx = 0; indx < numberMembers; indx++) data_size += memberStorage[indx] * memberDims[indx]; return DIM0 * data_size; } - static long getDataSize() { + static long getDataSize() + { long data_size = 0; for (int indx = 0; indx < numberMembers; indx++) data_size += memberStorage[indx] * memberDims[indx]; return data_size; } - static int getOffset(int memberItem) { + static int getOffset(int memberItem) + { int data_offset = 0; for (int indx = 0; indx < memberItem; indx++) data_offset += memberStorage[indx]; @@ -79,61 +82,64 @@ public class H5Ex_T_CompoundAttribute { public double temperature; public double pressure; - Sensor(int serial_no, String location, double temperature, double pressure) { - this.serial_no = serial_no; - this.location = location; + Sensor(int serial_no, String location, double temperature, double pressure) + { + this.serial_no = serial_no; + this.location = location; this.temperature = temperature; - this.pressure = pressure; + this.pressure = pressure; } - Sensor(ByteBuffer databuf, int dbposition) { - readBuffer(databuf, dbposition); - } + Sensor(ByteBuffer databuf, int dbposition) { readBuffer(databuf, dbposition); } - void writeBuffer(ByteBuffer databuf, int dbposition) { + void writeBuffer(ByteBuffer databuf, int dbposition) + { databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); - int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; for (int ndx = 0; ndx < arraylen; ndx++) databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) - databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte)0); databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); } - void readBuffer(ByteBuffer databuf, int dbposition) { - this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + void readBuffer(ByteBuffer databuf, int dbposition) + { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); ByteBuffer stringbuf = databuf.duplicate(); stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); byte[] bytearr = new byte[stringbuf.remaining()]; stringbuf.get(bytearr); - this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); - this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); } @Override - public String toString() { - return String.format("Serial number : " + serial_no + "%n" + - "Location : " + location + "%n" + - "Temperature (F) : " + temperature + "%n" + - "Pressure (inHg) : " + pressure + "%n"); + public String toString() + { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); } } - private static void CreateDataset() { - long file_id = 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 }; + private static void CreateDataset() + { + 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; + byte[] dset_data = null; // Initialize data. object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); @@ -144,7 +150,7 @@ public class H5Ex_T_CompoundAttribute { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -168,8 +174,8 @@ public class H5Ex_T_CompoundAttribute { long type_id = Sensor_Datatype.memberMemTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -188,8 +194,8 @@ public class H5Ex_T_CompoundAttribute { long type_id = Sensor_Datatype.memberFileTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -202,7 +208,8 @@ public class H5Ex_T_CompoundAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -224,17 +231,17 @@ public class H5Ex_T_CompoundAttribute { try { if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } // Write the compound data. - dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; ByteBuffer outBuf = ByteBuffer.wrap(dset_data); outBuf.order(ByteOrder.nativeOrder()); - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); } try { @@ -305,17 +312,17 @@ public class H5Ex_T_CompoundAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long strtype_id = HDF5Constants.H5I_INVALID_HID; - long memtype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0 }; + long[] dims = {DIM0}; Sensor[] object_data2; byte[] dset_data; @@ -339,7 +346,7 @@ public class H5Ex_T_CompoundAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -382,8 +389,8 @@ public class H5Ex_T_CompoundAttribute { long type_id = Sensor_Datatype.memberMemTypes[indx]; if (type_id == HDF5Constants.H5T_C_S1) type_id = strtype_id; - H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), - type_id); + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], + Sensor_Datatype.getOffset(indx), type_id); } } } @@ -392,9 +399,9 @@ public class H5Ex_T_CompoundAttribute { } // allocate memory for read buffer. - dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; - object_data2 = new Sensor[(int) dims[0]]; + object_data2 = new Sensor[(int)dims[0]]; // Read data. try { @@ -403,7 +410,7 @@ public class H5Ex_T_CompoundAttribute { ByteBuffer inBuf = ByteBuffer.wrap(dset_data); inBuf.order(ByteOrder.nativeOrder()); - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); } } @@ -468,10 +475,10 @@ public class H5Ex_T_CompoundAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_CompoundAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -479,5 +486,4 @@ public class H5Ex_T_CompoundAttribute { // data using malloc(). H5Ex_T_CompoundAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java index e8da7f6..9ca099e 100644 --- a/java/examples/datatypes/H5Ex_T_Float.java +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -28,17 +28,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_Float { - private static String FILENAME = "H5Ex_T_Float.h5"; + private static String FILENAME = "H5Ex_T_Float.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; - - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() + { + long file_id = 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]; // Initialize data. @@ -50,7 +51,7 @@ public class H5Ex_T_Float { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -73,7 +74,8 @@ public class H5Ex_T_Float { try { if ((file_id >= 0) && (dataspace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -82,8 +84,8 @@ public class H5Ex_T_Float { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -115,14 +117,14 @@ public class H5Ex_T_Float { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0, DIM1}; double[][] dset_data; // Open an existing file. @@ -161,13 +163,13 @@ public class H5Ex_T_Float { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new double[(int) dims[0]][(int) (dims[1])]; + dset_data = new double[(int)dims[0]][(int)(dims[1])]; // Read data. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -211,10 +213,10 @@ public class H5Ex_T_Float { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Float.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -222,5 +224,4 @@ public class H5Ex_T_Float { // data using malloc(). H5Ex_T_Float.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java index eb8e1f8..426c4dd 100644 --- a/java/examples/datatypes/H5Ex_T_FloatAttribute.java +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -28,19 +28,20 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_FloatAttribute { - private static String FILENAME = "H5Ex_T_FloatAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_FloatAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; - - private static void CreateDataset() { - long file_id = 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 }; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() + { + long file_id = 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]; // Initialize data. @@ -52,7 +53,7 @@ public class H5Ex_T_FloatAttribute { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -63,7 +64,8 @@ public class H5Ex_T_FloatAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -84,8 +86,9 @@ public class H5Ex_T_FloatAttribute { // Create the attribute and write the array data to it. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -134,15 +137,15 @@ public class H5Ex_T_FloatAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; double[][] dset_data; // Open an existing file. @@ -165,7 +168,7 @@ public class H5Ex_T_FloatAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -190,7 +193,7 @@ public class H5Ex_T_FloatAttribute { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new double[(int) dims[0]][(int) (dims[1])]; + dset_data = new double[(int)dims[0]][(int)(dims[1])]; // Read data. try { @@ -247,10 +250,10 @@ public class H5Ex_T_FloatAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_FloatAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -258,5 +261,4 @@ public class H5Ex_T_FloatAttribute { // data using malloc(). H5Ex_T_FloatAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java index bb8e0cb..919ea7e 100644 --- a/java/examples/datatypes/H5Ex_T_Integer.java +++ b/java/examples/datatypes/H5Ex_T_Integer.java @@ -26,17 +26,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_Integer { - private static String FILENAME = "H5Ex_T_Integer.h5"; + private static String FILENAME = "H5Ex_T_Integer.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0, DIM1}; int[][] dset_data = new int[DIM0][DIM1]; // Initialize data. @@ -48,7 +49,7 @@ public class H5Ex_T_Integer { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -70,7 +71,8 @@ public class H5Ex_T_Integer { try { if ((file_id >= 0) && (dataspace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -79,8 +81,8 @@ public class H5Ex_T_Integer { // Write the data to the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -112,14 +114,14 @@ public class H5Ex_T_Integer { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0, DIM1}; int[][] dset_data; // Open an existing file. @@ -158,13 +160,13 @@ public class H5Ex_T_Integer { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (dims[1])]; + dset_data = new int[(int)dims[0]][(int)(dims[1])]; // Read data. try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -208,10 +210,10 @@ public class H5Ex_T_Integer { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Integer.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -219,5 +221,4 @@ public class H5Ex_T_Integer { // data using malloc(). H5Ex_T_Integer.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java index b0df5e4..4ec98c4 100644 --- a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java +++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java @@ -26,19 +26,20 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_IntegerAttribute { - private static String FILENAME = "H5Ex_T_IntegerAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_IntegerAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int DIM1 = 7; - private static final int RANK = 2; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data = new int[DIM0][DIM1]; // Initialize data. @@ -50,7 +51,7 @@ public class H5Ex_T_IntegerAttribute { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -61,7 +62,8 @@ public class H5Ex_T_IntegerAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -82,8 +84,9 @@ public class H5Ex_T_IntegerAttribute { // Create the attribute and write the array data to it. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -132,15 +135,15 @@ public class H5Ex_T_IntegerAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0, DIM1 }; + long[] dims = {DIM0, DIM1}; int[][] dset_data; // Open an existing file. @@ -163,7 +166,7 @@ public class H5Ex_T_IntegerAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -188,7 +191,7 @@ public class H5Ex_T_IntegerAttribute { // Allocate array of pointers to two-dimensional arrays (the // elements of the dataset. - dset_data = new int[(int) dims[0]][(int) (dims[1])]; + dset_data = new int[(int)dims[0]][(int)(dims[1])]; // Read data. try { @@ -245,10 +248,10 @@ public class H5Ex_T_IntegerAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_IntegerAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -256,5 +259,4 @@ public class H5Ex_T_IntegerAttribute { // data using malloc(). H5Ex_T_IntegerAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java index b0f98de..9220d8f 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReference.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java @@ -28,54 +28,50 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_ObjectReference { - private static String FILENAME = "H5Ex_T_ObjectReference.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_ObjectReference.h5"; + private static String DATASETNAME = "DS1"; private static String DATASETNAME2 = "DS2"; - private static String GROUPNAME = "G1"; - private static final int DIM0 = 2; - private static final int RANK = 1; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; // Values for the status of space allocation enum H5G_obj { - H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ - H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ - H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ private static final Map<Integer, H5G_obj> lookup = new HashMap<Integer, H5G_obj>(); - static { + static + { for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) lookup.put(s.getCode(), s); } private int code; - H5G_obj(int layout_type) { - this.code = layout_type; - } + H5G_obj(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5G_obj get(int code) { - return lookup.get(code); - } + public static H5G_obj get(int code) { return lookup.get(code); } } - private static void writeObjRef() { - 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 }; + private static void writeObjRef() + { + 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][HDF5Constants.H5R_REF_BUF_SIZE]; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -86,7 +82,8 @@ public class H5Ex_T_ObjectReference { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if ((file_id >= 0) && (dataspace_id >= 0)) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); dataset_id = HDF5Constants.H5I_INVALID_HID; @@ -101,8 +98,8 @@ public class H5Ex_T_ObjectReference { // Create a group in the file. try { if (file_id >= 0) - group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); group_id = HDF5Constants.H5I_INVALID_HID; @@ -119,7 +116,7 @@ public class H5Ex_T_ObjectReference { catch (Throwable err) { err.printStackTrace(); } - + try { dset_data[1] = H5.H5Rcreate_object(file_id, DATASETNAME2, HDF5Constants.H5P_DEFAULT); } @@ -127,7 +124,7 @@ public class H5Ex_T_ObjectReference { err.printStackTrace(); } } - + // Create dataspace. Setting maximum size to NULL sets the maximum // size to be the current size. try { @@ -136,22 +133,23 @@ public class H5Ex_T_ObjectReference { catch (Exception e) { e.printStackTrace(); } - + // Create the dataset. try { if ((file_id >= 0) && (filespace_id >= 0)) dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_REF, filespace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } - + // Write the object references to it. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -161,8 +159,16 @@ public class H5Ex_T_ObjectReference { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {} - try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(dset_data[1]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(dset_data[0]); + } + catch (Exception ex) { + } } // End access to the dataset and release resources used by it. @@ -193,13 +199,14 @@ public class H5Ex_T_ObjectReference { } } - private static void readObjRef() { - 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 = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0 }; + private static void readObjRef() + { + 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 = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0}; byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE]; // Open an existing file. @@ -209,23 +216,24 @@ public class H5Ex_T_ObjectReference { // Open an existing dataset. try { dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); - + try { // Get dataspace and allocate memory for read buffer. dataspace_id = H5.H5Dget_space(dataset_id); H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); - + // Read data. - H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); - + H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Output the data to the screen. for (int indx = 0; indx < dims[0]; indx++) { System.out.println(DATASETNAME + "[" + indx + "]:"); System.out.print(" ->"); // Open the referenced object, get its name and type. try { - object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { object_type = H5.H5Rget_obj_type3(dset_data[indx], HDF5Constants.H5R_OBJECT); String obj_name = null; @@ -255,14 +263,22 @@ public class H5Ex_T_ObjectReference { e.printStackTrace(); } finally { - try {H5.H5Oclose(object_id);} catch (Exception e) {} + try { + H5.H5Oclose(object_id); + } + catch (Exception e) { + } } } catch (Exception e4) { e4.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[indx]);} catch (Exception e4) {} + try { + H5.H5Rdestroy(dset_data[indx]); + } + catch (Exception e4) { + } } } // end for } @@ -270,25 +286,38 @@ public class H5Ex_T_ObjectReference { e3.printStackTrace(); } finally { - try {H5.H5Sclose(dataspace_id);} catch (Exception e3) {} + try { + H5.H5Sclose(dataspace_id); + } + catch (Exception e3) { + } } } catch (Exception e2) { e2.printStackTrace(); } finally { - try {H5.H5Dclose(dataset_id);} catch (Exception e2) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception e2) { + } } } catch (Exception e1) { e1.printStackTrace(); } finally { - try {H5.H5Fclose(file_id);} catch (Exception e1) {} + try { + H5.H5Fclose(file_id); + } + catch (Exception e1) { + } } } - public static void main(String[] args) { + public static void main(String[] args) + { // Check if gzip compression is available and can be used for both // compression and decompression. Normally we do not perform error // checking in these examples for the sake of clarity, but in this @@ -297,5 +326,4 @@ public class H5Ex_T_ObjectReference { H5Ex_T_ObjectReference.writeObjRef(); H5Ex_T_ObjectReference.readObjRef(); } - } diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java index f61ae0d..be84e51 100644 --- a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java +++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java @@ -28,55 +28,51 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_ObjectReferenceAttribute { - private static String FILENAME = "H5Ex_T_ObjectReferenceAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_ObjectReferenceAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static String DATASETNAME2 = "DS2"; - private static String GROUPNAME = "G1"; - private static final int DIM0 = 2; - private static final int RANK = 1; + private static String DATASETNAME2 = "DS2"; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; // Values for the status of space allocation enum H5G_obj { - H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ - H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ - H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ private static final Map<Integer, H5G_obj> lookup = new HashMap<Integer, H5G_obj>(); - static { + static + { for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) lookup.put(s.getCode(), s); } private int code; - H5G_obj(int layout_type) { - this.code = layout_type; - } + H5G_obj(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5G_obj get(int code) { - return lookup.get(code); - } + public static H5G_obj get(int code) { return lookup.get(code); } } - private static void CreateDataset() { - 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 }; + private static void CreateDataset() + { + 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][HDF5Constants.H5R_REF_BUF_SIZE]; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -87,7 +83,8 @@ public class H5Ex_T_ObjectReferenceAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if ((file_id >= 0) && (dataspace_id >= 0)) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); if (dataset_id >= 0) H5.H5Dclose(dataset_id); dataset_id = HDF5Constants.H5I_INVALID_HID; @@ -102,8 +99,8 @@ public class H5Ex_T_ObjectReferenceAttribute { // Create a group in the file. try { if (file_id >= 0) - group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (group_id >= 0) H5.H5Gclose(group_id); group_id = HDF5Constants.H5I_INVALID_HID; @@ -120,7 +117,7 @@ public class H5Ex_T_ObjectReferenceAttribute { catch (Throwable err) { err.printStackTrace(); } - + try { dset_data[1] = H5.H5Rcreate_object(file_id, DATASETNAME2, HDF5Constants.H5P_DEFAULT); } @@ -135,7 +132,8 @@ public class H5Ex_T_ObjectReferenceAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -143,7 +141,7 @@ public class H5Ex_T_ObjectReferenceAttribute { catch (Exception e) { e.printStackTrace(); } - + // Create dataspace. Setting maximum size to NULL sets the maximum // size to be the current size. try { @@ -152,17 +150,18 @@ public class H5Ex_T_ObjectReferenceAttribute { catch (Exception e) { e.printStackTrace(); } - + // Create the attribute and write the array data to it. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } - + // Write the dataset. try { if (attribute_id >= 0) @@ -176,8 +175,16 @@ public class H5Ex_T_ObjectReferenceAttribute { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {} - try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(dset_data[1]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(dset_data[0]); + } + catch (Exception ex) { + } } // End access to the dataset and release resources used by it. @@ -215,14 +222,15 @@ public class H5Ex_T_ObjectReferenceAttribute { } } - private static void ReadDataset() { - 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 = HDF5Constants.H5I_INVALID_HID; - long[] dims = { DIM0 }; + private static void ReadDataset() + { + 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 = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0}; byte[][] dset_data = new byte[DIM0][HDF5Constants.H5R_REF_BUF_SIZE]; // Open an existing file. @@ -232,28 +240,30 @@ public class H5Ex_T_ObjectReferenceAttribute { // Open an existing dataset. try { dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); - + try { - attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); - + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Get dataspace and allocate memory for read buffer. try { dataspace_id = H5.H5Aget_space(attribute_id); H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); - + // Read data. H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF, dset_data); - + // Output the data to the screen. for (int indx = 0; indx < dims[0]; indx++) { System.out.println(ATTRIBUTENAME + "[" + indx + "]:"); System.out.print(" ->"); // Open the referenced object, get its name and type. try { - object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + object_id = H5.H5Ropen_object(dset_data[indx], HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { - object_type = H5.H5Rget_obj_type3(dset_data[indx], HDF5Constants.H5R_OBJECT); + object_type = + H5.H5Rget_obj_type3(dset_data[indx], HDF5Constants.H5R_OBJECT); String obj_name = null; if (object_type >= 0) { // Get the name. @@ -281,14 +291,22 @@ public class H5Ex_T_ObjectReferenceAttribute { e.printStackTrace(); } finally { - try {H5.H5Oclose(object_id);} catch (Exception e) {} + try { + H5.H5Oclose(object_id); + } + catch (Exception e) { + } } } catch (Exception e5) { e5.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[indx]);} catch (Exception e5) {} + try { + H5.H5Rdestroy(dset_data[indx]); + } + catch (Exception e5) { + } } } // end for } @@ -296,32 +314,49 @@ public class H5Ex_T_ObjectReferenceAttribute { e4.printStackTrace(); } finally { - try {H5.H5Sclose(dataspace_id);} catch (Exception e3) {} + try { + H5.H5Sclose(dataspace_id); + } + catch (Exception e3) { + } } } catch (Exception e3) { e3.printStackTrace(); } finally { - try {H5.H5Aclose(attribute_id);} catch (Exception e4) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception e4) { + } } } catch (Exception e2) { e2.printStackTrace(); } finally { - try {H5.H5Dclose(dataset_id);} catch (Exception e2) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception e2) { + } } } catch (Exception e1) { e1.printStackTrace(); } finally { - try {H5.H5Fclose(file_id);} catch (Exception e1) {} + try { + H5.H5Fclose(file_id); + } + catch (Exception e1) { + } } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_ObjectReferenceAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -329,5 +364,4 @@ public class H5Ex_T_ObjectReferenceAttribute { // data using malloc(). H5Ex_T_ObjectReferenceAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java index e851fb2..419a5c8 100644 --- a/java/examples/datatypes/H5Ex_T_Opaque.java +++ b/java/examples/datatypes/H5Ex_T_Opaque.java @@ -24,32 +24,33 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_Opaque { - private static String FILENAME = "H5Ex_T_Opaque.h5"; + private static String FILENAME = "H5Ex_T_Opaque.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int LEN = 7; - private static final int RANK = 1; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + 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' }; + 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'}; // Initialize data. for (int indx = 0; indx < DIM0; indx++) { for (int jndx = 0; jndx < LEN - 1; jndx++) dset_data[jndx + indx * LEN] = str_data[jndx]; - dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + dset_data[LEN - 1 + indx * LEN] = (byte)(indx + '0'); } // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -82,8 +83,9 @@ public class H5Ex_T_Opaque { // automatically converts between different integer types. try { if ((file_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, datatype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, datatype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -93,7 +95,7 @@ public class H5Ex_T_Opaque { try { if ((dataset_id >= 0) && (datatype_id >= 0)) H5.H5Dwrite(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -133,16 +135,16 @@ public class H5Ex_T_Opaque { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long datatype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long type_len = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM0}; byte[] dset_data; String tag_name = null; @@ -194,13 +196,13 @@ public class H5Ex_T_Opaque { } // Allocate buffer. - dset_data = new byte[(int) (dims[0] * type_len)]; + dset_data = new byte[(int)(dims[0] * type_len)]; // Read data. try { if ((dataset_id >= 0) && (datatype_id >= 0)) H5.H5Dread(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -211,7 +213,7 @@ public class H5Ex_T_Opaque { for (int indx = 0; indx < dims[0]; indx++) { System.out.print(DATASETNAME + "[" + indx + "]: "); for (int jndx = 0; jndx < type_len; jndx++) { - char temp = (char) dset_data[jndx + indx * (int)type_len]; + char temp = (char)dset_data[jndx + indx * (int)type_len]; System.out.print(temp); } System.out.println(""); @@ -252,10 +254,10 @@ public class H5Ex_T_Opaque { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_Opaque.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -263,5 +265,4 @@ public class H5Ex_T_Opaque { // data using malloc(). H5Ex_T_Opaque.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java index 3e16ab4..b8a15a6 100644 --- a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java +++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java @@ -24,34 +24,35 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_OpaqueAttribute { - private static String FILENAME = "H5Ex_T_OpaqueAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_OpaqueAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int LEN = 7; - private static final int RANK = 1; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + 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 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' }; + long[] dims = {DIM0}; + byte[] dset_data = new byte[DIM0 * LEN]; + byte[] str_data = {'O', 'P', 'A', 'Q', 'U', 'E'}; // Initialize data. for (int indx = 0; indx < DIM0; indx++) { for (int jndx = 0; jndx < LEN - 1; jndx++) dset_data[jndx + indx * LEN] = str_data[jndx]; - dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + dset_data[LEN - 1 + indx * LEN] = (byte)(indx + '0'); } // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -62,7 +63,8 @@ public class H5Ex_T_OpaqueAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -96,7 +98,7 @@ public class H5Ex_T_OpaqueAttribute { try { if ((dataset_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, datatype_id, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -153,17 +155,17 @@ public class H5Ex_T_OpaqueAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long datatype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long type_len = -1; - long[] dims = { DIM0 }; + long type_len = -1; + long[] dims = {DIM0}; byte[] dset_data; String tag_name = null; @@ -187,7 +189,7 @@ public class H5Ex_T_OpaqueAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -224,7 +226,7 @@ public class H5Ex_T_OpaqueAttribute { } // Allocate buffer. - dset_data = new byte[(int) (dims[0] * type_len)]; + dset_data = new byte[(int)(dims[0] * type_len)]; // Read data. try { @@ -240,7 +242,7 @@ public class H5Ex_T_OpaqueAttribute { for (int indx = 0; indx < dims[0]; indx++) { System.out.print(ATTRIBUTENAME + "[" + indx + "]: "); for (int jndx = 0; jndx < type_len; jndx++) { - char temp = (char) dset_data[jndx + indx * (int)type_len]; + char temp = (char)dset_data[jndx + indx * (int)type_len]; System.out.print(temp); } System.out.println(""); @@ -289,10 +291,10 @@ public class H5Ex_T_OpaqueAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_OpaqueAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -300,5 +302,4 @@ public class H5Ex_T_OpaqueAttribute { // data using malloc(). H5Ex_T_OpaqueAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java index e497bd8..a69a70b 100644 --- a/java/examples/datatypes/H5Ex_T_String.java +++ b/java/examples/datatypes/H5Ex_T_String.java @@ -24,27 +24,28 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_String { - private static String FILENAME = "H5Ex_T_String.h5"; + private static String FILENAME = "H5Ex_T_String.h5"; private static String DATASETNAME = "DS1"; - private static final int DIM0 = 4; - private static final int SDIM = 8; - private static final int RANK = 1; - - private static void CreateDataset() { - long file_id = 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"), - new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() + { + long file_id = 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"), + new StringBuffer("sweet"), new StringBuffer("sorrow.")}; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -82,8 +83,9 @@ public class H5Ex_T_String { // Create the dataset and write the string data to it. try { if ((file_id >= 0) && (filetype_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -94,14 +96,14 @@ public class H5Ex_T_String { for (int indx = 0; indx < DIM0; indx++) { for (int jndx = 0; jndx < SDIM; jndx++) { if (jndx < str_data[indx].length()) - dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + dset_data[indx][jndx] = (byte)str_data[indx].charAt(jndx); else dset_data[indx][jndx] = 0; } } if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -151,17 +153,17 @@ public class H5Ex_T_String { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long filetype_id = HDF5Constants.H5I_INVALID_HID; - long memtype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long sdim = 0; + long[] dims = {DIM0}; byte[][] dset_data; StringBuffer[] str_data; @@ -213,8 +215,8 @@ public class H5Ex_T_String { } // Allocate space for data. - dset_data = new byte[(int) dims[0]][(int)sdim]; - str_data = new StringBuffer[(int) dims[0]]; + dset_data = new byte[(int)dims[0]][(int)sdim]; + str_data = new StringBuffer[(int)dims[0]]; // Create the memory datatype. try { @@ -230,9 +232,9 @@ public class H5Ex_T_String { try { if ((dataset_id >= 0) && (memtype_id >= 0)) H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); byte[] tempbuf = new byte[(int)sdim]; - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { for (int jndx = 0; jndx < sdim; jndx++) { tempbuf[jndx] = dset_data[indx][jndx]; } @@ -293,10 +295,10 @@ public class H5Ex_T_String { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_String.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -304,5 +306,4 @@ public class H5Ex_T_String { // data using malloc(). H5Ex_T_String.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java index 700f6a9..46c1038 100644 --- a/java/examples/datatypes/H5Ex_T_StringAttribute.java +++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java @@ -24,29 +24,30 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_T_StringAttribute { - private static String FILENAME = "H5Ex_T_StringAttribute.h5"; - private static String DATASETNAME = "DS1"; + private static String FILENAME = "H5Ex_T_StringAttribute.h5"; + private static String DATASETNAME = "DS1"; private static String ATTRIBUTENAME = "A1"; - private static final int DIM0 = 4; - private static final int SDIM = 8; - private static final int RANK = 1; - - private static void CreateDataset() { - long file_id = 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"), - new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() + { + long file_id = 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"), + new StringBuffer("sweet"), new StringBuffer("sorrow.")}; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -77,7 +78,8 @@ public class H5Ex_T_StringAttribute { dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); if (dataspace_id >= 0) { dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Sclose(dataspace_id); dataspace_id = HDF5Constants.H5I_INVALID_HID; } @@ -99,7 +101,7 @@ public class H5Ex_T_StringAttribute { try { if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -110,7 +112,7 @@ public class H5Ex_T_StringAttribute { for (int indx = 0; indx < DIM0; indx++) { for (int jndx = 0; jndx < SDIM; jndx++) { if (jndx < str_data[indx].length()) - dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + dset_data[indx][jndx] = (byte)str_data[indx].charAt(jndx); else dset_data[indx][jndx] = 0; } @@ -174,18 +176,18 @@ public class H5Ex_T_StringAttribute { catch (Exception e) { e.printStackTrace(); } - } - private static void ReadDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long filetype_id = HDF5Constants.H5I_INVALID_HID; - long memtype_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadDataset() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long sdim = 0; - long[] dims = { DIM0 }; + long sdim = 0; + long[] dims = {DIM0}; byte[][] dset_data; StringBuffer[] str_data; @@ -209,7 +211,7 @@ public class H5Ex_T_StringAttribute { try { if (dataset_id >= 0) attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -246,8 +248,8 @@ public class H5Ex_T_StringAttribute { } // Allocate space for data. - dset_data = new byte[(int) dims[0]][(int)sdim]; - str_data = new StringBuffer[(int) dims[0]]; + dset_data = new byte[(int)dims[0]][(int)sdim]; + str_data = new StringBuffer[(int)dims[0]]; // Create the memory datatype. try { @@ -264,7 +266,7 @@ public class H5Ex_T_StringAttribute { if ((attribute_id >= 0) && (memtype_id >= 0)) H5.H5Aread(attribute_id, memtype_id, dset_data); byte[] tempbuf = new byte[(int)sdim]; - for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int indx = 0; indx < (int)dims[0]; indx++) { for (int jndx = 0; jndx < sdim; jndx++) { tempbuf[jndx] = dset_data[indx][jndx]; } @@ -333,10 +335,10 @@ public class H5Ex_T_StringAttribute { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_StringAttribute.CreateDataset(); // Now we begin the read section of this example. Here we assume // the dataset and array have the same name and rank, but can have @@ -344,5 +346,4 @@ public class H5Ex_T_StringAttribute { // data using malloc(). H5Ex_T_StringAttribute.ReadDataset(); } - } diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java index 8a29e60..1d4c2c4 100644 --- a/java/examples/datatypes/H5Ex_T_VLString.java +++ b/java/examples/datatypes/H5Ex_T_VLString.java @@ -19,24 +19,24 @@ package examples.datatypes; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -public class H5Ex_T_VLString -{ - private static String FILENAME = "H5Ex_T_VLString.h5"; +public class H5Ex_T_VLString { + private static String FILENAME = "H5Ex_T_VLString.h5"; private static String DATASETNAME = "DS1"; - private static void createDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long type_id = HDF5Constants.H5I_INVALID_HID; + private static void createDataset() + { + 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 }; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + int rank = 1; + String[] str_data = {"Parting", "is such", "sweet", "sorrow."}; + long[] dims = {str_data.length}; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -62,8 +62,9 @@ public class H5Ex_T_VLString // Create the dataset and write the string data to it. try { if ((file_id >= 0) && (type_id >= 0) && (dataspace_id >= 0)) { - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, type_id, dataspace_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, type_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } } catch (Exception e) { @@ -74,7 +75,7 @@ public class H5Ex_T_VLString try { if (dataset_id >= 0) H5.H5Dwrite_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_data); + HDF5Constants.H5P_DEFAULT, str_data); } catch (Exception e) { e.printStackTrace(); @@ -91,11 +92,12 @@ public class H5Ex_T_VLString } } - private static void readDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long type_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - String[] str_data = { "", "", "", "" }; + private static void readDataset() + { + 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 { file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); @@ -106,9 +108,9 @@ public class H5Ex_T_VLString try { dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); - type_id = H5.H5Dget_type(dataset_id); - H5.H5Dread_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, - str_data); + type_id = H5.H5Dget_type(dataset_id); + H5.H5Dread_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); } catch (Exception e) { e.printStackTrace(); @@ -127,9 +129,9 @@ public class H5Ex_T_VLString } } - public static void main(String[] args) { + public static void main(String[] args) + { H5Ex_T_VLString.createDataset(); H5Ex_T_VLString.readDataset(); } - } diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt index 6483f91..9f20abf 100644 --- a/java/examples/groups/CMakeLists.txt +++ b/java/examples/groups/CMakeLists.txt @@ -36,6 +36,13 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_${example}_SRC_FORMAT ${example}.java) + endif () endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java index 313c9c7..2c6535a 100644 --- a/java/examples/groups/H5Ex_G_Compact.java +++ b/java/examples/groups/H5Ex_G_Compact.java @@ -16,14 +16,14 @@ package examples.groups; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.structs.H5G_info_t; - import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + public class H5Ex_G_Compact { private static final String FILE1 = "H5Ex_G_Compact1.h5"; @@ -38,44 +38,42 @@ public class H5Ex_G_Compact { private static final Map<Integer, H5G_storage> lookup = new HashMap<Integer, H5G_storage>(); - static { + static + { for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) lookup.put(s.getCode(), s); } private int code; - H5G_storage(int layout_type) { - this.code = layout_type; - } + H5G_storage(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5G_storage get(int code) { - return lookup.get(code); - } + public static H5G_storage get(int code) { return lookup.get(code); } } - public static void CreateGroup() { - long file_id = HDF5Constants.H5I_INVALID_HID; + public static void CreateGroup() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long group_id = HDF5Constants.H5I_INVALID_HID; - long fapl_id = HDF5Constants.H5I_INVALID_HID; + long fapl_id = HDF5Constants.H5I_INVALID_HID; H5G_info_t ginfo; long size; // Create file 1. This file will use original format groups. try { - file_id = H5.H5Fcreate (FILE1, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + file_id = H5.H5Fcreate(FILE1, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } // Create a group in the file1. try { - if(file_id >= 0) - group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -83,7 +81,7 @@ public class H5Ex_G_Compact { // Obtain the group info and print the group storage type. try { - if(group_id >= 0) { + if (group_id >= 0) { ginfo = H5.H5Gget_info(group_id); System.out.print("Group storage type for " + FILE1 + " is: "); switch (H5G_storage.get(ginfo.storage_type)) { @@ -160,7 +158,8 @@ public class H5Ex_G_Compact { try { fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); if (fapl_id >= 0) - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, + HDF5Constants.H5F_LIBVER_LATEST); } catch (Exception e) { e.printStackTrace(); @@ -175,8 +174,9 @@ public class H5Ex_G_Compact { } // Create group in file2. try { - if(file_id >= 0) - group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -257,7 +257,5 @@ public class H5Ex_G_Compact { } } - public static void main(String[] args) { - H5Ex_G_Compact.CreateGroup(); - } + public static void main(String[] args) { H5Ex_G_Compact.CreateGroup(); } } diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java index 4fa5aa2..86a790d 100644 --- a/java/examples/groups/H5Ex_G_Corder.java +++ b/java/examples/groups/H5Ex_G_Corder.java @@ -23,11 +23,12 @@ import hdf.hdf5lib.structs.H5G_info_t; public class H5Ex_G_Corder { private static String FILE = "H5Ex_G_Corder.h5"; - private static void CreateGroup() throws Exception { - long file_id = HDF5Constants.H5I_INVALID_HID; - long group_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateGroup() throws Exception + { + 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; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; int status; H5G_info_t ginfo; int i; @@ -36,35 +37,35 @@ public class H5Ex_G_Corder { try { // Create a new file using default properties. file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); // Create group creation property list and enable link creation order tracking. gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); - status = H5.H5Pset_link_creation_order(gcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED - + HDF5Constants.H5P_CRT_ORDER_INDEXED); + status = H5.H5Pset_link_creation_order(gcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Create primary group using the property list. if (status >= 0) group_id = H5.H5Gcreate(file_id, "index_group", HDF5Constants.H5P_DEFAULT, gcpl_id, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); try { /* - * Create subgroups in the primary group. These will be tracked by creation order. Note that these - * groups do not have to have the creation order tracking property set. + * Create subgroups in the primary group. These will be tracked by creation order. Note that + * these groups do not have to have the creation order tracking property set. */ - subgroup_id = H5.H5Gcreate(group_id, "H", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); - status = H5.H5Gclose(subgroup_id); - subgroup_id = H5.H5Gcreate(group_id, "D", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); - status = H5.H5Gclose(subgroup_id); - subgroup_id = H5.H5Gcreate(group_id, "F", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); - status = H5.H5Gclose(subgroup_id); - subgroup_id = H5.H5Gcreate(group_id, "5", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); - status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "H", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "D", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "F", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "5", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); // Get group info. ginfo = H5.H5Gget_info(group_id); @@ -73,8 +74,8 @@ public class H5Ex_G_Corder { System.out.println("Traversing group using alphabetical indices:"); for (i = 0; i < ginfo.nlinks; i++) { // Retrieve the name of the ith link in a group - name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, - i, HDF5Constants.H5P_DEFAULT); + name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); System.out.println("Index " + i + ": " + name); } @@ -83,10 +84,9 @@ public class H5Ex_G_Corder { for (i = 0; i < ginfo.nlinks; i++) { // Retrieve the name of the ith link in a group name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_CRT_ORDER, - HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); System.out.println("Index " + i + ": " + name); } - } catch (Exception e) { e.printStackTrace(); @@ -106,7 +106,8 @@ public class H5Ex_G_Corder { } } - public static void main(String[] args) { + public static void main(String[] args) + { try { H5Ex_G_Corder.CreateGroup(); } @@ -114,5 +115,4 @@ public class H5Ex_G_Corder { ex.printStackTrace(); } } - } diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java index 9304538..51804b9 100644 --- a/java/examples/groups/H5Ex_G_Create.java +++ b/java/examples/groups/H5Ex_G_Create.java @@ -20,17 +20,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5Ex_G_Create { - private static String FILENAME = "H5Ex_G_Create.h5"; + private static String FILENAME = "H5Ex_G_Create.h5"; private static String GROUPNAME = "G1"; - private static void CreateGroup() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateGroup() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -39,8 +40,8 @@ public class H5Ex_G_Create { // Create a group in the file. try { if (file_id >= 0) - group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -81,11 +82,7 @@ public class H5Ex_G_Create { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5Ex_G_Create.CreateGroup(); } + public static void main(String[] args) { H5Ex_G_Create.CreateGroup(); } } diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java index ad0290c..e638fd0 100644 --- a/java/examples/groups/H5Ex_G_Intermediate.java +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -16,47 +16,49 @@ ************************************************************/ package examples.groups; +import java.util.ArrayList; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.structs.H5O_info_t; -import java.util.ArrayList; - public class H5Ex_G_Intermediate { private static String FILE = "H5Ex_G_Intermediate.h5"; - private void CreateGroup() throws Exception { + private void CreateGroup() throws Exception + { - long file_id = HDF5Constants.H5I_INVALID_HID; + long file_id = HDF5Constants.H5I_INVALID_HID; long group_id = HDF5Constants.H5I_INVALID_HID; - long gcpl_id = HDF5Constants.H5I_INVALID_HID; + long gcpl_id = HDF5Constants.H5I_INVALID_HID; try { // Create a new file_id using the default properties. file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); // Create group_id creation property list and set it to allow creation of intermediate group_ids. gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); H5.H5Pset_create_intermediate_group(gcpl_id, true); /* - * Create the group_id /G1/G2/G3. Note that /G1 and /G1/G2 do not exist yet. This call would cause an error - * if we did not use the previously created property list. + * Create the group_id /G1/G2/G3. Note that /G1 and /G1/G2 do not exist yet. This call would cause + * an error if we did not use the previously created property list. */ - group_id = H5 - .H5Gcreate(file_id, "/G1/G2/G3", gcpl_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, "/G1/G2/G3", gcpl_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); // Print all the objects in the file_ids to show that intermediate group_ids have been created. System.out.println("Objects in the file_id:"); // H5O_iterate_opdata_t iter_data = null; H5O_iterate_opdata_t iter_data = new H5O_iter_data(); - H5O_iterate_t iter_cb = new H5O_iter_callback(); + H5O_iterate_t iter_cb = new H5O_iter_callback(); - H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, + iter_data); } catch (Exception e) { e.printStackTrace(); @@ -72,7 +74,8 @@ public class H5Ex_G_Intermediate { } } - public static void main(String[] args) { + public static void main(String[] args) + { try { (new H5Ex_G_Intermediate()).CreateGroup(); } @@ -83,9 +86,10 @@ public class H5Ex_G_Intermediate { private class idata { public String link_name = null; - public int link_type = -1; + public int link_type = -1; - idata(String name, int type) { + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -96,9 +100,10 @@ public class H5Ex_G_Intermediate { } private class H5O_iter_callback implements H5O_iterate_t { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); - ((H5O_iter_data) op_data).iterdata.add(id); + ((H5O_iter_data)op_data).iterdata.add(id); System.out.print("/"); /* Print root group in object path */ @@ -118,5 +123,4 @@ public class H5Ex_G_Intermediate { return 0; } } - } diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java index 6caecac..24cbb0a 100644 --- a/java/examples/groups/H5Ex_G_Iterate.java +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -16,47 +16,43 @@ ************************************************************/ package examples.groups; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.structs.H5O_token_t; - import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5O_token_t; + public class H5Ex_G_Iterate { - private static String FILENAME = "groups/h5ex_g_iterate.h5"; + private static String FILENAME = "groups/h5ex_g_iterate.h5"; private static String DATASETNAME = "/"; enum H5O_type { - H5O_TYPE_UNKNOWN(-1), // Unknown object type - H5O_TYPE_GROUP(0), // Object is a group - H5O_TYPE_DATASET(1), // Object is a dataset + H5O_TYPE_UNKNOWN(-1), // Unknown object type + H5O_TYPE_GROUP(0), // Object is a group + H5O_TYPE_DATASET(1), // Object is a dataset H5O_TYPE_NAMED_DATATYPE(2), // Object is a named data type - H5O_TYPE_NTYPES(3); // Number of different object types + H5O_TYPE_NTYPES(3); // Number of different object types private static final Map<Integer, H5O_type> lookup = new HashMap<Integer, H5O_type>(); - static { + static + { for (H5O_type s : EnumSet.allOf(H5O_type.class)) lookup.put(s.getCode(), s); } private int code; - H5O_type(int layout_type) { - this.code = layout_type; - } + H5O_type(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5O_type get(int code) { - return lookup.get(code); - } + public static H5O_type get(int code) { return lookup.get(code); } } - private static void do_iterate() { + private static void do_iterate() + { long file_id = HDF5Constants.H5I_INVALID_HID; // Open a file using default properties. @@ -71,12 +67,13 @@ public class H5Ex_G_Iterate { System.out.println("Objects in root group:"); try { if (file_id >= 0) { - int count = (int) H5.H5Gn_members(file_id, DATASETNAME); - String[] oname = new String[count]; - int[] otype = new int[count]; - int[] ltype = new int[count]; + int count = (int)H5.H5Gn_members(file_id, DATASETNAME); + String[] oname = new String[count]; + int[] otype = new int[count]; + int[] ltype = new int[count]; H5O_token_t[] otokens = new H5O_token_t[count]; - H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, otokens, HDF5Constants.H5_INDEX_NAME); + H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, otokens, + HDF5Constants.H5_INDEX_NAME); // Get type of the object and display its name and type. for (int indx = 0; indx < otype.length; indx++) { @@ -110,8 +107,5 @@ public class H5Ex_G_Iterate { } } - public static void main(String[] args) { - H5Ex_G_Iterate.do_iterate(); - } - + public static void main(String[] args) { H5Ex_G_Iterate.do_iterate(); } } diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java index 67a2f53..7a3fba3 100644 --- a/java/examples/groups/H5Ex_G_Phase.java +++ b/java/examples/groups/H5Ex_G_Phase.java @@ -16,19 +16,19 @@ ************************************************************/ package examples.groups; -import hdf.hdf5lib.H5; -import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.structs.H5G_info_t; - import java.util.EnumSet; import java.util.HashMap; import java.util.Map; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + public class H5Ex_G_Phase { - private static String FILE = "H5Ex_G_Phase.h5"; - private static int MAX_GROUPS = 7; + private static String FILE = "H5Ex_G_Phase.h5"; + private static int MAX_GROUPS = 7; private static int MAX_COMPACT = 5; - private static int MIN_DENSE = 3; + private static int MIN_DENSE = 3; enum H5G_storage { H5G_STORAGE_TYPE_UNKNOWN(-1), @@ -38,42 +38,39 @@ public class H5Ex_G_Phase { private static final Map<Integer, H5G_storage> lookup = new HashMap<Integer, H5G_storage>(); - static { + static + { for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) lookup.put(s.getCode(), s); } private int code; - H5G_storage(int layout_type) { - this.code = layout_type; - } + H5G_storage(int layout_type) { this.code = layout_type; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } - public static H5G_storage get(int code) { - return lookup.get(code); - } + public static H5G_storage get(int code) { return lookup.get(code); } } - private static void CreateGroup() { - long file_id = HDF5Constants.H5I_INVALID_HID; - long group_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateGroup() + { + 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; + 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; - // Set file access property list to allow the latest file format.This will allow the library to create new - // format groups. + // Set file access property list to allow the latest file format.This will allow the library to create + // new format groups. try { fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); if (fapl_id >= 0) - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, + HDF5Constants.H5F_LIBVER_LATEST); } catch (Exception e) { e.printStackTrace(); @@ -101,21 +98,23 @@ public class H5Ex_G_Phase { // Create primary group. try { if ((file_id >= 0) && (gcpl_id >= 0)) - group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id, HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); } - // Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is created. + // Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is + // created. for (i = 1; i <= MAX_GROUPS; i++) { // Define the subgroup name and create the subgroup. - char append = (char) (((char) i) + '0'); - name = name + append; /* G1, G2, G3 etc. */ + char append = (char)(((char)i) + '0'); + name = name + append; /* G1, G2, G3 etc. */ try { if (group_id >= 0) { - subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Gclose(subgroup_id); } } @@ -127,7 +126,8 @@ public class H5Ex_G_Phase { try { if (group_id >= 0) { ginfo = H5.H5Gget_info(group_id); - System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + + ": Storage type is "); switch (H5G_storage.get(ginfo.storage_type)) { case H5G_STORAGE_TYPE_COMPACT: System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format @@ -169,7 +169,8 @@ public class H5Ex_G_Phase { try { if (group_id >= 0) { ginfo = H5.H5Gget_info(group_id); - System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + + ": Storage type is "); switch (H5G_storage.get(ginfo.storage_type)) { case H5G_STORAGE_TYPE_COMPACT: System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format @@ -228,11 +229,7 @@ public class H5Ex_G_Phase { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5Ex_G_Phase.CreateGroup(); } + public static void main(String[] args) { H5Ex_G_Phase.CreateGroup(); } } diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java index c5b6373..cd60f6b 100644 --- a/java/examples/groups/H5Ex_G_Traverse.java +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -24,10 +24,11 @@ package examples.groups; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; + import examples.groups.H5Ex_G_Iterate.H5O_type; class opdata implements H5L_iterate_opdata_t { @@ -38,10 +39,11 @@ class opdata implements H5L_iterate_opdata_t { public class H5Ex_G_Traverse { - private static String FILE = "h5ex_g_traverse.h5"; + private static String FILE = "h5ex_g_traverse.h5"; public static H5L_iterate_t iter_cb = new H5L_iter_callbackT(); - private static void OpenGroup() { + private static void OpenGroup() + { long file_id = HDF5Constants.H5I_INVALID_HID; H5O_info_t infobuf; opdata od = new opdata(); @@ -50,9 +52,9 @@ public class H5Ex_G_Traverse { try { file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); if (file_id >= 0) { - infobuf = H5.H5Oget_info(file_id); - od.recurs = 0; - od.prev = null; + infobuf = H5.H5Oget_info(file_id); + od.recurs = 0; + od.prev = null; od.obj_token = infobuf.token; } } @@ -64,7 +66,8 @@ public class H5Ex_G_Traverse { try { System.out.println("/ {"); // H5L_iterate_t iter_cb = new H5L_iter_callbackT(); - H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, od); + H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, + od); System.out.println("}"); } catch (Exception e) { @@ -81,18 +84,17 @@ public class H5Ex_G_Traverse { } } - public static void main(String[] args) { - H5Ex_G_Traverse.OpenGroup(); - } + public static void main(String[] args) { H5Ex_G_Traverse.OpenGroup(); } } class H5L_iter_callbackT implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { H5O_info_t infobuf; int return_val = 0; - opdata od = (opdata) op_data; // Type conversion - int spaces = 2 * (od.recurs + 1); // Number of white spaces to prepend to output. + opdata od = (opdata)op_data; // Type conversion + int spaces = 2 * (od.recurs + 1); // Number of white spaces to prepend to output. // Get type of the object and display its name and type. // The name of the object is passed to this function by the Library. @@ -123,13 +125,14 @@ class H5L_iter_callbackT implements H5L_iterate_t { // recursive iteration on the discovered // group. The new opdata is given a pointer to the // current one. - opdata nextod = new opdata(); - nextod.recurs = od.recurs + 1; - nextod.prev = od; - nextod.obj_token = infobuf.token; + opdata nextod = new opdata(); + nextod.recurs = od.recurs + 1; + nextod.prev = od; + nextod.obj_token = infobuf.token; H5L_iterate_t iter_cb2 = new H5L_iter_callbackT(); - return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME, - HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, HDF5Constants.H5P_DEFAULT); + return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, + HDF5Constants.H5P_DEFAULT); } for (int i = 0; i < spaces; i++) System.out.print(" "); @@ -152,7 +155,8 @@ class H5L_iter_callbackT implements H5L_iterate_t { return return_val; } - public boolean group_check(opdata od, H5O_token_t target_token) { + public boolean group_check(opdata od, H5O_token_t target_token) + { if (od.obj_token.equals(target_token)) return true; // Object tokens match else if (od.recurs == 0) @@ -160,5 +164,4 @@ class H5L_iter_callbackT implements H5L_iterate_t { else return group_check(od.prev, target_token); // Recursively examine the next node } - } diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java index 790be80..d14ded6 100644 --- a/java/examples/groups/H5Ex_G_Visit.java +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -20,22 +20,23 @@ ************************************************************/ package examples.groups; +import java.util.ArrayList; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; -import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; -import java.util.ArrayList; - public class H5Ex_G_Visit { private static String FILE = "groups/h5ex_g_visit.h5"; - public static void main(String[] args) { + public static void main(String[] args) + { try { (new H5Ex_G_Visit()).VisitGroup(); } @@ -44,7 +45,8 @@ public class H5Ex_G_Visit { } } - private void VisitGroup() throws Exception { + private void VisitGroup() throws Exception + { long file_id = HDF5Constants.H5I_INVALID_HID; @@ -55,15 +57,16 @@ public class H5Ex_G_Visit { // Begin iteration using H5Ovisit System.out.println("Objects in the file:"); H5O_iterate_opdata_t iter_data = new H5O_iter_data(); - H5O_iterate_t iter_cb = new H5O_iter_callback(); - H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + H5O_iterate_t iter_cb = new H5O_iter_callback(); + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, + iter_data); System.out.println(); // Repeat the same process using H5Lvisit H5L_iterate_opdata_t iter_data2 = new H5L_iter_data(); - H5L_iterate_t iter_cb2 = new H5L_iter_callback(); + H5L_iterate_t iter_cb2 = new H5L_iter_callback(); System.out.println("Links in the file:"); - H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2); - + H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, + iter_data2); } catch (Exception e) { e.printStackTrace(); @@ -76,15 +79,16 @@ public class H5Ex_G_Visit { } /************************************************************ - * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link points - * to, and calls the operator function for H5Ovisit. + * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link + *points to, and calls the operator function for H5Ovisit. ************************************************************/ private class idata { public String link_name = null; - public int link_type = -1; + public int link_type = -1; - idata(String name, int type) { + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -95,20 +99,21 @@ public class H5Ex_G_Visit { } private class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); - ((H5L_iter_data) op_data).iterdata.add(id); + ((H5L_iter_data)op_data).iterdata.add(id); H5O_info_t infobuf; int ret = 0; try { - // Get type of the object and display its name and type. The name of the object is passed to this - // function by the Library. - infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); + // Get type of the object and display its name and type. The name of the object is passed to + // this function by the Library. + infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); H5O_iterate_t iter_cbO = new H5O_iter_callback(); H5O_iterate_opdata_t iter_dataO = new H5O_iter_data(); - ret = iter_cbO.callback(group, name, infobuf, iter_dataO); + ret = iter_cbO.callback(group, name, infobuf, iter_dataO); } catch (Exception e) { e.printStackTrace(); @@ -123,9 +128,10 @@ public class H5Ex_G_Visit { } private class H5O_iter_callback implements H5O_iterate_t { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); - ((H5O_iter_data) op_data).iterdata.add(id); + ((H5O_iter_data)op_data).iterdata.add(id); System.out.print("/"); /* Print root group in object path */ @@ -145,5 +151,4 @@ public class H5Ex_G_Visit { return 0; } } - } diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt index 867740b..a5e2a67 100644 --- a/java/examples/intro/CMakeLists.txt +++ b/java/examples/intro/CMakeLists.txt @@ -36,6 +36,13 @@ foreach (example ${HDF_JAVA_EXAMPLES}) # install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) get_target_property (${example}_CLASSPATH ${example} CLASSDIR) add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_${example}_SRC_FORMAT ${example}.java) + endif () endforeach () set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java index 949a770..22ecdae 100644 --- a/java/examples/intro/H5_CreateAttribute.java +++ b/java/examples/intro/H5_CreateAttribute.java @@ -20,25 +20,26 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_CreateAttribute { - private static String FILENAME = "H5_CreateAttribute.h5"; - private static String DATASETNAME = "dset"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; + private static String FILENAME = "H5_CreateAttribute.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; private static String DATASETATTRIBUTE = "Units"; - private static void CreateDatasetAttribute() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDatasetAttribute() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long dataspace_id = HDF5Constants.H5I_INVALID_HID; - long dataset_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 }; + long[] dims1 = {DIM_X, DIM_Y}; + long[] dims = {2}; + int[] attr_data = {100, 200}; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -55,8 +56,9 @@ public class H5_CreateAttribute { // Create the dataset. try { if ((file_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, + dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -82,8 +84,9 @@ public class H5_CreateAttribute { // Create a dataset attribute. try { if ((dataset_id >= 0) && (dataspace_id >= 0)) - attribute_id = H5.H5Acreate(dataset_id, DATASETATTRIBUTE, HDF5Constants.H5T_STD_I32BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(dataset_id, DATASETATTRIBUTE, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -135,8 +138,5 @@ public class H5_CreateAttribute { } } - public static void main(String[] args) { - H5_CreateAttribute.CreateDatasetAttribute(); - } - + public static void main(String[] args) { H5_CreateAttribute.CreateDatasetAttribute(); } } diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java index f938be2..20683e8 100644 --- a/java/examples/intro/H5_CreateDataset.java +++ b/java/examples/intro/H5_CreateDataset.java @@ -20,21 +20,22 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_CreateDataset { - private static String FILENAME = "H5_CreateDataset.h5"; + private static String FILENAME = "H5_CreateDataset.h5"; private static String DATASETNAME = "dset"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; - private static void CreateDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateDataset() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -51,8 +52,9 @@ public class H5_CreateDataset { // Create the dataset. try { if ((file_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, + dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -84,11 +86,7 @@ public class H5_CreateDataset { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5_CreateDataset.CreateDataset(); } + public static void main(String[] args) { H5_CreateDataset.CreateDataset(); } } diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java index d48ba6c..4323581 100644 --- a/java/examples/intro/H5_CreateFile.java +++ b/java/examples/intro/H5_CreateFile.java @@ -22,13 +22,14 @@ import hdf.hdf5lib.HDF5Constants; public class H5_CreateFile { static final String FILENAME = "H5_CreateFile.h5"; - private static void CreateFile() { + private static void CreateFile() + { long file_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -42,11 +43,7 @@ public class H5_CreateFile { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5_CreateFile.CreateFile(); } + public static void main(String[] args) { H5_CreateFile.CreateFile(); } } diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java index c0bb954..a276cbd 100644 --- a/java/examples/intro/H5_CreateGroup.java +++ b/java/examples/intro/H5_CreateGroup.java @@ -20,17 +20,18 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_CreateGroup { - private static String FILENAME = "H5_CreateGroup.h5"; + private static String FILENAME = "H5_CreateGroup.h5"; private static String GROUPNAME = "MyGroup"; - private static void CreateGroup() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateGroup() + { + long file_id = HDF5Constants.H5I_INVALID_HID; long group_id = HDF5Constants.H5I_INVALID_HID; // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -39,8 +40,8 @@ public class H5_CreateGroup { // Create a group in the file. try { if (file_id >= 0) - group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -63,11 +64,7 @@ public class H5_CreateGroup { catch (Exception e) { e.printStackTrace(); } - - } - - public static void main(String[] args) { - H5_CreateGroup.CreateGroup(); } + public static void main(String[] args) { H5_CreateGroup.CreateGroup(); } } diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java index f2c6168..2fb9c3c 100644 --- a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java +++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java @@ -20,13 +20,14 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_CreateGroupAbsoluteRelative { - private static String FILENAME = "H5_CreateGroupAbsoluteRelative.h5"; - private static String GROUPNAME = "MyGroup"; + private static String FILENAME = "H5_CreateGroupAbsoluteRelative.h5"; + private static String GROUPNAME = "MyGroup"; private static String GROUPNAME_A = "GroupA"; private static String GROUPNAME_B = "GroupB"; - private static void CreateGroupAbsoluteAndRelative() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void CreateGroupAbsoluteAndRelative() + { + 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; @@ -34,7 +35,7 @@ public class H5_CreateGroupAbsoluteRelative { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -44,7 +45,7 @@ public class H5_CreateGroupAbsoluteRelative { try { if (file_id >= 0) group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -53,8 +54,9 @@ public class H5_CreateGroupAbsoluteRelative { // Create group "Group_A" in group "MyGroup" using absolute name. try { if (file_id >= 0) - group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + group2_id = + H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -63,8 +65,8 @@ public class H5_CreateGroupAbsoluteRelative { // Create group "Group_B" in group "MyGroup" using relative name. try { if (group1_id >= 0) - group3_id = H5.H5Gcreate(group1_id, GROUPNAME_B, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + group3_id = H5.H5Gcreate(group1_id, GROUPNAME_B, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -105,11 +107,10 @@ public class H5_CreateGroupAbsoluteRelative { catch (Exception e) { e.printStackTrace(); } - } - public static void main(String[] args) { + public static void main(String[] args) + { H5_CreateGroupAbsoluteRelative.CreateGroupAbsoluteAndRelative(); } - } diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java index f1d1cba..1d7cf99 100644 --- a/java/examples/intro/H5_CreateGroupDataset.java +++ b/java/examples/intro/H5_CreateGroupDataset.java @@ -20,27 +20,28 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_CreateGroupDataset { - private static String FILENAME = "H5_CreateGroupDataset.h5"; - private static String GROUPNAME = "MyGroup"; - private static String GROUPNAME_A = "GroupA"; + private static String FILENAME = "H5_CreateGroupDataset.h5"; + private static String GROUPNAME = "MyGroup"; + private static String GROUPNAME_A = "GroupA"; private static String DATASETNAME1 = "dset1"; private static String DATASETNAME2 = "dset2"; - private static final int DIM1_X = 3; - private static final int DIM1_Y = 3; - private static final int DIM2_X = 2; - private static final int DIM2_Y = 10; - - private static void h5_crtgrpd() { - long file_id = 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; + private static final int DIM1_X = 3; + private static final int DIM1_Y = 3; + private static final int DIM2_X = 2; + private static final int DIM2_Y = 10; + + private static void h5_crtgrpd() + { + long file_id = 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 }; - long[] dims2 = { DIM2_X, DIM2_Y }; + long[] dims1 = {DIM1_X, DIM1_Y}; + long[] dims2 = {DIM2_X, DIM2_Y}; // Initialize the first dataset. for (int indx = 0; indx < DIM1_X; indx++) @@ -55,15 +56,16 @@ public class H5_CreateGroupDataset { // Create a file. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); // Create a group named "/MyGroup" in the file. if (file_id >= 0) { group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); // Create group "Group_A" in group "MyGroup" using absolute name. if (group1_id >= 0) { - group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + group2_id = + H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); if (group2_id >= 0) H5.H5Gclose(group2_id); } @@ -86,8 +88,9 @@ public class H5_CreateGroupDataset { // Create the dataset in group "MyGroup". try { if ((file_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, "/" + GROUPNAME + "/" + DATASETNAME1, HDF5Constants.H5T_STD_I32BE, - dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = H5.H5Dcreate( + file_id, "/" + GROUPNAME + "/" + DATASETNAME1, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -96,8 +99,8 @@ public class H5_CreateGroupDataset { // Write the first dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset1_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset1_data); } catch (Exception e) { e.printStackTrace(); @@ -126,7 +129,8 @@ public class H5_CreateGroupDataset { // Open an existing group of the specified file. try { if (file_id >= 0) - group_id = H5.H5Gopen(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT); + group_id = + H5.H5Gopen(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -144,7 +148,8 @@ public class H5_CreateGroupDataset { try { if ((group_id >= 0) && (dataspace_id >= 0)) dataset_id = H5.H5Dcreate(group_id, DATASETNAME2, HDF5Constants.H5T_STD_I32BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -153,8 +158,8 @@ public class H5_CreateGroupDataset { // Write the second dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset2_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset2_data); } catch (Exception e) { e.printStackTrace(); @@ -197,8 +202,5 @@ public class H5_CreateGroupDataset { } } - public static void main(String[] args) { - H5_CreateGroupDataset.h5_crtgrpd(); - } - + public static void main(String[] args) { H5_CreateGroupDataset.h5_crtgrpd(); } } diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java index 67e1ac5..379fe20 100644 --- a/java/examples/intro/H5_ReadWrite.java +++ b/java/examples/intro/H5_ReadWrite.java @@ -20,16 +20,17 @@ import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; public class H5_ReadWrite { - private static String FILENAME = "H5_ReadWrite.h5"; + private static String FILENAME = "H5_ReadWrite.h5"; private static String DATASETNAME = "dset"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; - private static void ReadWriteDataset() { - long file_id = HDF5Constants.H5I_INVALID_HID; + private static void ReadWriteDataset() + { + 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 dataset_id = HDF5Constants.H5I_INVALID_HID; + long[] dims = {DIM_X, DIM_Y}; int[][] dset_data = new int[DIM_X][DIM_Y]; // Initialize the dataset. @@ -40,7 +41,7 @@ public class H5_ReadWrite { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -57,8 +58,9 @@ public class H5_ReadWrite { // Create the dataset. try { if ((file_id >= 0) && (dataspace_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, + dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -67,8 +69,8 @@ public class H5_ReadWrite { // Write the dataset. try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -76,8 +78,8 @@ public class H5_ReadWrite { try { if (dataset_id >= 0) - H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -102,8 +104,5 @@ public class H5_ReadWrite { } } - public static void main(String[] args) { - H5_ReadWrite.ReadWriteDataset(); - } - + public static void main(String[] args) { H5_ReadWrite.ReadWriteDataset(); } } diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index a26e117..0b716f7 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -132,6 +132,9 @@ SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS ${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}) add_dependencies (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_TARGET}) set_target_properties (${HDF5_JAVA_HDF5_LIB_TARGET} PROPERTIES FOLDER libraries/java) +if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_SRC_FORMAT ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SOURCES} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SOURCES} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SOURCES} ${HDF5_JAVA_HDF_HDF5_SOURCES}) +endif () create_javadoc(hdf5_java_doc FILES ${HDF5_JAVADOC_HDF_HDF5_CALLBACKS_SOURCES} ${HDF5_JAVADOC_HDF_HDF5_EXCEPTIONS_SOURCES} ${HDF5_JAVADOC_HDF_HDF5_STRUCTS_SOURCES} ${HDF5_JAVADOC_HDF_HDF5_SOURCES} diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index 3180ede..9fac20c 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -11,47 +11,47 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - package hdf.hdf5lib; import java.io.File; import java.nio.ByteBuffer; import java.util.Collection; import java.util.LinkedHashSet; + import hdf.hdf5lib.callbacks.H5A_iterate_cb; import hdf.hdf5lib.callbacks.H5A_iterate_t; import hdf.hdf5lib.callbacks.H5D_iterate_cb; import hdf.hdf5lib.callbacks.H5D_iterate_t; import hdf.hdf5lib.callbacks.H5E_walk_cb; import hdf.hdf5lib.callbacks.H5E_walk_t; -import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; -import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_close_func_t; import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t; import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_create_func_t; -import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; import hdf.hdf5lib.callbacks.H5P_iterate_cb; import hdf.hdf5lib.callbacks.H5P_iterate_t; +import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5JavaException; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5AC_cache_config_t; import hdf.hdf5lib.structs.H5A_info_t; import hdf.hdf5lib.structs.H5E_error2_t; -import hdf.hdf5lib.structs.H5F_info2_t; import hdf.hdf5lib.structs.H5FD_hdfs_fapl_t; import hdf.hdf5lib.structs.H5FD_ros3_fapl_t; +import hdf.hdf5lib.structs.H5F_info2_t; import hdf.hdf5lib.structs.H5G_info_t; import hdf.hdf5lib.structs.H5L_info_t; import hdf.hdf5lib.structs.H5O_info_t; @@ -61,8 +61,8 @@ import hdf.hdf5lib.structs.H5O_token_t; /** * This class is the Java interface for the HDF5 library. * <p> - * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps a single - * HDF5 entry point, generally with the arguments and return codes analogous to the C interface. + * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps + * a single HDF5 entry point, generally with the arguments and return codes analogous to the C interface. * <p> * For details of the HDF5 library, see the HDF5 Documentation at: * <a href="http://hdfgroup.org/HDF5/">http://hdfgroup.org/HDF5/</a> @@ -71,8 +71,8 @@ import hdf.hdf5lib.structs.H5O_token_t; * <b>Mapping of arguments for Java</b> * * <p> - * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF - * Reference Manual. + * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in + * the HDF Reference Manual. * * <table border=1> * <caption><b>HDF-5 C types to Java types</b> </caption> @@ -112,17 +112,19 @@ import hdf.hdf5lib.structs.H5O_token_t; * </table> * <b>General Rules for Passing Arguments and Results</b> * <p> - * In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is for arrays, - * which are discussed below. + * In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is + * for arrays, which are discussed below. * <p> - * The <i>return value</i> of Java methods is also the analogous type, as above. A major exception to that rule is that - * all HDF functions that return SUCCEED/FAIL are declared <i>boolean</i> in the Java version, rather than <i>int</i> as - * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. However, in most - * cases the Java method will raise an exception instead of returning an error code. See <a href="#ERRORS">Errors and - * Exceptions</a> below. + * The <i>return value</i> of Java methods is also the analogous type, as above. A major exception to that + * rule is that all HDF functions that return SUCCEED/FAIL are declared <i>boolean</i> in the Java version, + * rather than <i>int</i> as in the C. Functions that return a value or else FAIL are declared the + * equivalent to the C function. + * However, in most cases the Java method will raise an exception instead of returning an error code. + * See <a href="#ERRORS">Errors and Exceptions</a> below. * <p> - * Java does not support pass by reference of arguments, so arguments that are returned through <b>OUT</b> parameters - * must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in arrays. + * Java does not support pass by reference of arguments, so arguments that are returned through <b>OUT</b> + * parameters must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in + * arrays. * <p> * For instance, a function that returns two integers is declared: * @@ -143,53 +145,57 @@ import hdf.hdf5lib.structs.H5O_token_t; * </pre> * * <p> - * All the routines where this convention is used will have specific documentation of the details, given below. + * All the routines where this convention is used will have specific documentation of the details, given + * below. * <p> * <b>Arrays</b> * <p> - * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the - * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, + * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API + * describes the layout of the source and destination, and the data for the array passed as a block of + * bytes, for instance, * * <pre> - * herr_t H5Dread(long fid, long filetype, long memtype, long memspace, - * void * data); + * herr_t H5Dread(long fid, long filetype, long memtype, long memspace, void * data); * </pre> * * <p> - * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that is the - * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the array on - * disk (source) and in memory (destination). + * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that + * is the data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype + * of the array ondisk (source) and in memory (destination). * <p> - * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional - * arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible to declare a separate - * routine for every combination of number type and dimensionality. For that reason, the - * <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and size of the - * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order. + * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, + * multidimensional arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible + * to declare a separate routine for every combination of number type and dimensionality. For that reason, the + * <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and + * size of the data array at run time, and to convert to and from a contiguous array of bytes in synchronized + * static native C order. * <p> - * The upshot is that any Java array of numbers (either primitive or sub-classes of type <b>Number</b>) can be passed as - * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by the C - * library. So the function above would be declared: + * The upshot is that any Java array of numbers (either primitive or sub-classes of type <b>Number</b>) can be + * passed as an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes + * needed by the C library. So the function above would be declared: * * <pre> - * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data); + * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, + * Object data); * </pre> * OPEN_IDS.addElement(id); - * and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or int[][][], or - * Double[][]. + * and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or + * int[][][], or Double[][]. * <p> * <b>HDF-5 Constants</b> * <p> - * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs - * via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the parameters for - * the h5open() call include two numeric values, <b><i>HDFConstants.H5F_ACC_RDWR</i></b> and - * <b><i>HDF5Constants.H5P_DEFAULT</i></b>. As would be expected, these numbers correspond to the C constants + * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java + * programs via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, + * the parameters for the h5open() call include two numeric values, <b><i>HDFConstants.H5F_ACC_RDWR</i></b> + * and <b><i>HDF5Constants.H5P_DEFAULT</i></b>. + * As would be expected, these numbers correspond to the C constants * <b><i>H5F_ACC_RDWR</i></b> and <b><i>H5P_DEFAULT</i></b>. * <p> - * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and "hsize_t". - * These values are determined at run time by the HDF-5 C library. To support these parameters, the Java class - * <a href="./hdf.hdf5lib.HDF5CDataTypes.html"> <b>HDF5CDataTypes</b></a> looks up the values when initiated. The values - * can be accessed as public variables of the Java class, such as: + * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and + * "hsize_t". These values are determined at run time by the HDF-5 C library. To support these parameters, + * the Java class <a href="./hdf.hdf5lib.HDF5CDataTypes.html"> <b>HDF5CDataTypes</b></a> looks up the values + * when initiated. The values can be accessed as public variables of the Java class, such as: * * <pre> * long data_type = HDF5CDataTypes.JH5T_NATIVE_INT; @@ -200,20 +206,22 @@ import hdf.hdf5lib.structs.H5O_token_t; * <p> * <b>Error handling and Exceptions</b> * <p> - * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the - * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural - * for Java programming. + * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted + * from the JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, + * but is very natural for Java programming. * <p> * The exceptions of the JHI5 are organized as sub-classes of the class - * <a href="./hdf.hdf5lib.exceptions.HDF5Exception.html"> <b>HDF5Exception</b></a>. There are two subclasses of - * <b>HDF5Exception</b>, <a href="./hdf.hdf5lib.exceptions.HDF5LibraryException.html"> <b>HDF5LibraryException</b></a> - * and <a href="./hdf.hdf5lib.exceptions.HDF5JavaException.html"> <b>HDF5JavaException</b></a>. The sub-classes of the - * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the JHI5 - * wrapper and support code. + * <a href="./hdf.hdf5lib.exceptions.HDF5Exception.html"> <b>HDF5Exception</b></a>. There are two subclasses + * of + * <b>HDF5Exception</b>, <a href="./hdf.hdf5lib.exceptions.HDF5LibraryException.html"> + <b>HDF5LibraryException</b></a> + * and <a href="./hdf.hdf5lib.exceptions.HDF5JavaException.html"> <b>HDF5JavaException</b></a>. The + * sub-classes of the former represent errors from the HDF-5 C library, while sub-classes of the latter + * represent errors in the JHI5 wrapper and support code. * <p> - * The super-class <b><i>HDF5LibraryException</i></b> implements the method '<b><i>printStackTrace()</i></b>', which - * prints out the HDF-5 error stack, as described in the HDF-5 C API <i><b>H5Eprint()</b>.</i> This may be used by Java - * exception handlers to print out the HDF-5 error stack. + * The super-class <b><i>HDF5LibraryException</i></b> implements the method '<b><i>printStackTrace()</i></b>', + * which prints out the HDF-5 error stack, as described in the HDF-5 C API <i><b>H5Eprint()</b>.</i> This may + * be used by Java exception handlers to print out the HDF-5 error stack. * <hr> * * @version HDF5 1.13.2 <BR> @@ -222,7 +230,8 @@ import hdf.hdf5lib.structs.H5O_token_t; * <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR> * <a href ="./hdf.hdf5lib.HDF5Exception.html"> hdf.hdf5lib.HDF5Exception</a><BR> * <a href="http://hdfgroup.org/HDF5/"> http://hdfgroup.org/HDF5"</a> - **/ + * + */ public class H5 implements java.io.Serializable { /** * @@ -239,38 +248,36 @@ public class H5 implements java.io.Serializable { * * Make sure to update the versions number when a different library is used. */ - public final static int LIB_VERSION[] = { 1, 13, 2 }; + public final static int LIB_VERSION[] = {1, 13, 2}; /** - * add system property to load library by path - */ + * add system property to load library by path + */ public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; /** - * add system property to load library by name from library path, via System.loadLibrary() - */ + * add system property to load library by name from library path, via System.loadLibrary() + */ public final static String H5_LIBRARY_NAME_PROPERTY_KEY = "hdf.hdf5lib.H5.loadLibraryName"; private static String s_libraryName; private static boolean isLibraryLoaded = false; - private final static boolean IS_CRITICAL_PINNING = true; - // change from Vector to LinkedHashSet - jp 6-Oct-2014 + private final static boolean IS_CRITICAL_PINNING = true; private final static LinkedHashSet<Long> OPEN_IDS = new LinkedHashSet<Long>(); - static { - loadH5Lib(); - } + static { loadH5Lib(); } /** - * load native library - */ - public static void loadH5Lib() { + * load native library + */ + public static void loadH5Lib() + { // Make sure that the library is loaded only once if (isLibraryLoaded) return; // first try loading library by name from user supplied library path - s_libraryName = System.getProperty(H5_LIBRARY_NAME_PROPERTY_KEY, null); + s_libraryName = System.getProperty(H5_LIBRARY_NAME_PROPERTY_KEY, null); String mappedName = null; if ((s_libraryName != null) && (s_libraryName.length() > 0)) { try { @@ -311,7 +318,7 @@ public class H5 implements java.io.Serializable { } else { isLibraryLoaded = false; - throw (new UnsatisfiedLinkError("Invalid HDF5 library, " + filename)); + throw(new UnsatisfiedLinkError("Invalid HDF5 library, " + filename)); } } } @@ -320,7 +327,7 @@ public class H5 implements java.io.Serializable { if (!isLibraryLoaded) { try { s_libraryName = "hdf5_java"; - mappedName = System.mapLibraryName(s_libraryName); + mappedName = System.mapLibraryName(s_libraryName); System.loadLibrary("hdf5_java"); isLibraryLoaded = true; } @@ -369,18 +376,14 @@ public class H5 implements java.io.Serializable { * * @return Returns a count of open IDs */ - public final static int getOpenIDCount() { - return OPEN_IDS.size(); - } + public final static int getOpenIDCount() { return OPEN_IDS.size(); } /** * Get the open IDs * * @return Returns a collection of open IDs */ - public final static Collection<Long> getOpenIDs() { - return OPEN_IDS; - } + public final static Collection<Long> getOpenIDs() { return OPEN_IDS; } /** * H5check_version verifies that the arguments match the version numbers compiled into the library. @@ -391,20 +394,21 @@ public class H5 implements java.io.Serializable { * The minor version of the library. * @param relnum * The release number of the library. - * @return a non-negative value if successful. Upon failure (when the versions do not match), this function causes - * the application to abort (i.e., crash) + * @return a non-negative value if successful. Upon failure (when the versions do not match), this + * function causes the application to abort (i.e., crash) * - * See C API function: herr_t H5check_version() + * See C API function: herr_t H5check_version() **/ public synchronized static native int H5check_version(int majnum, int minnum, int relnum); /** - * H5close flushes all data to disk, closes all file identifiers, and cleans up all memory used by the library. + * H5close flushes all data to disk, closes all file identifiers, and cleans up all memory used by the + * library. * * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5close() throws HDF5LibraryException; @@ -414,35 +418,35 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5open() throws HDF5LibraryException; /** - * H5dont_atexit indicates to the library that an atexit() cleanup routine should not be installed. In order to be - * effective, this routine must be called before any other HDF function calls, and must be called each time the - * library is loaded/linked into the application (the first time and after it's been unloaded). - * <P> - * This is called by the static initializer, so this should never need to be explicitly called by a Java program. + * H5dont_atexit indicates to the library that an atexit() cleanup routine should not be installed. In + * order to be effective, this routine must be called before any other HDF function calls, and must be + * called each time the library is loaded/linked into the application (the first time and after it's been + * unloaded). <P> This is called by the static initializer, so this should never need to be explicitly + * called by a Java program. * * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ private synchronized static native int H5dont_atexit() throws HDF5LibraryException; /** - * Turn off error handling. By default, the C library prints the error stack of the HDF-5 C library on stdout. This - * behavior may be disabled by calling H5error_off(). + * Turn off error handling. By default, the C library prints the error stack of the HDF-5 C library on + * stdout. This behavior may be disabled by calling H5error_off(). * * @return a non-negative value if successful */ public synchronized static native int H5error_off(); /** - * Turn on error handling. By default, the C library prints the error stack of the HDF-5 C library on stdout. This - * behavior may be re-enabled by calling H5error_on(). + * Turn on error handling. By default, the C library prints the error stack of the HDF-5 C library on + * stdout. This behavior may be re-enabled by calling H5error_on(). */ public synchronized static native void H5error_on(); @@ -452,13 +456,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5garbage_collect() throws HDF5LibraryException; /** - * H5get_libversion retrieves the major, minor, and release numbers of the version of the HDF library which is - * linked to the application. + * H5get_libversion retrieves the major, minor, and release numbers of the version of the HDF library + * which is linked to the application. * * @param libversion * The version information of the HDF library. @@ -471,7 +475,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful, along with the version information. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5get_libversion(int[] libversion) throws HDF5LibraryException; @@ -502,10 +506,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful, along with the version information. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - */ + * Error from the HDF-5 Library. + */ public synchronized static native int H5set_free_list_limits(int reg_global_lim, int reg_list_lim, - int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim) throws HDF5LibraryException; + int arr_global_lim, int arr_list_lim, + int blk_global_lim, int blk_list_lim) + throws HDF5LibraryException; /** * H5export_dataset is a utility function to save data in a file. @@ -523,10 +529,11 @@ public class H5 implements java.io.Serializable { * 3 - export data as binary Big Endian. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5export_dataset(String file_export_name, long file_id, - String object_path, int binary_order) throws HDF5LibraryException; + String object_path, int binary_order) + throws HDF5LibraryException; /** * H5export_attribute is a utility function to save data in a file. @@ -544,10 +551,11 @@ public class H5 implements java.io.Serializable { * 3 - export data as binary Big Endian. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5export_attribute(String file_export_name, long dataset_id, - String attribute_name, int binary_order) throws HDF5LibraryException; + String attribute_name, int binary_order) + throws HDF5LibraryException; /** * H5is_library_threadsafe Checks to see if the library was built with thread-safety enabled. @@ -577,9 +585,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Aclose(long attr_id) throws HDF5LibraryException { + public static int H5Aclose(long attr_id) throws HDF5LibraryException + { if (attr_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -602,12 +611,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Acopy(long src_aid, long dst_aid) throws HDF5LibraryException; /** - * H5Acreate creates an attribute, attr_name, which is attached to the object specified by the identifier loc_id. + * H5Acreate creates an attribute, attr_name, which is attached to the object specified by the identifier + * loc_id. * * @param loc_id * IN: Location or object identifier; may be dataset or group @@ -625,12 +635,13 @@ public class H5 implements java.io.Serializable { * @return An attribute identifier if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - Name is null. + * Name is null. **/ - public static long H5Acreate(long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long aapl_id) - throws HDF5LibraryException, NullPointerException { + public static long H5Acreate(long loc_id, String attr_name, long type_id, long space_id, long acpl_id, + long aapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); if (id > 0) { log.trace("OPEN_IDS: H5A create add {}", id); @@ -643,15 +654,16 @@ public class H5 implements java.io.Serializable { /** * H5Acreate2 an attribute, attr_name, which is attached to the object specified by the identifier loc_id. * - * @see public static long H5Acreate( long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long - * aapl_id ) + * @see public static long H5Acreate( long loc_id, String attr_name, long type_id, long space_id, long + * acpl_id, long aapl_id ) **/ - private synchronized static native long _H5Acreate2(long loc_id, String attr_name, long type_id, long space_id, - long acpl_id, long aapl_id) throws HDF5LibraryException, NullPointerException; + private synchronized static native long _H5Acreate2(long loc_id, String attr_name, long type_id, + long space_id, long acpl_id, long aapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Acreate_by_name creates an attribute, attr_name, which is attached to the object specified by loc_id and - * obj_name. + * H5Acreate_by_name creates an attribute, attr_name, which is attached to the object specified by loc_id + * and obj_name. * * @param loc_id * IN: Location or object identifier; may be dataset or group @@ -673,13 +685,16 @@ public class H5 implements java.io.Serializable { * @return An attribute identifier if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Acreate_by_name(long loc_id, String obj_name, String attr_name, long type_id, long space_id, - long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException { - long id = _H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); + public static long H5Acreate_by_name(long loc_id, String obj_name, String attr_name, long type_id, + long space_id, long acpl_id, long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException + { + long id = + _H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Acreate_by_name add {}", id); OPEN_IDS.add(id); @@ -689,8 +704,9 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Acreate_by_name(long loc_id, String obj_name, String attr_name, - long type_id, long space_id, long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, - NullPointerException; + long type_id, long space_id, long acpl_id, + long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Adelete removes the attribute specified by its name, name, from a dataset, group, or named datatype. @@ -703,12 +719,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Adelete(long loc_id, String name) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Adelete(long loc_id, String name) + throws HDF5LibraryException, NullPointerException; /** * H5Adelete_by_idx removes an attribute, specified by its location in an index, from an object. @@ -727,16 +743,17 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - obj_name is null. + * obj_name is null. **/ - public synchronized static native void H5Adelete_by_idx(long loc_id, String obj_name, int idx_type, int order, - long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Adelete_by_idx(long loc_id, String obj_name, int idx_type, + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Adelete_by_name removes the attribute attr_name from an object specified by location and name, loc_id and - * obj_name, respectively. + * H5Adelete_by_name removes the attribute attr_name from an object specified by location and name, loc_id + * and obj_name, respectively. * * @param loc_id * IN: Location or object identifier; may be dataset or group @@ -750,12 +767,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Adelete_by_name(long loc_id, String obj_name, String attr_name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Adelete_by_name(long loc_id, String obj_name, String attr_name, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aexists determines whether the attribute attr_name exists on the object specified by obj_id. @@ -768,16 +786,16 @@ public class H5 implements java.io.Serializable { * @return boolean true if an attribute with a given name exists. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - attr_name is null. + * attr_name is null. **/ - public synchronized static native boolean H5Aexists(long obj_id, String attr_name) throws HDF5LibraryException, - NullPointerException; + public synchronized static native boolean H5Aexists(long obj_id, String attr_name) + throws HDF5LibraryException, NullPointerException; /** - * H5Aexists_by_name determines whether the attribute attr_name exists on an object. That object is specified by its - * location and name, loc_id and obj_name, respectively. + * H5Aexists_by_name determines whether the attribute attr_name exists on an object. That object is + * specified by its location and name, loc_id and obj_name, respectively. * * @param loc_id * IN: Location of object to which attribute is attached . @@ -791,12 +809,13 @@ public class H5 implements java.io.Serializable { * @return boolean true if an attribute with a given name exists, otherwise returns false. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native boolean H5Aexists_by_name(long loc_id, String obj_name, String attr_name, - long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Aexists_by_name(long loc_id, String obj_name, + String attr_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aget_info retrieves attribute information, by attribute identifier. @@ -807,7 +826,7 @@ public class H5 implements java.io.Serializable { * @return A buffer(H5A_info_t) for Attribute information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native H5A_info_t H5Aget_info(long attr_id) throws HDF5LibraryException; @@ -830,12 +849,14 @@ public class H5 implements java.io.Serializable { * @return A buffer(H5A_info_t) for Attribute information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - obj_name is null. + * obj_name is null. **/ - public synchronized static native H5A_info_t H5Aget_info_by_idx(long loc_id, String obj_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5A_info_t H5Aget_info_by_idx(long loc_id, String obj_name, + int idx_type, int order, long n, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aget_info_by_name Retrieves attribute information, by attribute name. @@ -852,12 +873,13 @@ public class H5 implements java.io.Serializable { * @return A buffer(H5A_info_t) for Attribute information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - obj_name is null. + * obj_name is null. **/ - public synchronized static native H5A_info_t H5Aget_info_by_name(long loc_id, String obj_name, String attr_name, - long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5A_info_t H5Aget_info_by_name(long loc_id, String obj_name, + String attr_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aget_name retrieves the name of an attribute specified by the identifier, attr_id. @@ -868,14 +890,13 @@ public class H5 implements java.io.Serializable { * @return String for Attribute name. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5Aget_name(long attr_id) - throws HDF5LibraryException; + public synchronized static native String H5Aget_name(long attr_id) throws HDF5LibraryException; /** - * H5Aget_name_by_idx retrieves the name of an attribute that is attached to an object, which is specified by its - * location and name, loc_id and obj_name, respectively. + * H5Aget_name_by_idx retrieves the name of an attribute that is attached to an object, which is specified + * by its location and name, loc_id and obj_name, respectively. * * @param attr_id * IN: Attribute identifier @@ -893,12 +914,13 @@ public class H5 implements java.io.Serializable { * @return String for Attribute name. * * @exception HDF5LibraryException - * - Error from the HDF5 Library. + * Error from the HDF5 Library. * @exception NullPointerException - * - obj_name is null. + * obj_name is null. **/ - public synchronized static native String H5Aget_name_by_idx(long attr_id, String obj_name, int idx_type, int order, - long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native String H5Aget_name_by_idx(long attr_id, String obj_name, int idx_type, + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aget_space retrieves a copy of the dataspace for an attribute. @@ -909,7 +931,7 @@ public class H5 implements java.io.Serializable { * @return attribute dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public static long H5Aget_space(long attr_id) throws HDF5LibraryException { @@ -925,7 +947,8 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Aget_space(long attr_id) throws HDF5LibraryException; /** - * H5Aget_storage_size returns the amount of storage that is required for the specified attribute, attr_id. + * H5Aget_storage_size returns the amount of storage that is required for the specified attribute, + * attr_id. * * @param attr_id * IN: Identifier of the attribute to query. @@ -933,7 +956,7 @@ public class H5 implements java.io.Serializable { * @return the amount of storage size allocated for the attribute; otherwise returns 0 (zero) * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Aget_storage_size(long attr_id) throws HDF5LibraryException; @@ -946,7 +969,7 @@ public class H5 implements java.io.Serializable { * @return a datatype identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public static long H5Aget_type(long attr_id) throws HDF5LibraryException { @@ -962,8 +985,8 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Aget_type(long attr_id) throws HDF5LibraryException; /** - * H5Aopen opens an existing attribute, attr_name, that is attached to an object specified an object identifier, - * object_id. + * H5Aopen opens an existing attribute, attr_name, that is attached to an object specified an object + * identifier, object_id. * * @param obj_id * IN: Identifier for object to which attribute is attached @@ -975,12 +998,12 @@ public class H5 implements java.io.Serializable { * @return An attribute identifier if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - Name is null. + * Name is null. **/ public static long H5Aopen(long obj_id, String attr_name, long aapl_id) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { long id = _H5Aopen(obj_id, attr_name, aapl_id); if (id > 0) { @@ -992,11 +1015,11 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Aopen(long obj_id, String attr_name, long aapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Aopen_by_idx opens an existing attribute that is attached to an object specified by location and name, loc_id - * and obj_name, respectively + * H5Aopen_by_idx opens an existing attribute that is attached to an object specified by location and + * name, loc_id and obj_name, respectively * * @param loc_id * IN: Location of object to which attribute is attached @@ -1016,12 +1039,13 @@ public class H5 implements java.io.Serializable { * @return An attribute identifier if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - Name is null. + * Name is null. **/ - public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id, - long lapl_id) throws HDF5LibraryException, NullPointerException + public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, + long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException { long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); if (id > 0) { @@ -1032,8 +1056,9 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, - long n, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + private synchronized static native long _H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, + int order, long n, long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aopen_by_name Opens an attribute for an object by object name and attribute name @@ -1052,12 +1077,12 @@ public class H5 implements java.io.Serializable { * @return Returns an attribute identifier if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - obj_name is null. + * obj_name is null. **/ - public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id) - throws HDF5LibraryException, NullPointerException + public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, + long lapl_id) throws HDF5LibraryException, NullPointerException { long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id); if (id > 0) { @@ -1069,7 +1094,8 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Aopen_by_name(long loc_id, String obj_name, String attr_name, - long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1087,12 +1113,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1108,11 +1135,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException + public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException { return H5Aread(attr_id, mem_type_id, buf, true); } @@ -1131,11 +1159,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) + throws HDF5Exception, HDF5LibraryException, NullPointerException { return H5Aread(attr_id, mem_type_id, obj, true); } @@ -1156,66 +1185,67 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Failure in the data conversion. + * Failure in the data conversion. * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. See public synchronized static native int H5Aread( ) + * data buffer is null. See public synchronized static native int H5Aread( ) **/ - public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) - throws HDF5Exception, HDF5LibraryException, NullPointerException + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, + boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - int status = -1; + int status = -1; boolean is1D = false; Class dataClass = obj.getClass(); if (!dataClass.isArray()) { - throw (new HDF5JavaException("H5Aread: data is not an array")); + throw(new HDF5JavaException("H5Aread: data is not an array")); } String cname = dataClass.getName(); - is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); - char dname = cname.charAt(cname.lastIndexOf("[") + 1); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname); if (is1D && (dname == 'B')) { log.trace("H5Aread_dname_B"); - status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + status = H5Aread(attr_id, mem_type_id, (byte[])obj, isCriticalPinning); } else if (is1D && (dname == 'S')) { log.trace("H5Aread_dname_S"); - status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + status = H5Aread_short(attr_id, mem_type_id, (short[])obj, isCriticalPinning); } else if (is1D && (dname == 'I')) { log.trace("H5Aread_dname_I"); - status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + status = H5Aread_int(attr_id, mem_type_id, (int[])obj, isCriticalPinning); } else if (is1D && (dname == 'J')) { log.trace("H5Aread_dname_J"); - status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + status = H5Aread_long(attr_id, mem_type_id, (long[])obj, isCriticalPinning); } else if (is1D && (dname == 'F')) { log.trace("H5Aread_dname_F"); - status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + status = H5Aread_float(attr_id, mem_type_id, (float[])obj, isCriticalPinning); } else if (is1D && (dname == 'D')) { log.trace("H5Aread_dname_D"); - status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + status = H5Aread_double(attr_id, mem_type_id, (double[])obj, isCriticalPinning); } else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && - (is1D && (dataClass.getComponentType() == String.class))) || - H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { + (is1D && (dataClass.getComponentType() == String.class))) || + H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { log.trace("H5Aread_reg_ref"); - status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj); + status = H5Aread_reg_ref(attr_id, mem_type_id, (String[])obj); } else if (is1D && (dataClass.getComponentType() == String.class)) { log.trace("H5Aread_string type"); - status = H5Aread_string(attr_id, mem_type_id, (String[]) obj); + status = H5Aread_string(attr_id, mem_type_id, (String[])obj); } else { // Create a data buffer to hold the data into a Java Array HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.emptyBytes(); + byte[] buf = theArray.emptyBytes(); log.trace("H5Aread_else"); // This will raise an exception if there is an error @@ -1227,7 +1257,7 @@ public class H5 implements java.io.Serializable { } // clean up these: assign 'null' as hint to gc() - buf = null; + buf = null; theArray = null; } @@ -1250,12 +1280,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1271,12 +1302,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Aread_double(attr_id, mem_type_id, buf, true); } @@ -1297,12 +1328,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1318,12 +1350,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Aread_float(attr_id, mem_type_id, buf, true); } @@ -1344,12 +1376,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1365,12 +1398,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Aread_int(attr_id, mem_type_id, buf, true); } @@ -1391,12 +1424,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1412,12 +1446,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Aread_long(attr_id, mem_type_id, buf, true); } @@ -1436,12 +1470,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1459,12 +1493,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1480,12 +1515,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Aread_short(attr_id, mem_type_id, buf, true); } @@ -1504,12 +1539,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1525,12 +1560,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1546,12 +1581,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1567,16 +1602,16 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Arename changes the name of attribute that is attached to the object specified by loc_id. The attribute named - * old_attr_name is renamed new_attr_name. + * H5Arename changes the name of attribute that is attached to the object specified by loc_id. The + *attribute named old_attr_name is renamed new_attr_name. * * @param loc_id * IN: Location or object identifier; may be dataset or group @@ -1588,16 +1623,16 @@ public class H5 implements java.io.Serializable { * @return A non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - Name is null. + * Name is null. **/ public synchronized static native int H5Arename(long loc_id, String old_attr_name, String new_attr_name) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Arename_by_name changes the name of attribute that is attached to the object specified by loc_id and obj_name. - * The attribute named old_attr_name is renamed new_attr_name. + * H5Arename_by_name changes the name of attribute that is attached to the object specified by loc_id and + * obj_name. The attribute named old_attr_name is renamed new_attr_name. * * @param loc_id * IN: Location or object identifier; may be dataset or group @@ -1613,12 +1648,13 @@ public class H5 implements java.io.Serializable { * @return A non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - Name is null. + * Name is null. **/ - public synchronized static native int H5Arename_by_name(long loc_id, String obj_name, String old_attr_name, - String new_attr_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int + H5Arename_by_name(long loc_id, String obj_name, String old_attr_name, String new_attr_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1636,12 +1672,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1657,12 +1694,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite(attr_id, mem_type_id, buf, true); } @@ -1681,12 +1718,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) - throws HDF5Exception, HDF5LibraryException, NullPointerException + throws HDF5Exception, HDF5LibraryException, NullPointerException { return H5Awrite(attr_id, mem_type_id, obj, true); } @@ -1707,55 +1744,56 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Failure in the data conversion. + * Failure in the data conversion. * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data object is null + * data object is null **/ - public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning) - throws HDF5Exception, HDF5LibraryException, NullPointerException + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, + boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - int status = -1; + int status = -1; boolean is1D = false; Class dataClass = obj.getClass(); if (!dataClass.isArray()) { - throw (new HDF5JavaException("H5Dwrite: data is not an array")); + throw(new HDF5JavaException("H5Dwrite: data is not an array")); } String cname = dataClass.getName(); - is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); - char dname = cname.charAt(cname.lastIndexOf("[") + 1); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); if (is1D && (dname == 'B')) { - status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning); + status = H5Awrite(attr_id, mem_type_id, (byte[])obj, isCriticalPinning); } else if (is1D && (dname == 'S')) { - status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning); + status = H5Awrite_short(attr_id, mem_type_id, (short[])obj, isCriticalPinning); } else if (is1D && (dname == 'I')) { - status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning); + status = H5Awrite_int(attr_id, mem_type_id, (int[])obj, isCriticalPinning); } else if (is1D && (dname == 'J')) { - status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning); + status = H5Awrite_long(attr_id, mem_type_id, (long[])obj, isCriticalPinning); } else if (is1D && (dname == 'F')) { - status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning); + status = H5Awrite_float(attr_id, mem_type_id, (float[])obj, isCriticalPinning); } else if (is1D && (dname == 'D')) { - status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning); + status = H5Awrite_double(attr_id, mem_type_id, (double[])obj, isCriticalPinning); } else if (is1D && (dataClass.getComponentType() == String.class)) { log.trace("H5Dwrite_string type"); - status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj); + status = H5Awrite_string(attr_id, mem_type_id, (String[])obj); } else { HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.byteify(); + byte[] buf = theArray.byteify(); - status = H5Awrite(attr_id, mem_type_id, buf); - buf = null; + status = H5Awrite(attr_id, mem_type_id, buf); + buf = null; theArray = null; } @@ -1778,12 +1816,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1799,12 +1838,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite_double(attr_id, mem_type_id, buf, true); } @@ -1825,12 +1864,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1846,12 +1886,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite_float(attr_id, mem_type_id, buf, true); } @@ -1872,12 +1912,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1893,12 +1934,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite_int(attr_id, mem_type_id, buf, true); } @@ -1919,12 +1960,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1940,12 +1982,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite_long(attr_id, mem_type_id, buf, true); } @@ -1966,12 +2008,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ - public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -1987,12 +2030,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf) - throws HDF5LibraryException, NullPointerException + throws HDF5LibraryException, NullPointerException { return H5Awrite_short(attr_id, mem_type_id, buf, true); } @@ -2011,12 +2054,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with @@ -2032,12 +2075,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data is null. + * data is null. **/ public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from @@ -2055,13 +2098,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Aget_create_plist retrieves a copy of the attribute creation property list identifier. @@ -2072,10 +2115,9 @@ public class H5 implements java.io.Serializable { * @return identifier for the attribute's creation property list if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Aget_create_plist(long attr_id) - throws HDF5LibraryException + public static long H5Aget_create_plist(long attr_id) throws HDF5LibraryException { long id = _H5Aget_create_plist(attr_id); if (id > 0) { @@ -2094,20 +2136,22 @@ public class H5 implements java.io.Serializable { * as defined below, is passed to a user-defined function, op, which operates on that attribute. * * @param loc_id - * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named + * datatype. * @param idx_type * IN: The type of index specified by idx_type can be one of the following: * H5_INDEX_NAME An alphanumeric index by attribute name. * H5_INDEX_CRT_ORDER An index by creation order. * @param order - * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: + * IN: The order in which the index is to be traversed, as specified by order, can be one of + * the following: * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration * incrementing the index position at each step. - * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration - * decrementing the index position at each step. - * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided - * as to the order, but HDF5 ensures that each element in the index will be - * visited if the iteration completes successfully. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up + * iteration decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is + * provided as to the order, but HDF5 ensures that each element in + * the index will be visited if the iteration completes successfully. * @param idx * IN/OUT: Initial and returned offset within index. * @param op @@ -2115,16 +2159,17 @@ public class H5 implements java.io.Serializable { * @param op_data * IN/OUT: Pointer to any user-efined data for use by operator function. * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Aiterate(long loc_id, int idx_type, int order, long idx, - H5A_iterate_cb op, H5A_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aiterate(long loc_id, int idx_type, int order, long idx, + H5A_iterate_cb op, H5A_iterate_t op_data) + throws HDF5LibraryException, NullPointerException; /** * H5Aiterate_by_name iterates over the attributes attached to the dataset or group specified with loc_id @@ -2132,7 +2177,8 @@ public class H5 implements java.io.Serializable { * below, is passed to a user-defined function, op, which operates on that attribute. * * @param loc_id - * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named + * datatype. * @param obj_name * IN: Name of object, relative to location. * @param idx_type @@ -2140,14 +2186,15 @@ public class H5 implements java.io.Serializable { * H5_INDEX_NAME An alphanumeric index by attribute name. * H5_INDEX_CRT_ORDER An index by creation order. * @param order - * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: - * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration - * incrementing the index position at each step. - * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration - * decrementing the index position at each step. - * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided - * as to the order, but HDF5 ensures that each element in the index will be - * visited if the iteration completes successfully. + * IN: The order in which the index is to be traversed, as specified by order, can be one of + * the following: + * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down + * iteration incrementing the index position at each step. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration + * decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided + * as to the order, but HDF5 ensures that each element in the index will be + * visited if the iteration completes successfully. * @param idx * IN/OUT: Initial and returned offset within index. * @param op @@ -2157,16 +2204,18 @@ public class H5 implements java.io.Serializable { * @param lapl_id * IN: Link access property list * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Aiterate_by_name(long loc_id, String obj_name, int idx_type, - int order, long idx, H5A_iterate_cb op, H5A_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Aiterate_by_name(long loc_id, String obj_name, int idx_type, + int order, long idx, H5A_iterate_cb op, + H5A_iterate_t op_data, long lapl_id) + throws HDF5LibraryException, NullPointerException; // //////////////////////////////////////////////////////////// // // @@ -2217,7 +2266,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Dcopy(long src_did, long dst_did) throws HDF5LibraryException; @@ -2230,9 +2279,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Dclose(long dataset_id) throws HDF5LibraryException { + public static int H5Dclose(long dataset_id) throws HDF5LibraryException + { if (dataset_id < 0) return 0; // throw new HDF5LibraryException("Negative ID"); @@ -2265,12 +2315,13 @@ public class H5 implements java.io.Serializable { * @return a dataset identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Dcreate(long loc_id, String name, long type_id, long space_id, long lcpl_id, long dcpl_id, - long dapl_id) throws HDF5LibraryException, NullPointerException { + public static long H5Dcreate(long loc_id, String name, long type_id, long space_id, long lcpl_id, + long dcpl_id, long dapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Dcreate2(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Dcreate add {}", id); @@ -2283,11 +2334,12 @@ public class H5 implements java.io.Serializable { /** * H5Dcreate2 creates a new dataset named name at the location specified by loc_id. * - * @see public static int H5Dcreate(int loc_id, String name, int type_id, int space_id, int lcpl_id, int dcpl_id, - * int dapl_id) + * @see public static int H5Dcreate(int loc_id, String name, int type_id, int space_id, int lcpl_id, int + * dcpl_id, int dapl_id) **/ private synchronized static native long _H5Dcreate2(long loc_id, String name, long type_id, long space_id, - long lcpl_id, long dcpl_id, long dapl_id) throws HDF5LibraryException, NullPointerException; + long lcpl_id, long dcpl_id, long dapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Dcreate_anon creates a dataset in the file specified by loc_id. @@ -2306,10 +2358,11 @@ public class H5 implements java.io.Serializable { * @return a dataset identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public static long H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, long dapl_id) - throws HDF5LibraryException { + throws HDF5LibraryException + { long id = _H5Dcreate_anon(loc_id, type_id, space_id, dcpl_id, dapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Dcreate_anon add {}", id); @@ -2319,11 +2372,13 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, - long dapl_id) throws HDF5LibraryException; + private synchronized static native long _H5Dcreate_anon(long loc_id, long type_id, long space_id, + long dcpl_id, long dapl_id) + throws HDF5LibraryException; /** - * H5Dfill explicitly fills the dataspace selection in memory, space_id, with the fill value specified in fill. + * H5Dfill explicitly fills the dataspace selection in memory, space_id, with the fill value specified in + * fill. * * @param fill * IN: Pointer to the fill value to be used. @@ -2337,12 +2392,13 @@ public class H5 implements java.io.Serializable { * IN: Dataspace describing memory buffer and containing the selection to be filled. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native void H5Dfill(byte[] fill, long fill_type, byte[] buf, long buf_type, long space_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Dfill(byte[] fill, long fill_type, byte[] buf, long buf_type, + long space_id) + throws HDF5LibraryException, NullPointerException; /** * H5Dget_access_plist returns an identifier for a copy of the dataset access property list for a dataset. @@ -2353,21 +2409,23 @@ public class H5 implements java.io.Serializable { * @return a dataset access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Dget_access_plist(long dset_id) throws HDF5LibraryException; /** - * H5Dget_create_plist returns an identifier for a copy of the dataset creation property list for a dataset. + * H5Dget_create_plist returns an identifier for a copy of the dataset creation property list for a + * dataset. * * @param dataset_id * Identifier of the dataset to query. * @return a dataset creation property list identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Dget_create_plist(long dataset_id) throws HDF5LibraryException { + public static long H5Dget_create_plist(long dataset_id) throws HDF5LibraryException + { long id = _H5Dget_create_plist(dataset_id); if (id > 0) { log.trace("OPEN_IDS: H5Dget_create_plist add {}", id); @@ -2388,7 +2446,7 @@ public class H5 implements java.io.Serializable { * @return the offset in bytes. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Dget_offset(long dset_id) throws HDF5LibraryException; @@ -2401,9 +2459,10 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Dget_space(long dataset_id) throws HDF5LibraryException { + public static long H5Dget_space(long dataset_id) throws HDF5LibraryException + { long id = _H5Dget_space(dataset_id); if (id > 0) { log.trace("OPEN_IDS: H5Dget_space add {}", id); @@ -2424,7 +2483,7 @@ public class H5 implements java.io.Serializable { * @return the space allocation status * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Dget_space_status(long dset_id) throws HDF5LibraryException; @@ -2437,10 +2496,10 @@ public class H5 implements java.io.Serializable { * @return he amount of storage space allocated for the dataset. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Dget_storage_size(long dataset_id) throws HDF5LibraryException, - IllegalArgumentException; + public synchronized static native long H5Dget_storage_size(long dataset_id) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Dget_type returns an identifier for a copy of the datatype for a dataset. @@ -2451,9 +2510,10 @@ public class H5 implements java.io.Serializable { * @return a datatype identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Dget_type(long dataset_id) throws HDF5LibraryException { + public static long H5Dget_type(long dataset_id) throws HDF5LibraryException + { long id = _H5Dget_type(dataset_id); if (id > 0) { log.trace("OPEN_IDS: H5Dget_type add {}", id); @@ -2466,8 +2526,8 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Dget_type(long dataset_id) throws HDF5LibraryException; /** - * H5Diterate iterates over all the data elements in the memory buffer buf, executing the callback function operator - * once for each such data element. + * H5Diterate iterates over all the data elements in the memory buffer buf, executing the callback + * function operator once for each such data element. * * @param buf * IN/OUT: Pointer to the memory containing the elements to iterate over. @@ -2480,19 +2540,21 @@ public class H5 implements java.io.Serializable { * @param op_data * IN/OUT: Pointer to any user-efined data for use by operator function. * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Diterate(byte[] buf, long buf_type, long space_id, H5D_iterate_cb op, - H5D_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Diterate(byte[] buf, long buf_type, long space_id, + H5D_iterate_cb op, H5D_iterate_t op_data) + throws HDF5LibraryException, NullPointerException; /** - * H5Dopen opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * H5Dopen opens the existing dataset specified by a location identifier and name, loc_id and name, + * respectively. * * @param loc_id * IN: Location identifier @@ -2504,11 +2566,12 @@ public class H5 implements java.io.Serializable { * @return a dataset identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException + public static long H5Dopen(long loc_id, String name, long dapl_id) + throws HDF5LibraryException, NullPointerException { long id = _H5Dopen2(loc_id, name, dapl_id); if (id > 0) { @@ -2520,16 +2583,17 @@ public class H5 implements java.io.Serializable { } /** - * H5Dopen2 opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * H5Dopen2 opens the existing dataset specified by a location identifier and name, loc_id and name, + * respectively. * * @see public static int H5Dopen(int loc_id, String name, int dapl_id) **/ private synchronized static native long _H5Dopen2(long loc_id, String name, long dapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer buf. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer buf. * * @param dataset_id * Identifier of the dataset read from. @@ -2549,17 +2613,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, byte[] obj, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, byte[] obj, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer buf. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer buf. * * @param dataset_id * Identifier of the dataset read from. @@ -2577,19 +2642,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer buf. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer buf. * * @param dataset_id * Identifier of the dataset read from. @@ -2607,19 +2673,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object obj) + throws HDF5Exception, HDF5LibraryException, NullPointerException { return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * data object. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application data object. * * @param dataset_id * Identifier of the dataset read from. @@ -2639,87 +2706,88 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Failure in the data conversion. + * Failure in the data conversion. * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data object is null. + * data object is null. **/ - public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object obj, + boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - int status = -1; + int status = -1; boolean is1D = false; Class dataClass = obj.getClass(); if (!dataClass.isArray()) { - throw (new HDF5JavaException("H5Dread: data is not an array")); + throw(new HDF5JavaException("H5Dread: data is not an array")); } String cname = dataClass.getName(); - is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); - char dname = cname.charAt(cname.lastIndexOf("[") + 1); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); log.trace("H5Dread: cname={} is1D={} dname={}", cname, is1D, dname); if (is1D && (dname == 'B')) { log.trace("H5Dread_dname_B"); - status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, - isCriticalPinning); + status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[])obj, + isCriticalPinning); } else if (is1D && (dname == 'S')) { log.trace("H5Dread_dname_S"); - status = H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, - isCriticalPinning); + status = H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (short[])obj, isCriticalPinning); } else if (is1D && (dname == 'I')) { log.trace("H5Dread_dname_I"); - status = H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, - isCriticalPinning); + status = H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (int[])obj, isCriticalPinning); } else if (is1D && (dname == 'J')) { log.trace("H5Dread_dname_J"); - status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, - isCriticalPinning); + status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (long[])obj, isCriticalPinning); } else if (is1D && (dname == 'F')) { log.trace("H5Dread_dname_F"); - status = H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, - isCriticalPinning); + status = H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (float[])obj, isCriticalPinning); } else if (is1D && (dname == 'D')) { log.trace("H5Dread_dname_D"); status = H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (double[]) obj, isCriticalPinning); + (double[])obj, isCriticalPinning); } else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && - (is1D && (dataClass.getComponentType() == String.class))) || - H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { + (is1D && (dataClass.getComponentType() == String.class))) || + H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { log.trace("H5Dread_reg_ref"); status = H5Dread_reg_ref(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (String[]) obj); + (String[])obj); } else if (is1D && (dataClass.getComponentType() == String.class)) { log.trace("H5Dread_string type"); status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (String[]) obj); + (String[])obj); } else { // Create a data buffer to hold the data into a Java Array HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.emptyBytes(); + byte[] buf = theArray.emptyBytes(); log.trace("H5Dread_else"); // will raise exception if read fails status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, - isCriticalPinning); + isCriticalPinning); if (status >= 0) { // convert the data into a Java Array obj = theArray.arrayify(buf); } // clean up these: assign 'null' as hint to gc() - buf = null; + buf = null; theArray = null; } @@ -2727,8 +2795,8 @@ public class H5 implements java.io.Serializable { } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of type double. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of type double. * * @param dataset_id * Identifier of the dataset read from. @@ -2748,17 +2816,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, double[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of type double. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of type double. * * @param dataset_id * Identifier of the dataset read from. @@ -2776,19 +2845,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, double[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of float. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of float. * * @param dataset_id * Identifier of the dataset read from. @@ -2808,17 +2878,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, float[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of float. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of float. * * @param dataset_id * Identifier of the dataset read from. @@ -2836,19 +2907,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, float[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of int. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of int. * * @param dataset_id * Identifier of the dataset read from. @@ -2868,17 +2940,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, int[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of int. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of int. * * @param dataset_id * Identifier of the dataset read from. @@ -2896,19 +2969,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, int[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of long. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of long. * * @param dataset_id * Identifier of the dataset read from. @@ -2928,17 +3002,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, long[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of long. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of long. * * @param dataset_id * Identifier of the dataset read from. @@ -2956,19 +3031,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, long[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of string. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of string. * * @param dataset_id * Identifier of the dataset read from. @@ -2986,16 +3062,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, + long mem_space_id, long file_space_id, + long xfer_plist_id, String[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of short. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of short. * * @param dataset_id * Identifier of the dataset read from. @@ -3015,17 +3093,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, short[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of short. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of short. * * @param dataset_id * Identifier of the dataset read from. @@ -3043,19 +3122,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, short[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of variable-lenght. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of variable-lenght. * * @param dataset_id * Identifier of the dataset read from. @@ -3073,16 +3153,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5DreadVL(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of string. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of string. * * @param dataset_id * Identifier of the dataset read from. @@ -3100,16 +3181,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ public synchronized static native int H5Dread_string(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, String[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application - * memory buffer of variable-lenght strings. + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the + * application memory buffer of variable-lenght strings. * * @param dataset_id * Identifier of the dataset read from. @@ -3127,15 +3209,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data buffer is null. + * data buffer is null. **/ - public synchronized static native int H5Dread_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Dread_VLStrings(long dataset_id, long mem_type_id, + long mem_space_id, long file_space_id, + long xfer_plist_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dset_extent sets the current dimensions of the chunked dataset dset_id to the sizes specified in size. + * H5Dset_extent sets the current dimensions of the chunked dataset dset_id to the sizes specified in + * size. * * @param dset_id * IN: Chunked dataset identifier. @@ -3143,17 +3228,17 @@ public class H5 implements java.io.Serializable { * IN: Array containing the new magnitude of each dimension of the dataset. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. **/ - public synchronized static native void H5Dset_extent(long dset_id, long size[]) throws HDF5LibraryException, - NullPointerException; + public synchronized static native void H5Dset_extent(long dset_id, long size[]) + throws HDF5LibraryException, NullPointerException; /** - * H5Dvlen_get_buf_size determines the number of bytes required to store the VL data from the dataset, using the - * space_id for the selection in the dataset on disk and the type_id for the memory representation of the VL data in - * memory. + * H5Dvlen_get_buf_size determines the number of bytes required to store the VL data from the dataset, + * using the space_id for the selection in the dataset on disk and the type_id for the memory + * representation of the VL data in memory. * * @param dset_id * IN: Identifier of the dataset read from. @@ -3165,12 +3250,12 @@ public class H5 implements java.io.Serializable { * @return the size in bytes of the memory buffer required to store the VL data. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ public synchronized static native long H5Dvlen_get_buf_size(long dset_id, long type_id, long space_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Dvlen_reclaim reclaims buffer used for VL data. @@ -3187,19 +3272,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. * * @deprecated As of HDF5 1.12.0 in favor of H5Treclaim **/ @Deprecated - public synchronized static native int H5Dvlen_reclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Dvlen_reclaim(long type_id, long space_id, long xfer_plist_id, + byte[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3219,17 +3305,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, byte[] buf, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, byte[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3247,19 +3334,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3277,19 +3365,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object obj) + throws HDF5Exception, HDF5LibraryException, NullPointerException { return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory data - * object into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory data object into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3309,67 +3398,68 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Failure in the data conversion. + * Failure in the data conversion. * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - data object is null. + * data object is null. **/ - public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, - long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, - NullPointerException + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object obj, + boolean isCriticalPinning) + throws HDF5Exception, HDF5LibraryException, NullPointerException { - int status = -1; + int status = -1; boolean is1D = false; Class dataClass = obj.getClass(); if (!dataClass.isArray()) { - throw (new HDF5JavaException("H5Dwrite: data is not an array")); + throw(new HDF5JavaException("H5Dwrite: data is not an array")); } String cname = dataClass.getName(); - is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); - char dname = cname.charAt(cname.lastIndexOf("[") + 1); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); if (is1D && (dname == 'B')) { - status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, - isCriticalPinning); + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (byte[])obj, isCriticalPinning); } else if (is1D && (dname == 'S')) { - status = H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, - isCriticalPinning); + status = H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (short[])obj, isCriticalPinning); } else if (is1D && (dname == 'I')) { - status = H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, - isCriticalPinning); + status = H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (int[])obj, isCriticalPinning); } else if (is1D && (dname == 'J')) { - status = H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, - isCriticalPinning); + status = H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (long[])obj, isCriticalPinning); } else if (is1D && (dname == 'F')) { - status = H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, - isCriticalPinning); + status = H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (float[])obj, isCriticalPinning); } else if (is1D && (dname == 'D')) { status = H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (double[]) obj, isCriticalPinning); + (double[])obj, isCriticalPinning); } else if (is1D && (dataClass.getComponentType() == String.class)) { log.trace("H5Dwrite_string type"); status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, - (String[]) obj); + (String[])obj); } else { HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.byteify(); + byte[] buf = theArray.byteify(); // will raise exception on error status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, - isCriticalPinning); + isCriticalPinning); // clean up these: assign 'null' as hint to gc() - buf = null; + buf = null; theArray = null; } @@ -3377,8 +3467,8 @@ public class H5 implements java.io.Serializable { } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3398,17 +3488,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int + H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3426,19 +3517,21 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, double[] buf) + throws HDF5LibraryException, NullPointerException { - return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, + true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3458,17 +3551,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, float[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3486,19 +3580,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, float[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3518,17 +3613,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, int[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3546,19 +3642,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, int[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3578,17 +3675,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, - NullPointerException; + long file_space_id, long xfer_plist_id, long[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3606,19 +3704,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, long[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3638,17 +3737,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) - throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, short[] buf, + boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3666,19 +3766,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException + long file_space_id, long xfer_plist_id, short[] buf) + throws HDF5LibraryException, NullPointerException { return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); } /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3696,16 +3797,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, + long mem_space_id, long file_space_id, + long xfer_plist_id, String[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer - * into the file. + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application + * memory buffer into the file. * * @param dataset_id * Identifier of the dataset read from. @@ -3723,16 +3826,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5DwriteVL(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + long file_space_id, long xfer_plist_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from - * the application memory buffer buf into the file. + * H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier + * dataset_id, from the application memory buffer buf into the file. * * ---- contributed by Rosetta Biosoftware * @@ -3752,48 +3856,52 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Dwrite_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, - long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Dwrite_VLStrings(long dataset_id, long mem_type_id, + long mem_space_id, long file_space_id, + long xfer_plist_id, Object[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Dflush causes all buffers associated with a dataset to be immediately flushed to disk without removing the - * data from the cache. + * H5Dflush causes all buffers associated with a dataset to be immediately flushed to disk without + * removing the data from the cache. * * @param dset_id * IN: Identifier of the dataset to be flushed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Dflush(long dset_id) throws HDF5LibraryException; /** - * H5Drefresh causes all buffers associated with a dataset to be cleared and immediately re-loaded with updated - * contents from disk. This function essentially closes the dataset, evicts all metadata associated with it - * from the cache, and then re-opens the dataset. The reopened dataset is automatically re-registered with the same ID. + * H5Drefresh causes all buffers associated with a dataset to be cleared and immediately re-loaded with + * updated contents from disk. This function essentially closes the dataset, evicts all metadata + * associated with it from the cache, and then re-opens the dataset. The reopened dataset is automatically + * re-registered with the same ID. * * @param dset_id * IN: Identifier of the dataset to be refreshed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException; // /////// unimplemented //////// - // herr_t H5Ddebug(hid_t dset_id); - // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); - // herr_t H5Dformat_convert(hid_t dset_id); - // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); + // herr_t H5Ddebug(hid_t dset_id); + // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes); + // herr_t H5Dformat_convert(hid_t dset_id); + // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); // herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, // size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); - // herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf); + // herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void + // *dst_buf); // //////////////////////////////////////////////////////////// // // @@ -3802,58 +3910,57 @@ public class H5 implements java.io.Serializable { // //////////////////////////////////////////////////////////// /** - * H5Eauto_is_v2 determines whether the error auto reporting function for an error stack conforms to the H5E_auto2_t - * typedef or the H5E_auto1_t typedef. + * H5Eauto_is_v2 determines whether the error auto reporting function for an error stack conforms to the + * H5E_auto2_t typedef or the H5E_auto1_t typedef. * * @param stack_id * IN: Error stack identifier. * - * @return boolean true if the error stack conforms to H5E_auto2_t and false if it conforms to H5E_auto1_t. + * @return boolean true if the error stack conforms to H5E_auto2_t and false if it conforms to + * H5E_auto1_t. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Eauto_is_v2(long stack_id) throws HDF5LibraryException; /** - * H5Eclear clears the error stack for the current thread. H5Eclear can fail if there are problems initializing the - * library. - * <p> - * This may be used by exception handlers to assure that the error condition in the HDF-5 library has been reset. + * H5Eclear clears the error stack for the current thread. H5Eclear can fail if there are problems + * initializing the library. <p> This may be used by exception handlers to assure that the error condition + * in the HDF-5 library has been reset. * * @return Returns a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Eclear() throws HDF5LibraryException { + public static int H5Eclear() throws HDF5LibraryException + { H5Eclear2(HDF5Constants.H5E_DEFAULT); return 0; } /** - * H5Eclear clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack - * for the current thread. + * H5Eclear clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the + * error stack for the current thread. * * @param stack_id * IN: Error stack identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static void H5Eclear(long stack_id) throws HDF5LibraryException { - H5Eclear2(stack_id); - } + public static void H5Eclear(long stack_id) throws HDF5LibraryException { H5Eclear2(stack_id); } /** - * H5Eclear2 clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack - * for the current thread. + * H5Eclear2 clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the + * error stack for the current thread. * * @param stack_id * IN: Error stack identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Eclear2(long stack_id) throws HDF5LibraryException; @@ -3864,7 +3971,7 @@ public class H5 implements java.io.Serializable { * IN: Error message identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Eclose_msg(long err_id) throws HDF5LibraryException; @@ -3875,7 +3982,7 @@ public class H5 implements java.io.Serializable { * IN: Error stack identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Eclose_stack(long stack_id) throws HDF5LibraryException; @@ -3892,12 +3999,12 @@ public class H5 implements java.io.Serializable { * @return a message identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - msg is null. + * msg is null. **/ public synchronized static native long H5Ecreate_msg(long cls_id, int msg_type, String msg) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Ecreate_stack creates a new empty error stack and returns the new stack's identifier. @@ -3905,7 +4012,7 @@ public class H5 implements java.io.Serializable { * @return an error stack identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Ecreate_stack() throws HDF5LibraryException; @@ -3918,30 +4025,31 @@ public class H5 implements java.io.Serializable { * @return the name of the error class * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native String H5Eget_class_name(long class_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Eget_current_stack copies the current error stack and returns an error stack identifier for the new copy. + * H5Eget_current_stack copies the current error stack and returns an error stack identifier for the new + * copy. * * @return an error stack identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Eget_current_stack() throws HDF5LibraryException; /** - * H5Eset_current_stack replaces the content of the current error stack with a copy of the content of the error - * stack specified by estack_id. + * H5Eset_current_stack replaces the content of the current error stack with a copy of the content of the + * error stack specified by estack_id. * * @param stack_id * IN: Error stack identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Eset_current_stack(long stack_id) throws HDF5LibraryException; @@ -3956,13 +4064,14 @@ public class H5 implements java.io.Serializable { * @return the error message * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5Eget_msg(long msg_id, int[] type_list) throws HDF5LibraryException; + public synchronized static native String H5Eget_msg(long msg_id, int[] type_list) + throws HDF5LibraryException; /** - * H5Eget_num retrieves the number of error records in the error stack specified by estack_id (including major, - * minor messages and description). + * H5Eget_num retrieves the number of error records in the error stack specified by estack_id (including + * major, minor messages and description). * * @param stack_id * IN: Error stack identifier. @@ -3970,26 +4079,29 @@ public class H5 implements java.io.Serializable { * @return the number of error messages * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Eget_num(long stack_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native long H5Eget_num(long stack_id) + throws HDF5LibraryException, NullPointerException; /** * H5Eprint2 prints the error stack specified by estack_id on the specified stream, stream. * * @param stack_id - * IN: Error stack identifier.If the identifier is H5E_DEFAULT, the current error stack will be printed. + * IN: Error stack identifier.If the identifier is H5E_DEFAULT, the current error stack will be + * printed. * @param stream * IN: File pointer, or stderr if null. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Eprint2(long stack_id, Object stream) throws HDF5LibraryException; + public synchronized static native void H5Eprint2(long stack_id, Object stream) + throws HDF5LibraryException; /** - * H5Epop deletes the number of error records specified in count from the top of the error stack specified by - * estack_id (including major, minor messages and description). + * H5Epop deletes the number of error records specified in count from the top of the error stack specified + * by estack_id (including major, minor messages and description). * * @param stack_id * IN: Error stack identifier. @@ -3997,11 +4109,10 @@ public class H5 implements java.io.Serializable { * IN: Version of the client library or application to which the error class belongs. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Epop(long stack_id, long count) throws HDF5LibraryException; - /** * H5Epush pushes a new error record onto the error stack specified by estack_id. * @@ -4023,14 +4134,14 @@ public class H5 implements java.io.Serializable { * IN: Error description string. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - file, func, or msg is null. - **/ - public static void H5Epush(long stack_id, String file, String func, int line, - long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException + * file, func, or msg is null. + **/ + public static void H5Epush(long stack_id, String file, String func, int line, long cls_id, long maj_id, + long min_id, String msg) throws HDF5LibraryException, NullPointerException { - H5Epush2(stack_id, file, func, line, cls_id, maj_id, min_id, msg); + H5Epush2(stack_id, file, func, line, cls_id, maj_id, min_id, msg); } /** * H5Epush2 pushes a new error record onto the error stack specified by estack_id. @@ -4053,16 +4164,17 @@ public class H5 implements java.io.Serializable { * IN: Error description string. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - file, func, or msg is null. - **/ + * file, func, or msg is null. + **/ public synchronized static native void H5Epush2(long stack_id, String file, String func, int line, - long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException; + long cls_id, long maj_id, long min_id, String msg) + throws HDF5LibraryException, NullPointerException; /** - * H5Eregister_class registers a client library or application program to the HDF5 error API so that the client - * library or application program can report errors together with HDF5 library. + * H5Eregister_class registers a client library or application program to the HDF5 error API so that the + * client library or application program can report errors together with HDF5 library. * * @param cls_name * IN: Name of the error class. @@ -4074,12 +4186,12 @@ public class H5 implements java.io.Serializable { * @return a class identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native long H5Eregister_class(String cls_name, String lib_name, String version) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Eunregister_class removes the error class specified by class_id. @@ -4088,7 +4200,7 @@ public class H5 implements java.io.Serializable { * IN: Error class identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Eunregister_class(long class_id) throws HDF5LibraryException; @@ -4106,13 +4218,14 @@ public class H5 implements java.io.Serializable { * IN: Data to be passed with func. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - func is null. + * func is null. **/ - public static void H5Ewalk(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) throws HDF5LibraryException, NullPointerException + public static void H5Ewalk(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) + throws HDF5LibraryException, NullPointerException { - H5Ewalk2(stack_id, direction, func, client_data); + H5Ewalk2(stack_id, direction, func, client_data); } /** * H5Ewalk2 walks the error stack specified by estack_id for the current thread and calls the @@ -4128,12 +4241,13 @@ public class H5 implements java.io.Serializable { * IN: Data to be passed with func. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - func is null. + * func is null. **/ - public synchronized static native void H5Ewalk2(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Ewalk2(long stack_id, long direction, H5E_walk_cb func, + H5E_walk_t client_data) + throws HDF5LibraryException, NullPointerException; // /////// unimplemented //////// // public interface H5E_auto2_t extends Callback @@ -4176,9 +4290,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Fclose(long file_id) throws HDF5LibraryException { + public static int H5Fclose(long file_id) throws HDF5LibraryException + { if (file_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -4203,12 +4318,13 @@ public class H5 implements java.io.Serializable { * @return a file identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Fopen(String name, int flags, long access_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Fopen(String name, int flags, long access_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Fopen(name, flags, access_id); if (id > 0) { log.trace("OPEN_IDS: H5Fopen add {}", id); @@ -4219,7 +4335,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Fopen(String name, int flags, long access_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Freopen reopens an HDF5 file. @@ -4227,11 +4343,13 @@ public class H5 implements java.io.Serializable { * @param file_id * Identifier of a file to terminate and reopen access to. * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. * @return a new file identifier if successful + * + * @exception HDF5LibraryException + * Error from the HDF-5 Library. **/ - public static long H5Freopen(long file_id) throws HDF5LibraryException { + public static long H5Freopen(long file_id) throws HDF5LibraryException + { long id = _H5Freopen(file_id); if (id > 0) { log.trace("OPEN_IDS: H5Freopen add {}", id); @@ -4256,7 +4374,8 @@ public class H5 implements java.io.Serializable { * <LI> * H5F_ACC_RDONLY Allow read-only access to file.</LI> * <LI> - * H5F_ACC_TRUNC Truncate file, if it already exists, erasing all data previously stored in the file.</LI> + * H5F_ACC_TRUNC Truncate file, if it already exists, erasing all data previously stored in the + * file.</LI> * <LI> * H5F_ACC_EXCL Fail if file already exists.</LI> * <LI> @@ -4264,22 +4383,23 @@ public class H5 implements java.io.Serializable { * </UL> * * @param create_id - * File creation property list identifier, used when modifying default file meta-data. Use H5P_DEFAULT - * for default access properties. + * File creation property list identifier, used when modifying default file meta-data. Use + * H5P_DEFAULT for default access properties. * @param access_id - * File access property list identifier. If parallel file access is desired, this is a collective call - * according to the communicator stored in the access_id (not supported in Java). Use H5P_DEFAULT for - * default access properties. + * File access property list identifier. If parallel file access is desired, this is a + * collective call according to the communicator stored in the access_id (not supported + * in Java). Use H5P_DEFAULT for default access properties. * * @return a file identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Fcreate(String name, int flags, long create_id, long access_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Fcreate(String name, int flags, long create_id, long access_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Fcreate(name, flags, create_id, access_id); if (id > 0) { log.trace("OPEN_IDS: H5Fcreate add {}", id); @@ -4290,34 +4410,30 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Fcreate(String name, int flags, long create_id, long access_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Fflush causes all buffers associated with a file or object to be immediately flushed (written) to disk without - * removing the data from the (memory) cache. - * <P> - * After this call completes, the file (or object) is in a consistent state and all data written to date is assured - * to be permanent. + * H5Fflush causes all buffers associated with a file or object to be immediately flushed (written) to + * disk without removing the data from the (memory) cache. <P> After this call completes, the file (or + * object) is in a consistent state and all data written to date is assured to be permanent. * * @param object_id - * Identifier of object used to identify the file. <b>object_id</b> can be any object associated with the - * file, including the file itself, a dataset, a group, an attribute, or a named data type. + * Identifier of object used to identify the file. <b>object_id</b> can be any object + * associated with the file, including the file itself, a dataset, a group, an attribute, + * or a named data type. * @param scope - * specifies the scope of the flushing action, in the case that the HDF-5 file is not a single physical - * file. - * <P> - * Valid values are: + * specifies the scope of the flushing action, in the case that the HDF-5 file is not a single + * physical file. + * <P> Valid values are: * <UL> - * <LI> - * H5F_SCOPE_GLOBAL Flushes the entire virtual file.</LI> - * <LI> - * H5F_SCOPE_LOCAL Flushes only the specified file.</LI> + * <LI> H5F_SCOPE_GLOBAL Flushes the entire virtual file.</LI> + * <LI> H5F_SCOPE_LOCAL Flushes only the specified file.</LI> * </UL> * * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Fflush(long object_id, int scope) throws HDF5LibraryException; @@ -4330,9 +4446,10 @@ public class H5 implements java.io.Serializable { * @return a file access property list identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Fget_access_plist(long file_id) throws HDF5LibraryException { + public static long H5Fget_access_plist(long file_id) throws HDF5LibraryException + { long id = _H5Fget_access_plist(file_id); if (id > 0) { log.trace("OPEN_IDS: H5Fget_access_plist add {}", id); @@ -4345,8 +4462,8 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Fget_access_plist(long file_id) throws HDF5LibraryException; /** - * H5Fget_create_plist returns a file creation property list identifier identifying the creation properties used to - * create this file. + * H5Fget_create_plist returns a file creation property list identifier identifying the creation + * properties used to create this file. * * @param file_id * Identifier of the file to get creation property list @@ -4354,9 +4471,10 @@ public class H5 implements java.io.Serializable { * @return a file creation property list identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Fget_create_plist(long file_id) throws HDF5LibraryException { + public static long H5Fget_create_plist(long file_id) throws HDF5LibraryException + { long id = _H5Fget_create_plist(file_id); if (id > 0) { log.trace("OPEN_IDS: H5Fget_create_plist add {}", id); @@ -4379,7 +4497,7 @@ public class H5 implements java.io.Serializable { * @return the file size of the HDF5 file * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Fget_filesize(long file_id) throws HDF5LibraryException; @@ -4392,7 +4510,7 @@ public class H5 implements java.io.Serializable { * @return the amount of free space in the file * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Fget_freespace(long file_id) throws HDF5LibraryException; @@ -4405,7 +4523,7 @@ public class H5 implements java.io.Serializable { * @return the intended access mode flag, as originally passed with H5Fopen. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException; @@ -4418,13 +4536,13 @@ public class H5 implements java.io.Serializable { * @return the unique file number for the file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Fget_fileno(long file_id) throws HDF5LibraryException; /** - * H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache - * hits + cache misses)) since the last time hit rate statistics were reset. + * H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / + * (cache hits + cache misses)) since the last time hit rate statistics were reset. * * @param file_id * IN: Identifier of the target file. @@ -4432,7 +4550,7 @@ public class H5 implements java.io.Serializable { * @return the double in which the hit rate is returned. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native double H5Fget_mdc_hit_rate(long file_id) throws HDF5LibraryException; @@ -4452,12 +4570,12 @@ public class H5 implements java.io.Serializable { * @return current number of entries in the cache * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - metadata_cache is null. + * metadata_cache is null. **/ public synchronized static native int H5Fget_mdc_size(long file_id, long[] metadata_cache) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Fget_name retrieves the name of the file to which the object obj_id belongs. @@ -4468,7 +4586,7 @@ public class H5 implements java.io.Serializable { * @return the filename. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native String H5Fget_name(long obj_id) throws HDF5LibraryException; @@ -4492,12 +4610,14 @@ public class H5 implements java.io.Serializable { * @return the number of open objects. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Fget_obj_count(long file_id, int types) throws HDF5LibraryException; + public synchronized static native long H5Fget_obj_count(long file_id, int types) + throws HDF5LibraryException; /** - * H5Fget_obj_ids returns the list of identifiers for all open HDF5 objects fitting the specified criteria. + * H5Fget_obj_ids returns the list of identifiers for all open HDF5 objects fitting the specified + * criteria. * * @param file_id * IN: File identifier for a currently-open HDF5 file @@ -4511,12 +4631,13 @@ public class H5 implements java.io.Serializable { * @return the number of objects placed into obj_id_list. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - obj_id_list is null. + * obj_id_list is null. **/ - public synchronized static native long H5Fget_obj_ids(long file_id, int types, long max_objs, long[] obj_id_list) - throws HDF5LibraryException, NullPointerException; + public synchronized static native long H5Fget_obj_ids(long file_id, int types, long max_objs, + long[] obj_id_list) + throws HDF5LibraryException, NullPointerException; /** * H5Fis_hdf5 determines whether a file is in the HDF5 format. @@ -4527,14 +4648,15 @@ public class H5 implements java.io.Serializable { * @return true if is HDF-5, false if not. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. * * @deprecated As of HDF5 1.10.5 in favor of H5Fis_accessible. **/ @Deprecated - public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Fis_hdf5(String name) + throws HDF5LibraryException, NullPointerException; /** * H5Fis_accessible determines if the file can be opened with the given fapl. @@ -4547,15 +4669,16 @@ public class H5 implements java.io.Serializable { * @return true if file is accessible, false if not. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native boolean H5Fis_accessible(String name, long file_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Fis_accessible(String name, long file_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount - * properties plist_id. + * H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the + * mount properties plist_id. * * @param loc_id * The identifier for the group onto which the file specified by child_id is to be mounted. @@ -4569,12 +4692,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Fmount(long loc_id, String name, long child_id, long plist_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * Given a mount point, H5Funmount disassociates the mount point's file from the file mounted there. @@ -4587,24 +4710,25 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Funmount(long loc_id, String name) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Funmount(long loc_id, String name) + throws HDF5LibraryException, NullPointerException; /** - * H5Freset_mdc_hit_rate_stats resets the hit rate statistics counters in the metadata cache associated with the - * specified file. + * H5Freset_mdc_hit_rate_stats resets the hit rate statistics counters in the metadata cache associated + * with the specified file. * * @param file_id * IN: Identifier of the target file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Freset_mdc_hit_rate_stats(long file_id) throws HDF5LibraryException; + public synchronized static native void H5Freset_mdc_hit_rate_stats(long file_id) + throws HDF5LibraryException; /** * H5Fget_info returns global information for the file associated with the @@ -4614,7 +4738,8 @@ public class H5 implements java.io.Serializable { * * @return A buffer(H5F_info2_t) for current "global" information about file * - * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception HDF5LibraryException + * Error from the HDF-5 Library. **/ public synchronized static native H5F_info2_t H5Fget_info(long obj_id) throws HDF5LibraryException; @@ -4626,19 +4751,20 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the target file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Fclear_elink_file_cache(long file_id) throws HDF5LibraryException; + public synchronized static native void H5Fclear_elink_file_cache(long file_id) + throws HDF5LibraryException; /** - * H5Fstart_swmr_write will activate SWMR writing mode for a file associated with file_id. This routine will - * prepare and ensure the file is safe for SWMR writing. + * H5Fstart_swmr_write will activate SWMR writing mode for a file associated with file_id. This routine + * will prepare and ensure the file is safe for SWMR writing. * * @param file_id * IN: Identifier of the target file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Fstart_swmr_write(long file_id) throws HDF5LibraryException; @@ -4649,18 +4775,19 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the target file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Fstart_mdc_logging(long file_id) throws HDF5LibraryException; /** - * H5Fstop_mdc_logging stops logging metadata cache events if logging was previously enabled and is currently ongoing. + * H5Fstop_mdc_logging stops logging metadata cache events if logging was previously enabled and is + * currently ongoing. * * @param file_id * IN: Identifier of the target file. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Fstop_mdc_logging(long file_id) throws HDF5LibraryException; @@ -4676,12 +4803,13 @@ public class H5 implements java.io.Serializable { * mdc_logging_status[1] = is_currently_logging, whether events are currently being logged * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - mdc_logging_status is null. + * mdc_logging_status is null. **/ - public synchronized static native void H5Fget_mdc_logging_status(long file_id, boolean[] mdc_logging_status) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Fget_mdc_logging_status(long file_id, + boolean[] mdc_logging_status) + throws HDF5LibraryException, NullPointerException; /** * H5Fget_dset_no_attrs_hint gets the file-level setting to create minimized dataset object headers. @@ -4692,11 +4820,10 @@ public class H5 implements java.io.Serializable { * @return true if the file-level is set to create minimized dataset object headers, false if not. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Fget_dset_no_attrs_hint(long file_id) - throws HDF5LibraryException; - + throws HDF5LibraryException; /** * H5Fset_dset_no_attrs_hint sets the file-level setting to create minimized dataset object headers. @@ -4704,14 +4831,13 @@ public class H5 implements java.io.Serializable { * @param file_id * IN: Identifier of the target file. * @param minimize - * the minimize hint setting + * the minimize hint setting * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize) - throws HDF5LibraryException; - + throws HDF5LibraryException; /** * H5Fset_libver_bounds sets a different low and high bounds while a file is open. @@ -4724,17 +4850,18 @@ public class H5 implements java.io.Serializable { * IN: The latest version of the library that will be used for writing objects. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high) - throws HDF5LibraryException; + throws HDF5LibraryException; // /////// unimplemented //////// // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa); // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); // herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info); - // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); + // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t + // *sect_info/*out*/); // herr_t H5Fformat_convert(hid_t fid); // herr_t H5Freset_page_buffering_stats(hid_t file_id); // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2], @@ -4814,11 +4941,10 @@ public class H5 implements java.io.Serializable { // herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa); // haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type); // herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle); - // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/); - // herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf); - // herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); - // herr_t H5FDlock(H5FD_t *file, hbool_t rw); + // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void + // *buf/*out*/); herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t + // size, const void *buf); herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); herr_t + // H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); herr_t H5FDlock(H5FD_t *file, hbool_t rw); // herr_t H5FDunlock(H5FD_t *file); // herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/); @@ -4845,9 +4971,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Gclose(long group_id) throws HDF5LibraryException { + public static int H5Gclose(long group_id) throws HDF5LibraryException + { if (group_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -4871,18 +4998,19 @@ public class H5 implements java.io.Serializable { * @param gcpl_id * IN: Identifier of group creation property list. * @param gapl_id - * IN: Identifier of group access property list. (No group access properties have been implemented at - * this time; use H5P_DEFAULT.) + * IN: Identifier of group access property list. (No group access properties have been + *implemented at this time; use H5P_DEFAULT.) * * @return a valid group identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public static long H5Gcreate(long loc_id, String name, long lcpl_id, long gcpl_id, long gapl_id) - throws HDF5LibraryException, NullPointerException { + throws HDF5LibraryException, NullPointerException + { long id = _H5Gcreate2(loc_id, name, lcpl_id, gcpl_id, gapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Gcreate add {}", id); @@ -4893,7 +5021,8 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Gcreate2(long loc_id, String name, long lcpl_id, long gcpl_id, - long gapl_id) throws HDF5LibraryException, NullPointerException; + long gapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Gcreate_anon creates a new empty group in the file specified by loc_id. @@ -4903,15 +5032,16 @@ public class H5 implements java.io.Serializable { * @param gcpl_id * IN: Identifier of group creation property list. * @param gapl_id - * IN: Identifier of group access property list. (No group access properties have been implemented at - * this time; use H5P_DEFAULT.) + * IN: Identifier of group access property list. (No group access properties have been + * implemented at this time; use H5P_DEFAULT.) * * @return a valid group identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) throws HDF5LibraryException { + public static long H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) throws HDF5LibraryException + { long id = _H5Gcreate_anon(loc_id, gcpl_id, gapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Gcreate_anon add {}", id); @@ -4922,11 +5052,11 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Gget_create_plist returns an identifier for the group creation property list associated with the group - * specified by group_id. + * H5Gget_create_plist returns an identifier for the group creation property list associated with the + * group specified by group_id. * * @param group_id * IN: Identifier of the group. @@ -4934,13 +5064,13 @@ public class H5 implements java.io.Serializable { * @return an identifier for the group's creation property list * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Gget_create_plist(long group_id) throws HDF5LibraryException; /** - * H5Gget_info retrieves information about the group specified by group_id. The information is returned in the - * group_info struct. + * H5Gget_info retrieves information about the group specified by group_id. The information is returned in + * the group_info struct. * * @param group_id * IN: Identifier of the group. @@ -4948,12 +5078,13 @@ public class H5 implements java.io.Serializable { * @return a structure in which group information is returned * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native H5G_info_t H5Gget_info(long group_id) throws HDF5LibraryException; /** - * H5Gget_info_by_idx retrieves information about a group, according to the group's position within an index. + * H5Gget_info_by_idx retrieves information about a group, according to the group's position within an + * index. * * @param group_id * IN: File or group identifier. @@ -4971,16 +5102,18 @@ public class H5 implements java.io.Serializable { * @return a structure in which group information is returned * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5G_info_t H5Gget_info_by_idx(long group_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5G_info_t H5Gget_info_by_idx(long group_id, String group_name, + int idx_type, int order, long n, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Gget_info_by_name retrieves information about the group group_name located in the file or group specified by - * loc_id. + * H5Gget_info_by_name retrieves information about the group group_name located in the file or group + * specified by loc_id. * * @param group_id * IN: File or group identifier. @@ -4992,15 +5125,16 @@ public class H5 implements java.io.Serializable { * @return a structure in which group information is returned * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native H5G_info_t H5Gget_info_by_name(long group_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * retrieves information of all objects under the group (name) located in the file or group specified by + * loc_id. * * @param loc_id * IN: File or group identifier @@ -5016,21 +5150,25 @@ public class H5 implements java.io.Serializable { * @return the number of items found * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, - H5O_token_t[] tokens) throws HDF5LibraryException, NullPointerException { + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, + int[] objTypes, H5O_token_t[] tokens) + throws HDF5LibraryException, NullPointerException + { if (objNames == null) { throw new NullPointerException("H5Gget_obj_info_all(): name array is null"); } - return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, tokens, HDF5Constants.H5_INDEX_NAME); + return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, tokens, + HDF5Constants.H5_INDEX_NAME); } /** - * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * retrieves information of all objects under the group (name) located in the file or group specified by + * loc_id. * * @param loc_id * IN: File or group identifier @@ -5050,17 +5188,21 @@ public class H5 implements java.io.Serializable { * @return the number of items found * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, - int[] ltype, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException { + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, + int[] objTypes, int[] ltype, H5O_token_t[] tokens, + int indx_type) + throws HDF5LibraryException, NullPointerException + { return H5Gget_obj_info_full(loc_id, name, objNames, objTypes, ltype, null, tokens, indx_type, -1); } /** - * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * retrieves information of all objects under the group (name) located in the file or group specified by + * loc_id. * * @param loc_id * IN: File or group identifier @@ -5082,17 +5224,21 @@ public class H5 implements java.io.Serializable { * @return the number of items found * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, - int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type) throws HDF5LibraryException, NullPointerException { + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, + int[] objTypes, int[] ltype, long[] fno, + H5O_token_t[] tokens, int indx_type) + throws HDF5LibraryException, NullPointerException + { return H5Gget_obj_info_full(loc_id, name, objNames, objTypes, ltype, fno, tokens, indx_type, -1); } /** - * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * retrieves information of all objects under the group (name) located in the file or group specified by + * loc_id. * * @param loc_id * IN: File or group identifier @@ -5116,13 +5262,15 @@ public class H5 implements java.io.Serializable { * @return the number of items found * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] objNames, int[] objTypes, - int[] ltype, long[] fno, H5O_token_t[] tokens, int indx_type, int indx_order) throws HDF5LibraryException, - NullPointerException { + public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] objNames, + int[] objTypes, int[] ltype, long[] fno, + H5O_token_t[] tokens, int indx_type, int indx_order) + throws HDF5LibraryException, NullPointerException + { if (objNames == null) { throw new NullPointerException("H5Gget_obj_info_full(): name array is null"); } @@ -5152,21 +5300,22 @@ public class H5 implements java.io.Serializable { indx_order = HDF5Constants.H5_ITER_INC; log.trace("H5Gget_obj_info_full: objNames_len={}", objNames.length); - int status = H5Gget_obj_info_full(loc_id, name, objNames, objTypes, ltype, fno, tokens, objNames.length, indx_type, - indx_order); + int status = H5Gget_obj_info_full(loc_id, name, objNames, objTypes, ltype, fno, tokens, + objNames.length, indx_type, indx_order); for (int indx = 0; indx < objNames.length; indx++) log.trace("H5Gget_obj_info_full: objNames={}", objNames[indx]); return status; } - private synchronized static native int H5Gget_obj_info_full(long loc_id, String name, String[] objNames, int[] objTypes, - int[] ltype, long[] fno, H5O_token_t[] tokens, int n, int indx_type, int indx_order) throws HDF5LibraryException, - NullPointerException; + private synchronized static native int + H5Gget_obj_info_full(long loc_id, String name, String[] objNames, int[] objTypes, int[] ltype, long[] fno, + H5O_token_t[] tokens, int n, int indx_type, int indx_order) + throws HDF5LibraryException, NullPointerException; /** - * H5Gget_obj_info_idx report the name and type of object with index 'idx' in a Group. The 'idx' corresponds to the - * index maintained by H5Giterate. Each link is returned, so objects with multiple links will be counted once for - * each link. + * H5Gget_obj_info_idx report the name and type of object with index 'idx' in a Group. The 'idx' + * corresponds to the index maintained by H5Giterate. Each link is returned, so objects with multiple + * links will be counted once for each link. * * @param loc_id * IN: file or group ID. @@ -5182,19 +5331,21 @@ public class H5 implements java.io.Serializable { * @return non-negative if successful, -1 if not. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_idx(long loc_id, String name, int idx, String[] oname, int[] type) - throws HDF5LibraryException, NullPointerException { + public synchronized static int H5Gget_obj_info_idx(long loc_id, String name, int idx, String[] oname, + int[] type) + throws HDF5LibraryException, NullPointerException + { String n[] = new String[1]; - n[0] = new String(""); - oname[0] = H5Lget_name_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, - HDF5Constants.H5P_DEFAULT); - H5L_info_t info = H5Lget_info_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, - HDF5Constants.H5P_DEFAULT); - type[0] = info.type; + n[0] = new String(""); + oname[0] = H5Lget_name_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + idx, HDF5Constants.H5P_DEFAULT); + H5L_info_t info = H5Lget_info_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, idx, HDF5Constants.H5P_DEFAULT); + type[0] = info.type; return 0; } @@ -5204,8 +5355,8 @@ public class H5 implements java.io.Serializable { * a lot of time to finish if the number of objects is more than 10,000 */ /** - * retrieves information of all objects (recurvisely) under the group (name) located in the file or group specified - * by loc_id up to maximum specified by objMax. + * retrieves information of all objects (recurvisely) under the group (name) located in the file or group + * specified by loc_id up to maximum specified by objMax. * * @param loc_id * IN: File or group identifier @@ -5223,12 +5374,14 @@ public class H5 implements java.io.Serializable { * @return the number of items found * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes, - H5O_token_t[] objToken, long objMax) throws HDF5LibraryException, NullPointerException { + public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, + int[] lnkTypes, H5O_token_t[] objToken, long objMax) + throws HDF5LibraryException, NullPointerException + { if (objNames == null) { throw new NullPointerException("H5Gget_obj_info_max(): name array is null"); } @@ -5256,12 +5409,15 @@ public class H5 implements java.io.Serializable { return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objToken, objMax, objNames.length); } - private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, int[] ltype, - H5O_token_t[] tokens, long amax, int n) throws HDF5LibraryException, NullPointerException; + private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, + int[] ltype, H5O_token_t[] tokens, long amax, + int n) + throws HDF5LibraryException, NullPointerException; /** - * H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by - * H5Giterate. Each link is returned, so objects with multiple links will be counted once for each link. + * H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be + * visited by H5Giterate. Each link is returned, so objects with multiple links will be counted once for + * each link. * * @param loc_id * file or group ID. @@ -5271,18 +5427,19 @@ public class H5 implements java.io.Serializable { * @return the number of members in the group or -1 if error. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. */ - public synchronized static long H5Gn_members(long loc_id, String name) throws HDF5LibraryException, - NullPointerException { + public synchronized static long H5Gn_members(long loc_id, String name) + throws HDF5LibraryException, NullPointerException + { long grp_id = H5Gopen(loc_id, name, HDF5Constants.H5P_DEFAULT); - long n = -1; + long n = -1; try { H5G_info_t info = H5.H5Gget_info(grp_id); - n = info.nlinks; + n = info.nlinks; } finally { H5Gclose(grp_id); @@ -5304,12 +5461,13 @@ public class H5 implements java.io.Serializable { * @return a valid group identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Gopen(long loc_id, String name, long gapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Gopen(long loc_id, String name, long gapl_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Gopen2(loc_id, name, gapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Gopen add {}", id); @@ -5320,7 +5478,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Gopen2(long loc_id, String name, long gapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Gflush causes all buffers associated with a group to be immediately flushed to disk without @@ -5330,7 +5488,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the group to be flushed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Gflush(long group_id) throws HDF5LibraryException; @@ -5344,7 +5502,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the group to be refreshed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Grefresh(long group_id) throws HDF5LibraryException; @@ -5387,7 +5545,7 @@ public class H5 implements java.io.Serializable { * @return the file ID. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Iget_file_id(long obj_id) throws HDF5LibraryException; @@ -5405,11 +5563,11 @@ public class H5 implements java.io.Serializable { * @return the length of the name retrieved. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ @Deprecated public synchronized static native long H5Iget_name_long(long obj_id, String[] name, long size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Iget_name retrieves the name of an object specified by the identifier, obj_id. * @@ -5419,10 +5577,9 @@ public class H5 implements java.io.Serializable { * @return String for Attribute name. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5Iget_name(long obj_id) - throws HDF5LibraryException; + public synchronized static native String H5Iget_name(long obj_id) throws HDF5LibraryException; /** * H5Iget_ref obtains the number of references outstanding specified by the identifier, obj_id. @@ -5433,13 +5590,14 @@ public class H5 implements java.io.Serializable { * @return the reference count. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Iget_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Iget_ref(long obj_id) + throws HDF5LibraryException, NullPointerException; /** * H5Idec_ref decrements the reference count specified by the identifier, obj_id. - * If the reference count for an ID reaches zero, the object will be closed. + * If the reference count for an ID reaches zero, the object will be closed. * * @param obj_id * IN: Identifier of the object. @@ -5447,9 +5605,10 @@ public class H5 implements java.io.Serializable { * @return the reference count. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Idec_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Idec_ref(long obj_id) + throws HDF5LibraryException, NullPointerException; /** * H5Iinc_ref increments the reference count specified by the identifier, obj_id. @@ -5460,9 +5619,10 @@ public class H5 implements java.io.Serializable { * @return the reference count. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Iinc_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Iinc_ref(long obj_id) + throws HDF5LibraryException, NullPointerException; /** * H5Iget_type retrieves the type of the object identified by obj_id. @@ -5473,13 +5633,13 @@ public class H5 implements java.io.Serializable { * @return the object type if successful; otherwise H5I_BADID. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Iget_type(long obj_id) throws HDF5LibraryException; /** - * H5Iget_type_ref retrieves the reference count on an ID type. The reference count is used by the library to - * indicate when an ID type can be destroyed. + * H5Iget_type_ref retrieves the reference count on an ID type. The reference count is used by the library + * to indicate when an ID type can be destroyed. * * @param type_id * IN: The identifier of the type whose reference count is to be retrieved @@ -5487,13 +5647,13 @@ public class H5 implements java.io.Serializable { * @return The current reference count on success, negative on failure. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Iget_type_ref(long type_id) throws HDF5LibraryException; /** - * H5Idec_type_ref decrements the reference count on an identifier type. The reference count is used by the - * library to indicate when an identifier type can be destroyed. If the reference count reaches zero, + * H5Idec_type_ref decrements the reference count on an identifier type. The reference count is used by + * the library to indicate when an identifier type can be destroyed. If the reference count reaches zero, * this function will destroy it. * * @param type_id @@ -5502,13 +5662,13 @@ public class H5 implements java.io.Serializable { * @return The current reference count on success, negative on failure. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Idec_type_ref(long type_id) throws HDF5LibraryException; /** - * H5Iinc_type_ref increments the reference count on an ID type. The reference count is used by the library - * to indicate when an ID type can be destroyed. + * H5Iinc_type_ref increments the reference count on an ID type. The reference count is used by the + * library to indicate when an ID type can be destroyed. * * @param type_id * IN: The identifier of the type whose reference count is to be incremented @@ -5516,7 +5676,7 @@ public class H5 implements java.io.Serializable { * @return The current reference count on success, negative on failure. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Iinc_type_ref(long type_id) throws HDF5LibraryException; @@ -5529,7 +5689,7 @@ public class H5 implements java.io.Serializable { * @return Number of identifiers of the specified identifier type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Inmembers(long type_id) throws HDF5LibraryException; @@ -5542,7 +5702,7 @@ public class H5 implements java.io.Serializable { * @return a boolean, true if the specified identifier id is valid * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Iis_valid(long obj_id) throws HDF5LibraryException; @@ -5555,11 +5715,10 @@ public class H5 implements java.io.Serializable { * @return a boolean, true if the specified identifier type exists * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Itype_exists(int type_id) throws HDF5LibraryException; - /** * H5Iclear_type deletes all identifiers of the type identified by the argument type. * @@ -5569,9 +5728,10 @@ public class H5 implements java.io.Serializable { * IN: Whether or not to force deletion of all identifiers * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Iclear_type(int type_id, boolean force) throws HDF5LibraryException; + public synchronized static native void H5Iclear_type(int type_id, boolean force) + throws HDF5LibraryException; /** * H5Idestroy_type deletes an entire identifier type. All identifiers of this type are destroyed @@ -5581,7 +5741,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of identifier type which is to be destroyed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Idestroy_type(int type_id) throws HDF5LibraryException; @@ -5604,7 +5764,6 @@ public class H5 implements java.io.Serializable { // typedef herr_t (*H5I_iterate_func_t)(hid_t id, void *udata); // herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data); - // ////////////////////////////////////////////////////////////////// // H5L: Link Interface Functions // // ////////////////////////////////////////////////////////////////// @@ -5626,16 +5785,17 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native void H5Lcopy(long src_loc, String src_name, long dst_loc, String dst_name, - long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Lcopy(long src_loc, String src_name, long dst_loc, + String dst_name, long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Lcreate_external creates a new soft link to an external object, which is an object in a different HDF5 file - * from the location of the link. + * H5Lcreate_external creates a new soft link to an external object, which is an object in a different + * HDF5 file from the location of the link. * * @param file_name * IN: Name of the target file containing the target object. @@ -5651,12 +5811,14 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native void H5Lcreate_external(String file_name, String obj_name, long link_loc_id, - String link_name, long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Lcreate_external(String file_name, String obj_name, + long link_loc_id, String link_name, + long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lcreate_hard creates a new hard link to a pre-existing object in an HDF5 file. @@ -5675,12 +5837,13 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - cur_name or dst_name is null. + * cur_name or dst_name is null. **/ - public synchronized static native void H5Lcreate_hard(long cur_loc, String cur_name, long dst_loc, String dst_name, - long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Lcreate_hard(long cur_loc, String cur_name, long dst_loc, + String dst_name, long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lcreate_soft creates a new soft link to an object in an HDF5 file. @@ -5697,12 +5860,13 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - link_name is null. + * link_name is null. **/ - public synchronized static native void H5Lcreate_soft(String link_target, long link_loc_id, String link_name, - long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Lcreate_soft(String link_target, long link_loc_id, + String link_name, long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Ldelete removes the link specified from a group. @@ -5715,15 +5879,16 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native void H5Ldelete(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Ldelete_by_idx removes the nth link in a group according to the specified order and in the specified index. + * H5Ldelete_by_idx removes the nth link in a group according to the specified order and in the specified + * index. * * @param loc_id * IN: File or group identifier specifying location of subject group @@ -5739,12 +5904,13 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ - public synchronized static native void H5Ldelete_by_idx(long loc_id, String group_name, int idx_type, int order, - long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Ldelete_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lexists checks if a link with a particular name exists in a group. @@ -5759,12 +5925,12 @@ public class H5 implements java.io.Serializable { * @return a boolean, true if the name exists, otherwise false. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native boolean H5Lexists(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Lget_info returns information about the specified link. @@ -5779,16 +5945,16 @@ public class H5 implements java.io.Serializable { * @return a buffer(H5L_info_t) for the link information. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native H5L_info_t H5Lget_info(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Lget_info_by_idx opens a named datatype at the location specified by loc_id and return an identifier for the - * datatype. + * H5Lget_info_by_idx opens a named datatype at the location specified by loc_id and return an identifier + * for the datatype. * * @param loc_id * IN: File or group identifier specifying location of subject group @@ -5806,16 +5972,18 @@ public class H5 implements java.io.Serializable { * @return a buffer(H5L_info_t) for the link information. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ - public synchronized static native H5L_info_t H5Lget_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5L_info_t H5Lget_info_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Lget_name_by_idx retrieves name of the nth link in a group, according to the order within a specified field or - * index. + * H5Lget_name_by_idx retrieves name of the nth link in a group, according to the order within a specified + * field or index. * * @param loc_id * IN: File or group identifier specifying location of subject group @@ -5833,12 +6001,13 @@ public class H5 implements java.io.Serializable { * @return a String for the link name. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ public synchronized static native String H5Lget_name_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lget_value returns the link value of a symbolic link. Note that this function is a combination @@ -5856,12 +6025,13 @@ public class H5 implements java.io.Serializable { * @return the link type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Lget_value(long loc_id, String name, String[] link_value, long lapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Lget_value(long loc_id, String name, String[] link_value, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lget_value_by_idx retrieves value of the nth link in a group, according to the order within an index. @@ -5886,12 +6056,14 @@ public class H5 implements java.io.Serializable { * @return the link type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ - public synchronized static native int H5Lget_value_by_idx(long loc_id, String group_name, int idx_type, int order, - long n, String[] link_value, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Lget_value_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, String[] link_value, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Literate iterates through links in a group. @@ -5909,14 +6081,15 @@ public class H5 implements java.io.Serializable { * @param op_data * IN: User-defined pointer to data required by the application for its processing of the link * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_t op, - H5L_iterate_opdata_t op_data) throws HDF5LibraryException; + public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, + H5L_iterate_t op, H5L_iterate_opdata_t op_data) + throws HDF5LibraryException; /** * H5Literate_by_name iterates through links in a group. @@ -5938,17 +6111,18 @@ public class H5 implements java.io.Serializable { * @param lapl_id * IN: Link access property list identifier * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ - public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, int order, - long idx, H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, + int order, long idx, H5L_iterate_t op, + H5L_iterate_opdata_t op_data, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lmove renames a link within an HDF5 file. @@ -5967,12 +6141,13 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier to be associated with the new link. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native void H5Lmove(long src_loc, String src_name, long dst_loc, String dst_name, - long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Lmove(long src_loc, String src_name, long dst_loc, + String dst_name, long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lvisit recursively visits all links starting from a specified group. @@ -5988,14 +6163,14 @@ public class H5 implements java.io.Serializable { * @param op_data * IN: User-defined pointer to data required by the application for its processing of the link * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_t op, - H5L_iterate_opdata_t op_data) throws HDF5LibraryException; + H5L_iterate_opdata_t op_data) throws HDF5LibraryException; /** * H5Lvisit_by_name recursively visits all links starting from a specified group. @@ -6015,17 +6190,18 @@ public class H5 implements java.io.Serializable { * @param lapl_id * IN: link access property * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - group_name is null. + * group_name is null. **/ - public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, int order, - H5L_iterate_t op, H5L_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; - + public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, + int order, H5L_iterate_t op, + H5L_iterate_opdata_t op_data, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Lis_registered tests whether a user-defined link class is currently registered, @@ -6035,21 +6211,23 @@ public class H5 implements java.io.Serializable { * IN: User-defined link class identifier * * @return Returns a positive value if the link class has been registered and zero if it is unregistered. - * Otherwise returns a negative value; this may mean that the identifier is not a valid user-defined class identifier. + * Otherwise returns a negative value; this may mean that the identifier is not a valid + * user-defined class identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Lis_registered(int link_cls_id) throws HDF5LibraryException; /** - * H5Lunregister unregisters a class of user-defined links, preventing them from being traversed, queried, moved, etc. + * H5Lunregister unregisters a class of user-defined links, preventing them from being traversed, queried, + * moved, etc. * * @param link_cls_id * IN: User-defined link class identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Lunregister(int link_cls_id) throws HDF5LibraryException; @@ -6093,9 +6271,10 @@ public class H5 implements java.io.Serializable { * @return non-negative on success * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Oclose(long object_id) throws HDF5LibraryException { + public static int H5Oclose(long object_id) throws HDF5LibraryException + { if (object_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -6108,8 +6287,8 @@ public class H5 implements java.io.Serializable { private synchronized static native int _H5Oclose(long object_id) throws HDF5LibraryException; /** - * H5Ocopy copies the group, dataset or named datatype specified from the file or group specified by source location - * to the destination location. + * H5Ocopy copies the group, dataset or named datatype specified from the file or group specified by + * source location to the destination location. * * @param src_loc_id * IN: Object identifier indicating the location of the source object to be copied @@ -6125,12 +6304,13 @@ public class H5 implements java.io.Serializable { * IN: Link creation property list for the new hard link * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native void H5Ocopy(long src_loc_id, String src_name, long dst_loc_id, String dst_name, - long ocpypl_id, long lcpl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Ocopy(long src_loc_id, String src_name, long dst_loc_id, + String dst_name, long ocpypl_id, long lcpl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Oget_comment retrieves the comment for the specified object. @@ -6141,9 +6321,10 @@ public class H5 implements java.io.Serializable { * @return the comment * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5Oget_comment(long obj_id) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native String H5Oget_comment(long obj_id) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Oset_comment sets the comment for the specified object. @@ -6154,12 +6335,13 @@ public class H5 implements java.io.Serializable { * IN: The new comment. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * * @deprecated As of HDF5 1.8 in favor of object attributes. **/ @Deprecated - public synchronized static native void H5Oset_comment(long obj_id, String comment) throws HDF5LibraryException; + public synchronized static native void H5Oset_comment(long obj_id, String comment) + throws HDF5LibraryException; /** * H5Oget_comment_by_name retrieves the comment for an object. @@ -6174,12 +6356,12 @@ public class H5 implements java.io.Serializable { * @return the comment * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native String H5Oget_comment_by_name(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, IllegalArgumentException, NullPointerException; + throws HDF5LibraryException, IllegalArgumentException, NullPointerException; /** * H5Oset_comment_by_name sets the comment for the specified object. @@ -6194,15 +6376,16 @@ public class H5 implements java.io.Serializable { * IN: Link access property list identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. * * @deprecated As of HDF5 1.8 in favor of object attributes. **/ @Deprecated - public synchronized static native void H5Oset_comment_by_name(long loc_id, String name, String comment, long lapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Oset_comment_by_name(long loc_id, String name, String comment, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Oget_info retrieves the metadata for an object specified by an identifier. @@ -6213,12 +6396,12 @@ public class H5 implements java.io.Serializable { * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, - NullPointerException { + public static H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, NullPointerException + { return H5Oget_info(loc_id, HDF5Constants.H5O_INFO_ALL); } @@ -6233,38 +6416,41 @@ public class H5 implements java.io.Serializable { * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_info_t H5Oget_info(long loc_id, int fields) throws HDF5LibraryException, - NullPointerException; + public synchronized static native H5O_info_t H5Oget_info(long loc_id, int fields) + throws HDF5LibraryException, NullPointerException; /** - * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and + * relative name. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located * @param name * IN: Relative name of group * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public static H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException { + throws HDF5LibraryException, NullPointerException + { return H5Oget_info_by_name(loc_id, name, HDF5Constants.H5O_INFO_ALL, lapl_id); } /** - * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and + * relative name. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located @@ -6273,18 +6459,19 @@ public class H5 implements java.io.Serializable { * @param fields * IN: Object fields to select * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, long lapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, int fields, + long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position. @@ -6300,19 +6487,22 @@ public class H5 implements java.io.Serializable { * @param n * IN: Object to open * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { - return H5Oget_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_INFO_ALL, lapl_id); + public static H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, int order, + long n, long lapl_id) + throws HDF5LibraryException, NullPointerException + { + return H5Oget_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_INFO_ALL, + lapl_id); } /** @@ -6331,22 +6521,25 @@ public class H5 implements java.io.Serializable { * @param fields * IN: Object fields to select * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, + int fields, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier. - * Native HDF5-specific metadata includes things like object header information and object storage layout information. + * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an + * identifier. Native HDF5-specific metadata includes things like object header information and object + * storage layout information. * * @param loc_id * IN: Identifier for target object @@ -6354,18 +6547,20 @@ public class H5 implements java.io.Serializable { * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static H5O_native_info_t H5Oget_native_info(long loc_id) throws HDF5LibraryException, - NullPointerException { + public static H5O_native_info_t H5Oget_native_info(long loc_id) + throws HDF5LibraryException, NullPointerException + { return H5Oget_native_info(loc_id, HDF5Constants.H5O_NATIVE_INFO_ALL); } /** - * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an identifier. - * Native HDF5-specific metadata includes things like object header information and object storage layout information. + * H5Oget_native_info retrieves the native HDF5-specific metadata for an HDF5 object specified by an + * identifier. Native HDF5-specific metadata includes things like object header information and object + * storage layout information. * * @param loc_id * IN: Identifier for target object @@ -6375,42 +6570,43 @@ public class H5 implements java.io.Serializable { * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_native_info_t H5Oget_native_info(long loc_id, int fields) throws HDF5LibraryException, - NullPointerException; + public synchronized static native H5O_native_info_t H5Oget_native_info(long loc_id, int fields) + throws HDF5LibraryException, NullPointerException; /** - * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object - * by location and relative name. Native HDF5-specific metadata includes things like object header information and - * object storage layout information. + * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying + * the object by location and relative name. Native HDF5-specific metadata includes things like object + * header information and object storage layout information. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located * @param name * IN: Relative name of group * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public static H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException { + throws HDF5LibraryException, NullPointerException + { return H5Oget_native_info_by_name(loc_id, name, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id); } /** - * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object - * by location and relative name. Native HDF5-specific metadata includes things like object header information and - * object storage layout information. + * H5Oget_native_info_by_name retrieves the native HDF5-specific metadata for an HDF5 object, identifying + * the object by location and relative name. Native HDF5-specific metadata includes things like object + * header information and object storage layout information. * * @param loc_id * IN: File or group identifier specifying location of group in which object is located @@ -6419,23 +6615,24 @@ public class H5 implements java.io.Serializable { * @param fields * IN: Object fields to select * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, int fields, long lapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native H5O_native_info_t H5Oget_native_info_by_name(long loc_id, String name, + int fields, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object - * by an index position. Native HDF5-specific metadata includes things like object header information and - * object storage layout information. + * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying + * the object by an index position. Native HDF5-specific metadata includes things like object header + * information and object storage layout information. * * @param loc_id * IN: File or group identifier @@ -6448,25 +6645,28 @@ public class H5 implements java.io.Serializable { * @param n * IN: Object to open * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public static H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { - return H5Oget_native_info_by_idx(loc_id, group_name, idx_type, order, n, HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id); + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException + { + return H5Oget_native_info_by_idx(loc_id, group_name, idx_type, order, n, + HDF5Constants.H5O_NATIVE_INFO_ALL, lapl_id); } /** - * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying the object - * by an index position. Native HDF5-specific metadata includes things like object header information and - * object storage layout information. + * H5Oget_native_info_by_idx retrieves the native HDF5-specific metadata for an HDF5 object, identifying + * the object by an index position. Native HDF5-specific metadata includes things like object header + * information and object storage layout information. * * @param loc_id * IN: File or group identifier @@ -6481,18 +6681,19 @@ public class H5 implements java.io.Serializable { * @param fields * IN: Object fields to select * @param lapl_id - * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as - * H5P_DEFAULT.) + * IN: Access property list identifier for the link pointing to the object (Not currently used; + * pass as H5P_DEFAULT.) * * @return object information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native H5O_native_info_t H5Oget_native_info_by_idx(long loc_id, String group_name, int idx_type, - int order, long n, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5O_native_info_t H5Oget_native_info_by_idx( + long loc_id, String group_name, int idx_type, int order, long n, int fields, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Olink creates a new hard link to an object in an HDF5 file. @@ -6509,12 +6710,13 @@ public class H5 implements java.io.Serializable { * IN: Access property list identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native void H5Olink(long obj_id, long new_loc_id, String new_name, long lcpl_id, - long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Olink(long obj_id, long new_loc_id, String new_name, + long lcpl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Oopen opens a group, dataset, or named datatype specified by a location and a path name. @@ -6529,11 +6731,13 @@ public class H5 implements java.io.Serializable { * @return an object identifier for the opened object * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Oopen(long loc_id, String name, long lapl_id) throws HDF5LibraryException, NullPointerException { + public static long H5Oopen(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Oopen(loc_id, name, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Oopen add {}", id); @@ -6544,7 +6748,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Oopen(long loc_id, String name, long lapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Ovisit recursively visits all objects accessible from a specified object. @@ -6558,18 +6762,20 @@ public class H5 implements java.io.Serializable { * @param op * IN: Callback function passing data regarding the object to the calling application * @param op_data - * IN: User-defined pointer to data required by the application for its processing of the object + * IN: User-defined pointer to data required by the application for its processing of the + * object * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, H5O_iterate_opdata_t op_data) - throws HDF5LibraryException, NullPointerException { + public static int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, + H5O_iterate_opdata_t op_data) throws HDF5LibraryException, NullPointerException + { return H5Ovisit(obj_id, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL); } @@ -6585,20 +6791,22 @@ public class H5 implements java.io.Serializable { * @param op * IN: Callback function passing data regarding the object to the calling application * @param op_data - * IN: User-defined pointer to data required by the application for its processing of the object + * IN: User-defined pointer to data required by the application for its processing of the + * object * @param fields * IN: Object fields to select * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_t op, - H5O_iterate_opdata_t op_data, int fields) throws HDF5LibraryException, NullPointerException; + H5O_iterate_opdata_t op_data, int fields) + throws HDF5LibraryException, NullPointerException; /** * H5Ovisit_by_name recursively visits all objects starting from a specified object. @@ -6614,21 +6822,25 @@ public class H5 implements java.io.Serializable { * @param op * IN: Callback function passing data regarding the object to the calling application * @param op_data - * IN: User-defined pointer to data required by the application for its processing of the object + * IN: User-defined pointer to data required by the application for its processing of the + * object * @param lapl_id * IN: Link access property list identifier * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public static int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, - H5O_iterate_t op, H5O_iterate_opdata_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException { - return H5Ovisit_by_name(loc_id, obj_name, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL, lapl_id); + H5O_iterate_t op, H5O_iterate_opdata_t op_data, long lapl_id) + throws HDF5LibraryException, NullPointerException + { + return H5Ovisit_by_name(loc_id, obj_name, idx_type, order, op, op_data, HDF5Constants.H5O_INFO_ALL, + lapl_id); } /** @@ -6645,23 +6857,25 @@ public class H5 implements java.io.Serializable { * @param op * IN: Callback function passing data regarding the object to the calling application * @param op_data - * IN: User-defined pointer to data required by the application for its processing of the object + * IN: User-defined pointer to data required by the application for its processing of the + * object * @param fields * IN: Object fields to select * @param lapl_id * IN: Link access property list identifier * - * @return returns the return value of the first operator that returns a positive value, or zero if all members were - * processed with no operator returning non-zero. + * @return returns the return value of the first operator that returns a positive value, or zero if all + * members were processed with no operator returning non-zero. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, - H5O_iterate_t op, H5O_iterate_opdata_t op_data, int fields, long lapl_id) throws HDF5LibraryException, NullPointerException; - + public synchronized static native int + H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, H5O_iterate_t op, + H5O_iterate_opdata_t op_data, int fields, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Oexists_by_name is used by an application to check that an existing link resolves to an object. @@ -6677,41 +6891,50 @@ public class H5 implements java.io.Serializable { * @return Returns TRUE or FALSE if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public synchronized static native boolean H5Oexists_by_name(long loc_id, String obj_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Oexists_by_name(long loc_id, String obj_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Odecr_refcount decrements the hard link reference count for an object. * - * @param object_id IN: Object identifier + * @param object_id + * IN: Object identifier * - * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception HDF5LibraryException + * Error from the HDF-5 Library. **/ public synchronized static native void H5Odecr_refcount(long object_id) throws HDF5LibraryException; /** * H5Oincr_refcount increments the hard link reference count for an object. * - * @param object_id IN: Object identifier + * @param object_id + * IN: Object identifier * - * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception HDF5LibraryException + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException; + public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException; /** * H5Oopen_by_token opens a group, dataset, or named datatype using its object token within an HDF5 file. * - * @param loc_id IN: File or group identifier - * @param token IN: Object's token in the file + * @param loc_id + * IN: File or group identifier + * @param token + * IN: Object's token in the file * * @return an object identifier for the opened object * - * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception HDF5LibraryException + * Error from the HDF-5 Library. **/ - public static long H5Oopen_by_token(long loc_id, H5O_token_t token) throws HDF5LibraryException { + public static long H5Oopen_by_token(long loc_id, H5O_token_t token) throws HDF5LibraryException + { long id = _H5Oopen_by_token(loc_id, token); if (id > 0) { @@ -6724,25 +6947,34 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Oopen_by_token(long loc_id, H5O_token_t token) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Oopen_by_idx opens the nth object in the group specified. * - * @param loc_id IN: File or group identifier - * @param group_name IN: Name of group, relative to loc_id, in which object is located - * @param idx_type IN: Type of index by which objects are ordered - * @param order IN: Order of iteration within index - * @param n IN: Object to open - * @param lapl_id IN: Access property list identifier for the link pointing to the object + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object * * @return an object identifier for the opened object * - * @exception HDF5LibraryException - Error from the HDF-5 Library. - * @exception NullPointerException - group_name is null. + * @exception HDF5LibraryException + * Error from the HDF-5 Library. + * @exception NullPointerException + * group_name is null. **/ - public static long H5Oopen_by_idx(long loc_id, String group_name, - int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { + public static long H5Oopen_by_idx(long loc_id, String group_name, int idx_type, int order, long n, + long lapl_id) throws HDF5LibraryException, NullPointerException + { long id = _H5Oopen_by_idx(loc_id, group_name, idx_type, order, n, lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Oopen_by_idx add {}", id); @@ -6752,51 +6984,54 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Oopen_by_idx(long loc_id, String group_name, - int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + private synchronized static native long _H5Oopen_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Oflush causes all buffers associated with an object to be immediately flushed to disk without removing - * the data from the cache. object_id can be any named object associated with an HDF5 file including a - * dataset, a group, or a committed datatype. + * H5Oflush causes all buffers associated with an object to be immediately flushed to disk without + * removing the data from the cache. object_id can be any named object associated with an HDF5 file + * ncluding a dataset, a group, or a committed datatype. * * @param object_id * IN: Identifier of the object to be flushed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Oflush(long object_id) throws HDF5LibraryException; /** * H5Orefresh causes all buffers associated with an object to be cleared and immediately re-loaded with * updated contents from disk. This function essentially closes the object, evicts all metadata associated - * with it from the cache, and then re-opens the object. The reopened object is automatically re-registered - * with the same ID. object_id can be any named object associated with an HDF5 file including a - * dataset, a group, or a committed datatype. + * with it from the cache, and then re-opens the object. The reopened object is automatically + * re-registered with the same ID. object_id can be any named object associated with an HDF5 file + * including a dataset, a group, or a committed datatype. * * @param object_id * IN: Identifier of the object to be refreshed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException; /** - * H5Odisable_mdc_flushes corks an object, keeping dirty entries associated with the object in the metadata cache. + * H5Odisable_mdc_flushes corks an object, keeping dirty entries associated with the object in the + * metadata cache. * * @param object_id * IN: Identifier of the object to be corked. **/ - public synchronized static native void H5Odisable_mdc_flushes(long object_id); + public synchronized static native void H5Odisable_mdc_flushes(long object_id); /** - * H5Oenable_mdc_flushes uncorks an object, keeping dirty entries associated with the object in the metadata cache. + * H5Oenable_mdc_flushes uncorks an object, keeping dirty entries associated with the object in the + * metadata cache. * * @param object_id * IN: Identifier of the object to be uncorked. **/ - public synchronized static native void H5Oenable_mdc_flushes(long object_id); + public synchronized static native void H5Oenable_mdc_flushes(long object_id); /** * H5Oare_mdc_flushes_disabled retrieve the object's "cork" status. * @@ -6804,10 +7039,10 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the object to be flushed. * * @return the cork status - * TRUE if mdc flushes for the object is disabled - * FALSE if mdc flushes for the object is not disabled + * TRUE if mdc flushes for the object is disabled + * FALSE if mdc flushes for the object is not disabled **/ - public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id); + public synchronized static native boolean H5Oare_mdc_flushes_disabled(long object_id); // /////// unimplemented //////// // herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, @@ -6831,7 +7066,7 @@ public class H5 implements java.io.Serializable { * @return name of a property list if successful; null if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native String H5Pget_class_name(long plid) throws HDF5LibraryException; @@ -6844,9 +7079,10 @@ public class H5 implements java.io.Serializable { * @return a property list identifier (plist) if successful; otherwise Fail (-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Pcreate(long type) throws HDF5LibraryException { + public static long H5Pcreate(long type) throws HDF5LibraryException + { long id = _H5Pcreate(type); if (id > 0) { log.trace("OPEN_IDS: H5Pcreate add {}", id); @@ -6868,7 +7104,7 @@ public class H5 implements java.io.Serializable { * @return value for a property if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Pget(long plid, String name) throws HDF5LibraryException; @@ -6884,9 +7120,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ - public synchronized static native int H5Pset(long plid, String name, int value) throws HDF5LibraryException; + public synchronized static native int H5Pset(long plid, String name, int value) + throws HDF5LibraryException; /** * H5Pexist determines whether a property exists within a property list or class @@ -6895,10 +7132,11 @@ public class H5 implements java.io.Serializable { * IN: Identifier for the property to query * @param name * IN: Name of property to check for - * @return a true value if the property exists in the property object; false if the property does not exist; + * @return a true value if the property exists in the property object; false if the property does not + * exist; * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native boolean H5Pexist(long plid, String name) throws HDF5LibraryException; @@ -6912,7 +7150,7 @@ public class H5 implements java.io.Serializable { * @return size of a property's value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native long H5Pget_size(long plid, String name) throws HDF5LibraryException; @@ -6924,7 +7162,7 @@ public class H5 implements java.io.Serializable { * @return number of properties if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native long H5Pget_nprops(long plid) throws HDF5LibraryException; @@ -6936,7 +7174,7 @@ public class H5 implements java.io.Serializable { * @return a property list class if successful. Otherwise returns H5P_ROOT (-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Pget_class(long plist) throws HDF5LibraryException; @@ -6948,7 +7186,7 @@ public class H5 implements java.io.Serializable { * @return a valid parent class object identifier if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native long H5Pget_class_parent(long plid) throws HDF5LibraryException; @@ -6963,7 +7201,7 @@ public class H5 implements java.io.Serializable { * @return positive value if equal; zero if unequal, a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Pequal(long plid1, long plid2) throws HDF5LibraryException; @@ -6978,9 +7216,10 @@ public class H5 implements java.io.Serializable { * @return TRUE if equal, FALSE if unequal * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ - public static boolean H5P_equal(long plid1, long plid2) throws HDF5LibraryException { + public static boolean H5P_equal(long plid1, long plid2) throws HDF5LibraryException + { if (H5Pequal(plid1, plid2) == 1) return true; return false; @@ -6996,7 +7235,7 @@ public class H5 implements java.io.Serializable { * @return a positive value if equal; zero if unequal; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Pisa_class(long plist, long pclass) throws HDF5LibraryException; @@ -7012,10 +7251,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Pcopy_prop(long dst_id, long src_id, String name) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Premove removes a property from a property list @@ -7027,7 +7266,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Premove(long plid, String name) throws HDF5LibraryException; @@ -7041,7 +7280,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native int H5Punregister(long plid, String name) throws HDF5LibraryException; @@ -7053,9 +7292,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ - public static int H5Pclose_class(long plid) throws HDF5LibraryException { + public static int H5Pclose_class(long plid) throws HDF5LibraryException + { if (plid < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -7075,9 +7315,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Pclose(long plist) throws HDF5LibraryException { + public static int H5Pclose(long plist) throws HDF5LibraryException + { if (plist < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -7098,9 +7339,10 @@ public class H5 implements java.io.Serializable { * @return a property list identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Pcopy(long plist) throws HDF5LibraryException { + public static long H5Pcopy(long plist) throws HDF5LibraryException + { long id = _H5Pcopy(plist); if (id > 0) { log.trace("OPEN_IDS: H5Pcopy add {}", id); @@ -7144,11 +7386,12 @@ public class H5 implements java.io.Serializable { * @return a property list identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException { + public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException + { long id = _H5Pcreate_class_nocb(parent_class, name); - if (id > 0) { + if (id > 0) { log.trace("OPEN_IDS: H5Pcreate_class_nocb add {}", id); OPEN_IDS.add(id); log.trace("OPEN_IDS: {}", OPEN_IDS.size()); @@ -7156,21 +7399,27 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException; - -// public static long H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, -// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException { -// long id = _H5Pcreate_class(parent_class, name, create_op, create_data, copy_op, copy_data, close_op, close_data); -// if (id > 0) { -// log.trace("OPEN_IDS: H5Pcreate_class add {}", id); -// OPEN_IDS.add(id); -// log.trace("OPEN_IDS: {}", OPEN_IDS.size()); -// } -// return id; -// } -// -// private synchronized static native long _H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, -// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException; + private synchronized static native long _H5Pcreate_class_nocb(long parent_class, String name) + throws HDF5LibraryException; + + // public static long H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, + // H5P_cls_create_func_t create_data, + // H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb + // close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException { + // long id = _H5Pcreate_class(parent_class, name, create_op, create_data, copy_op, copy_data, + // close_op, close_data); + // if (id > 0) { + // log.trace("OPEN_IDS: H5Pcreate_class add {}", id); + // OPEN_IDS.add(id); + // log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + // } + // return id; + // } + // + // private synchronized static native long _H5Pcreate_class(long parent_class, String name, + // H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, + // H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, + // H5P_cls_close_func_t close_data) throws HDF5LibraryException; /** * H5Pregister2_nocb registers a property list with no callback functions. @@ -7187,10 +7436,13 @@ public class H5 implements java.io.Serializable { * @exception HDF5LibraryException * - Error from the HDF-5 Library. **/ - public synchronized static native void H5Pregister2_nocb(long plist_class, String name, long size, byte[] def_value) throws HDF5LibraryException; + public synchronized static native void H5Pregister2_nocb(long plist_class, String name, long size, + byte[] def_value) throws HDF5LibraryException; -// public synchronized static native void H5Pregister2(long plist_class, String name, long size, byte[] def_value, H5P_prp_create_func_cb prp_create, H5P_prp_set_func_cb prp_set, -// H5P_prp_get_func_cb prp_get, H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + // public synchronized static native void H5Pregister2(long plist_class, String name, long size, byte[] + // def_value, H5P_prp_create_func_cb prp_create, H5P_prp_set_func_cb prp_set, + // H5P_prp_get_func_cb prp_get, H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, + // H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; /** * H5Pinsert2_nocb inserts a property list with no callback functions. @@ -7205,37 +7457,39 @@ public class H5 implements java.io.Serializable { * IN: Default value of the property * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Pinsert2_nocb(long plist, String name, long size, byte[] value) throws HDF5LibraryException; - + public synchronized static native void H5Pinsert2_nocb(long plist, String name, long size, byte[] value) + throws HDF5LibraryException; - // public synchronized static native void H5Pinsert2(long plist, String name, long size, byte[] value, H5P_prp_set_func_cb prp_set, H5P_prp_get_func_cb prp_get, - // H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + // public synchronized static native void H5Pinsert2(long plist, String name, long size, byte[] value, + // H5P_prp_set_func_cb prp_set, H5P_prp_get_func_cb prp_get, + // H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, + // H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; /** * H5Piterate iterates over the properties in a property list or class * * @param plist - * IN: ID of property object to iterate over + * IN: ID of property object to iterate over * @param idx - * IN/OUT: index of the property to begin with + * IN/OUT: index of the property to begin with * @param op - * IN: function to be called with each property iterated over. + * IN: function to be called with each property iterated over. * @param op_data - * IN: iteration data from user + * IN: iteration data from user * - * @return - * the return value of the last call to op if it was non-zero, - * zero if all properties have been processed + * @return the return value of the last call to op if it was non-zero, + * zero if all properties have been processed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * **/ - public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException; + public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, + H5P_iterate_t op_data) throws HDF5LibraryException; // /////// Object creation property list (OCPL) routines /////// @@ -7243,7 +7497,7 @@ public class H5 implements java.io.Serializable { * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. * * @param ocpl_id - * IN: : Object (dataset or group) creation property list identifier + * IN: Object (dataset or group) creation property list identifier * @param attributes * The maximum and minimum no. of attributes to be stored. * @@ -7255,13 +7509,13 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * **/ public synchronized static native int H5Pget_attr_phase_change(long ocpl_id, int[] attributes) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_attr_phase_change sets threshold values for attribute storage on an object. These @@ -7277,14 +7531,16 @@ public class H5 implements java.io.Serializable { * IN: Minimum number of attributes to be stored in dense storage (Default: 6) * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native void H5Pset_attr_phase_change(long ocpl_id, int max_compact, int min_dense) - throws HDF5LibraryException; + public synchronized static native void H5Pset_attr_phase_change(long ocpl_id, int max_compact, + int min_dense) + throws HDF5LibraryException; /** - * H5Pget_attr_creation_order retrieves the settings for tracking and indexing attribute creation order on an object + * H5Pget_attr_creation_order retrieves the settings for tracking and indexing attribute creation order on + * an object. * * @param ocpl_id * IN: Object (group or dataset) creation property list identifier @@ -7292,14 +7548,15 @@ public class H5 implements java.io.Serializable { * @return Flags specifying whether to track and index attribute creation order * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_attr_creation_order(long ocpl_id) throws HDF5LibraryException; + public synchronized static native int H5Pget_attr_creation_order(long ocpl_id) + throws HDF5LibraryException; /** - * H5Pset_attr_creation_order sets flags specifying whether to track and index attribute creation order on an - * object. + * H5Pset_attr_creation_order sets flags specifying whether to track and index attribute creation order on + * an object. * * @param ocpl_id * IN: Object creation property list identifier @@ -7309,15 +7566,15 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_attr_creation_order(long ocpl_id, int crt_order_flags) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_obj_track_times queries the object creation property list, ocpl_id, to determine whether object times are - * being recorded. + * H5Pget_obj_track_times queries the object creation property list, ocpl_id, to determine whether object + * times are being recorded. * * @param ocpl_id * IN: Object creation property list identifier @@ -7325,14 +7582,15 @@ public class H5 implements java.io.Serializable { * @return TRUE or FALSE, specifying whether object times are being recorded * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native boolean H5Pget_obj_track_times(long ocpl_id) throws HDF5LibraryException; + public synchronized static native boolean H5Pget_obj_track_times(long ocpl_id) + throws HDF5LibraryException; /** - * H5Pset_obj_track_times sets a property in the object creation property list, ocpl_id, that governs the recording - * of times associated with an object. + * H5Pset_obj_track_times sets a property in the object creation property list, ocpl_id, that governs the + * recording of times associated with an object. * * @param ocpl_id * IN: Object creation property list identifier @@ -7341,11 +7599,11 @@ public class H5 implements java.io.Serializable { * IN: TRUE or FALSE, specifying whether object times are to be tracked * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_obj_track_times(long ocpl_id, boolean track_times) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pmodify_filter modifies the specified FILTER in the transient or permanent output filter pipeline @@ -7387,16 +7645,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name or an array is null. + * name or an array is null. * **/ public synchronized static native int H5Pmodify_filter(long plist, long filter, int flags, long cd_nelmts, - int[] cd_values) throws HDF5LibraryException, NullPointerException; + int[] cd_values) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_filter adds the specified filter and corresponding properties to the end of an output filter pipeline. + * H5Pset_filter adds the specified filter and corresponding properties to the end of an output filter + * pipeline. * * @param plist * IN: Property list identifier. @@ -7412,14 +7672,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_filter(long plist, int filter, int flags, long cd_nelmts, - int[] cd_values) throws HDF5LibraryException; + int[] cd_values) throws HDF5LibraryException; /** - * H5Pget_nfilters returns the number of filters defined in the filter pipeline associated with the property list - * plist. + * H5Pget_nfilters returns the number of filters defined in the filter pipeline associated with the + * property list plist. * * @param plist * IN: Property list identifier. @@ -7427,18 +7687,19 @@ public class H5 implements java.io.Serializable { * @return the number of filters in the pipeline if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pget_nfilters(long plist) throws HDF5LibraryException; /** - * H5Pget_filter returns information about a filter, specified by its filter number, in a filter pipeline, specified - * by the property list with which it is associated. + * H5Pget_filter returns information about a filter, specified by its filter number, in a filter pipeline, + * specified by the property list with which it is associated. * * @param plist * IN: Property list identifier. * @param filter_number - * IN: Sequence number within the filter pipeline of the filter for which information is sought. + * IN: Sequence number within the filter pipeline of the filter for which information is + * sought. * @param flags * OUT: Bit vector specifying certain general properties of the filter. * @param cd_nelmts @@ -7455,44 +7716,49 @@ public class H5 implements java.io.Serializable { * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). * * @exception ArrayIndexOutOfBoundsException - * Fatal error on Copyback + * Fatal error on Copyback * @exception ArrayStoreException - * Fatal error on Copyback + * Fatal error on Copyback * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name or an array is null. + * name or an array is null. * **/ - public static int H5Pget_filter(long plist, int filter_number, int[] flags, long[] cd_nelmts, int[] cd_values, - long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, - ArrayStoreException, HDF5LibraryException, NullPointerException { - return H5Pget_filter2(plist, filter_number, flags, cd_nelmts, cd_values, namelen, name, filter_config); + public static int H5Pget_filter(long plist, int filter_number, int[] flags, long[] cd_nelmts, + int[] cd_values, long namelen, String[] name, int[] filter_config) + throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, NullPointerException + { + return H5Pget_filter2(plist, filter_number, flags, cd_nelmts, cd_values, namelen, name, + filter_config); } /** - * H5Pget_filter2 returns information about a filter, specified by its filter number, in a filter pipeline, - * specified by the property list with which it is associated. + * H5Pget_filter2 returns information about a filter, specified by its filter number, in a filter + * pipeline, specified by the property list with which it is associated. * - * @see public static int H5Pget_filter(int plist, int filter_number, int[] flags, int[] cd_nelmts, int[] cd_values, - * int namelen, String[] name, int[] filter_config) + * @see public static int H5Pget_filter(int plist, int filter_number, int[] flags, int[] cd_nelmts, int[] + * cd_values, int namelen, String[] name, int[] filter_config) * **/ - private synchronized static native int H5Pget_filter2(long plist, int filter_number, int[] flags, long[] cd_nelmts, - int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, - ArrayStoreException, HDF5LibraryException, NullPointerException; + private synchronized static native int H5Pget_filter2(long plist, int filter_number, int[] flags, + long[] cd_nelmts, int[] cd_values, long namelen, + String[] name, int[] filter_config) + throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, + NullPointerException; /** - * H5Pget_filter_by_id returns information about the filter specified in filter_id, a filter identifier. plist_id - * must be a dataset or group creation property list and filter_id must be in the associated filter pipeline. The - * filter_id and flags parameters are used in the same manner as described in the discussion of H5Pset_filter. Aside - * from the fact that they are used for output, the parameters cd_nelmts and cd_values[] are used in the same manner - * as described in the discussion of H5Pset_filter. On input, the cd_nelmts parameter indicates the number of - * entries in the cd_values[] array allocated by the calling program; on exit it contains the number of values - * defined by the filter. On input, the namelen parameter indicates the number of characters allocated for the - * filter name by the calling program in the array name[]. On exit name[] contains the name of the filter with one - * character of the name in each element of the array. If the filter specified in filter_id is not set for the - * property list, an error will be returned and H5Pget_filter_by_id1 will fail. + * H5Pget_filter_by_id returns information about the filter specified in filter_id, a filter identifier. + * plist_id must be a dataset or group creation property list and filter_id must be in the associated + * filter pipeline. The filter_id and flags parameters are used in the same manner as described in the + * discussion of H5Pset_filter. Aside from the fact that they are used for output, the parameters + * cd_nelmts and cd_values[] are used in the same manner as described in the discussion of H5Pset_filter. + * On input, the cd_nelmts parameter indicates the number of entries in the cd_values[] array allocated by + * the calling program; on exit it contains the number of values defined by the filter. On input, the + * namelen parameter indicates the number of characters allocated for the filter name by the calling + * program in the array name[]. On exit name[] contains the name of the filter with one character of the + * name in each element of the array. If the filter specified in filter_id is not set for the property + * list, an error will be returned and H5Pget_filter_by_id1 will fail. * * @param plist_id * IN: Property list identifier. @@ -7514,24 +7780,26 @@ public class H5 implements java.io.Serializable { * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception ArrayIndexOutOfBoundsException - * Fatal error on Copyback + * Fatal error on Copyback * @exception ArrayStoreException - * Fatal error on Copyback + * Fatal error on Copyback * @exception NullPointerException - * - name or an array is null. + * name or an array is null. * **/ public static int H5Pget_filter_by_id(long plist_id, long filter_id, int[] flags, long[] cd_nelmts, - int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, - ArrayStoreException, HDF5LibraryException, NullPointerException { - return H5Pget_filter_by_id2(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, filter_config); + int[] cd_values, long namelen, String[] name, int[] filter_config) + throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, NullPointerException + { + return H5Pget_filter_by_id2(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, + filter_config); } /** - * H5Pget_filter_by_id2 returns information about a filter, specified by its filter id, in a filter pipeline, - * specified by the property list with which it is associated. + * H5Pget_filter_by_id2 returns information about a filter, specified by its filter id, in a filter + * pipeline, specified by the property list with which it is associated. * * @param plist_id * IN: Property list identifier. @@ -7553,15 +7821,15 @@ public class H5 implements java.io.Serializable { * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name or an array is null. + * name or an array is null. * **/ - public synchronized static native int H5Pget_filter_by_id2(long plist_id, long filter_id, int[] flags, - long[] cd_nelmts, int[] cd_values, long namelen, String[] name, int[] filter_config) - throws HDF5LibraryException, NullPointerException; - + public synchronized static native int + H5Pget_filter_by_id2(long plist_id, long filter_id, int[] flags, long[] cd_nelmts, int[] cd_values, + long namelen, String[] name, int[] filter_config) + throws HDF5LibraryException, NullPointerException; /** * H5Pall_filters_avail query to verify that all the filters set @@ -7575,10 +7843,10 @@ public class H5 implements java.io.Serializable { * FALSE if one or more filters not currently available. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5Pall_filters_avail(long dcpl_id) throws HDF5LibraryException, - NullPointerException; + public synchronized static native boolean H5Pall_filters_avail(long dcpl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Premove_filter deletes a filter from the dataset creation property list; @@ -7592,9 +7860,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value and the size of the user block; if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Premove_filter(long obj_id, long filter) throws HDF5LibraryException; + public synchronized static native int H5Premove_filter(long obj_id, long filter) + throws HDF5LibraryException; /** * H5Pset_deflate sets the compression method for a dataset. @@ -7607,7 +7876,7 @@ public class H5 implements java.io.Serializable { * @return non-negative if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_deflate(long plist, int level) throws HDF5LibraryException; @@ -7621,10 +7890,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value and the size of the user block; if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pset_fletcher32(long plist) + throws HDF5LibraryException, NullPointerException; // /////// File creation property list (FCPL) routines /////// @@ -7639,12 +7908,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value and the size of the user block; if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. **/ - public synchronized static native int H5Pget_userblock(long plist, long[] size) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pget_userblock(long plist, long[] size) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_userblock sets the user block size of a file creation property list. @@ -7657,13 +7926,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_userblock(long plist, long size) throws HDF5LibraryException; /** - * H5Pget_sizes retrieves the size of the offsets and lengths used in an HDF5 file. This function is only valid for - * file creation property lists. + * H5Pget_sizes retrieves the size of the offsets and lengths used in an HDF5 file. This function is only + * valid for file creation property lists. * * @param plist * IN: Identifier of property list to query. @@ -7677,14 +7946,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value with the sizes initialized; if successful; * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * @exception IllegalArgumentException - * - size is invalid. + * size is invalid. **/ - public synchronized static native int H5Pget_sizes(long plist, long[] size) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native int H5Pget_sizes(long plist, long[] size) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Pset_sizes sets the byte size of the offsets and lengths used to address objects in an HDF5 file. @@ -7699,13 +7968,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_sizes(long plist, int sizeof_addr, int sizeof_size) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_sym_k retrieves the size of the symbol table B-tree 1/2 rank and the symbol table leaf node 1/2 size. + * H5Pget_sym_k retrieves the size of the symbol table B-tree 1/2 rank and the symbol table leaf node 1/2 + * size. * * @param plist * IN: Property list to query. @@ -7720,14 +7990,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * @exception IllegalArgumentException - * - size is invalid. + * size is invalid. **/ - public synchronized static native int H5Pget_sym_k(long plist, int[] size) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native int H5Pget_sym_k(long plist, int[] size) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Pset_sym_k sets the size of parameters used to control the symbol table nodes. @@ -7742,9 +8012,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pset_sym_k(long plist, int ik, int lk) throws HDF5LibraryException; + public synchronized static native int H5Pset_sym_k(long plist, int ik, int lk) + throws HDF5LibraryException; /** * H5Pget_istore_k queries the 1/2 rank of an indexed storage B-tree. @@ -7757,15 +8028,16 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - ik array is null. + * ik array is null. **/ - public synchronized static native int H5Pget_istore_k(long plist, int[] ik) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pget_istore_k(long plist, int[] ik) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_istore_k sets the size of the parameter used to control the B-trees for indexing chunked datasets. + * H5Pset_istore_k sets the size of the parameter used to control the B-trees for indexing chunked + * datasets. * * @param plist * IN: Identifier of property list to query. @@ -7775,46 +8047,47 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_istore_k(long plist, int ik) throws HDF5LibraryException; /** - * H5Pget_shared_mesg_nindexes retrieves number of shared object header message indexes in file creation property - * list. + * H5Pget_shared_mesg_nindexes retrieves number of shared object header message indexes in file creation + * property list. * * @param fcpl_id * IN: : File creation property list identifier * - * @return nindexes, the number of shared object header message indexes available in files created with this - * property list + * @return nindexes, the number of shared object header message indexes available in files created with + * this property list * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_shared_mesg_nindexes(long fcpl_id) throws HDF5LibraryException; + public synchronized static native int H5Pget_shared_mesg_nindexes(long fcpl_id) + throws HDF5LibraryException; /** - * H5Pset_shared_mesg_nindexes sets the number of shared object header message indexes in the specified file - * creation property list. + * H5Pset_shared_mesg_nindexes sets the number of shared object header message indexes in the specified + * file creation property list. * * @param plist_id * IN: File creation property list * @param nindexes - * IN: Number of shared object header message indexes to be available in files created with this property - * list + * IN: Number of shared object header message indexes to be available in files created with + * this property list * * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid value of nindexes + * Invalid value of nindexes * **/ public synchronized static native int H5Pset_shared_mesg_nindexes(long plist_id, int nindexes) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_shared_mesg_index Retrieves the configuration settings for a shared message index. @@ -7834,15 +8107,16 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - mesg_info is null. + * mesg_info is null. * @exception IllegalArgumentException - * - Invalid value of nindexes + * Invalid value of nindexes * **/ - public synchronized static native int H5Pget_shared_mesg_index(long fcpl_id, int index_num, int[] mesg_info) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native int H5Pget_shared_mesg_index(long fcpl_id, int index_num, + int[] mesg_info) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Pset_shared_mesg_index Configures the specified shared object header message index @@ -7859,13 +8133,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid value of nindexes + * Invalid value of nindexes * **/ - public synchronized static native int H5Pset_shared_mesg_index(long fcpl_id, int index_num, int mesg_type_flags, - int min_mesg_size) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native int H5Pset_shared_mesg_index(long fcpl_id, int index_num, + int mesg_type_flags, int min_mesg_size) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_shared_mesg_phase_change retrieves shared object header message phase change information. @@ -7876,20 +8151,21 @@ public class H5 implements java.io.Serializable { * The threshold values for storage of shared object header message indexes in a file. * * <pre> - * size[0] = Threshold above which storage of a shared object header message index shifts from list to B-tree - * size[1] = Threshold below which storage of a shared object header message index reverts to list format + * size[0] = Threshold above which storage of a shared object header message index shifts from list + * to B-tree size[1] = Threshold below which storage of a shared object header message index reverts + * to list format * </pre> * * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * **/ public synchronized static native int H5Pget_shared_mesg_phase_change(long fcpl_id, int[] size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_shared_mesg_phase_change sets shared object header message storage phase change thresholds. @@ -7897,24 +8173,28 @@ public class H5 implements java.io.Serializable { * @param fcpl_id * IN: File creation property list identifier * @param max_list - * IN: Threshold above which storage of a shared object header message index shifts from list to B-tree + * IN: Threshold above which storage of a shared object header message index shifts from list + * to B-tree * @param min_btree - * IN: Threshold below which storage of a shared object header message index reverts to list format + * IN: Threshold below which storage of a shared object header message index reverts to list + * format * * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. + * Invalid values of max_list and min_btree. * **/ - public synchronized static native int H5Pset_shared_mesg_phase_change(long fcpl_id, int max_list, int min_btree) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native int H5Pset_shared_mesg_phase_change(long fcpl_id, int max_list, + int min_btree) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pset_file_space_strategy sets the file space management strategy for the file associated with fcpl_id to strategy. - * There are four strategies that applications can select and they are described in the Parameters section. + * H5Pset_file_space_strategy sets the file space management strategy for the file associated with fcpl_id + * to strategy. There are four strategies that applications can select and they are described in the + * Parameters section. * * @param fcpl_id * IN: File creation property list identifier @@ -7924,7 +8204,8 @@ public class H5 implements java.io.Serializable { * Mechanisms: free-space managers, aggregators, and virtual file drivers * This is the library default when not set. * H5F_FSPACE_STRATEGY_PAGE - * Mechanisms: free-space managers with embedded paged aggregation and virtual file drivers + * Mechanisms: free-space managers with embedded paged aggregation and virtual file + * drivers * H5F_FSPACE_STRATEGY_AGGR * Mechanisms: aggregators and virtual file drivers * H5F_FSPACE_STRATEGY_NONE @@ -7932,20 +8213,23 @@ public class H5 implements java.io.Serializable { * @param persist * IN: True to persist free-space. * @param threshold - * IN: The free-space section threshold. The library default is 1, which is to track all free-space sections. - * Passing a value of zero (0) indicates that the value of threshold is not to be modified. + * IN: The free-space section threshold. The library default is 1, which is to track all + * free-space sections. Passing a value of zero (0) indicates that the value of threshold + * is not to be modified. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. + * Invalid values of max_list and min_btree. * **/ - public synchronized static native void H5Pset_file_space_strategy(long fcpl_id, int strategy, boolean persist, long threshold) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native void H5Pset_file_space_strategy(long fcpl_id, int strategy, + boolean persist, long threshold) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_file_space_strategy provides the means for applications to manage the HDF5 file's file space strategy for their specific needs. + * H5Pget_file_space_strategy provides the means for applications to manage the HDF5 file's file space + * strategy for their specific needs. * * @param fcpl_id * IN: File creation property list identifier @@ -7957,16 +8241,18 @@ public class H5 implements java.io.Serializable { * @return the current free-space strategy. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. + * Invalid values of max_list and min_btree. * **/ - public synchronized static native int H5Pget_file_space_strategy(long fcpl_id, boolean[] persist, long[] threshold) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native int H5Pget_file_space_strategy(long fcpl_id, boolean[] persist, + long[] threshold) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_file_space_strategy_persist provides the means for applications to manage the HDF5 file's file space strategy for their specific needs. + * H5Pget_file_space_strategy_persist provides the means for applications to manage the HDF5 file's file + * space strategy for their specific needs. * * @param fcpl_id * IN: File creation property list identifier @@ -7974,16 +8260,17 @@ public class H5 implements java.io.Serializable { * @return the current free-space persistence. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. + * Invalid values of max_list and min_btree. * **/ public synchronized static native boolean H5Pget_file_space_strategy_persist(long fcpl_id) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_file_space_strategy_threshold provides the means for applications to manage the HDF5 file's file space strategy for their specific needs. + * H5Pget_file_space_strategy_threshold provides the means for applications to manage the HDF5 file's file + * space strategy for their specific needs. * * @param fcpl_id * IN: File creation property list identifier @@ -7991,54 +8278,55 @@ public class H5 implements java.io.Serializable { * @return the current free-space section threshold. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. - * - **/ - public synchronized static native long H5Pget_file_space_strategy_threshold(long fcpl_id) - throws HDF5LibraryException, IllegalArgumentException; - - /** - * H5Pset_file_space_page_size retrieves the file space page size for aggregating small metadata or raw data. - * - * @param fcpl_id - * IN: File creation property list identifier - * @param page_size - * IN: the file space page size. - * - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. - * - **/ - public synchronized static native void H5Pset_file_space_page_size(long fcpl_id, long page_size) - throws HDF5LibraryException, IllegalArgumentException; - - /** - * H5Pget_file_space_page_size Sets the file space page size for paged aggregation. - * - * @param fcpl_id - * IN: File creation property list identifier - * - * @return the current file space page size. - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - * @exception IllegalArgumentException - * - Invalid values of max_list and min_btree. - * - **/ - public synchronized static native long H5Pget_file_space_page_size(long fcpl_id) - throws HDF5LibraryException, IllegalArgumentException; + * Invalid values of max_list and min_btree. + * + **/ + public synchronized static native long H5Pget_file_space_strategy_threshold(long fcpl_id) + throws HDF5LibraryException, IllegalArgumentException; + /** + * H5Pset_file_space_page_size retrieves the file space page size for aggregating small metadata or raw + * data. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param page_size + * IN: the file space page size. + * + * + * @exception HDF5LibraryException + * Error from the HDF-5 Library. + * @exception IllegalArgumentException + * Invalid values of max_list and min_btree. + * + **/ + public synchronized static native void H5Pset_file_space_page_size(long fcpl_id, long page_size) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_file_space_page_size Sets the file space page size for paged aggregation. + * + * @param fcpl_id + * IN: File creation property list identifier + * + * @return the current file space page size. + * + * @exception HDF5LibraryException + * Error from the HDF-5 Library. + * @exception IllegalArgumentException + * Invalid values of max_list and min_btree. + * + **/ + public synchronized static native long H5Pget_file_space_page_size(long fcpl_id) + throws HDF5LibraryException, IllegalArgumentException; // /////// File access property list (FAPL) routines /////// /** - * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. + * H5Pget_alignment retrieves the current settings for alignment properties from a file access property + * list. * * @param plist * IN: Identifier of a file access property list. @@ -8052,18 +8340,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - alignment array is null. + * alignment array is null. * @exception IllegalArgumentException - * - alignment array is invalid. + * alignment array is invalid. **/ - public synchronized static native int H5Pget_alignment(long plist, long[] alignment) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native int H5Pget_alignment(long plist, long[] alignment) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * H5Pset_alignment sets the alignment properties of a file access property list so that any file object >= - * THRESHOLD bytes will be aligned on an address which is a multiple of ALIGNMENT. + * H5Pset_alignment sets the alignment properties of a file access property list so that any file object + * >= THRESHOLD bytes will be aligned on an address which is a multiple of ALIGNMENT. * * @param plist * IN: Identifier for a file access property list. @@ -8075,21 +8363,21 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_alignment(long plist, long threshold, long alignment) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_driver returns the identifier of the low-level file driver associated with the file access property list - * or data transfer property list plid. + * H5Pget_driver returns the identifier of the low-level file driver associated with the file access + * property list or data transfer property list plid. * * @param plid * IN: File access or data transfer property list identifier. * @return a valid low-level driver identifier if successful; a negative value if failed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. */ public synchronized static native long H5Pget_driver(long plid) throws HDF5LibraryException; @@ -8102,7 +8390,7 @@ public class H5 implements java.io.Serializable { * @return the offset. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native long H5Pget_family_offset(long fapl_id) throws HDF5LibraryException; @@ -8118,14 +8406,15 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_family_offset(long fapl_id, long offset) throws HDF5LibraryException; + public synchronized static native int H5Pset_family_offset(long fapl_id, long offset) + throws HDF5LibraryException; /** - * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes - * and the RDCC_W0 value in the raw data chunk cache. + * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible + * number of bytes and the RDCC_W0 value in the raw data chunk cache. * * @param plist * IN: Identifier of the file access property list. @@ -8141,16 +8430,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an array is null. + * an array is null. **/ public synchronized static native int H5Pget_cache(long plist, int[] mdc_nelmts, long[] rdcc_nelmts, - long[] rdcc_nbytes, double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + long[] rdcc_nbytes, double[] rdcc_w0) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in the - * raw data chunk cache. + * H5Pset_cache sets the number of elements (objects) in the meta data cache and the total number of bytes + * in the raw data chunk cache. * * @param plist * IN: Identifier of the file access property list. @@ -8166,14 +8456,15 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pset_cache(long plist, int mdc_nelmts, long rdcc_nelmts, long rdcc_nbytes, - double rdcc_w0) throws HDF5LibraryException; + public synchronized static native int H5Pset_cache(long plist, int mdc_nelmts, long rdcc_nelmts, + long rdcc_nbytes, double rdcc_w0) + throws HDF5LibraryException; /** - * H5Pget_mdc_config gets the initial metadata cache configuration contained in a file access property list. - * This configuration is used when the file is opened. + * H5Pget_mdc_config gets the initial metadata cache configuration contained in a file access property + * list. This configuration is used when the file is opened. * * @param plist_id * IN: Identifier of the file access property list. @@ -8181,14 +8472,15 @@ public class H5 implements java.io.Serializable { * @return A buffer(H5AC_cache_config_t) for the current metadata cache configuration information * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native H5AC_cache_config_t H5Pget_mdc_config(long plist_id) throws HDF5LibraryException; + public synchronized static native H5AC_cache_config_t H5Pget_mdc_config(long plist_id) + throws HDF5LibraryException; /** - * H5Pset_mdc_config sets the initial metadata cache configuration contained in a file access property list and - * loads it into the instance of H5AC_cache_config_t pointed to by the config_ptr parameter. This configuration is - * used when the file is opened. + * H5Pset_mdc_config sets the initial metadata cache configuration contained in a file access property + * list and loads it into the instance of H5AC_cache_config_t pointed to by the config_ptr parameter. This + * configuration is used when the file is opened. * * @param plist_id * IN: Identifier of the file access property list. @@ -8196,14 +8488,14 @@ public class H5 implements java.io.Serializable { * IN: H5AC_cache_config_t, the initial metadata cache configuration. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Pset_mdc_config(long plist_id, H5AC_cache_config_t config_ptr) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_gc_references Returns the current setting for the garbage collection references property from a file access - * property list. + * H5Pget_gc_references Returns the current setting for the garbage collection references property from a + * file access property list. * * @param fapl_id * IN File access property list @@ -8211,13 +8503,13 @@ public class H5 implements java.io.Serializable { * @return GC is on (true) or off (false) * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Pget_gc_references(long fapl_id) throws HDF5LibraryException; /** - * H5Pset_gc_references Sets the flag for garbage collecting references for the file. Default value for garbage - * collecting references is off. + * H5Pset_gc_references Sets the flag for garbage collecting references for the file. Default value for + * garbage collecting references is off. * * @param fapl_id * IN File access property list @@ -8227,10 +8519,10 @@ public class H5 implements java.io.Serializable { * @return non-negative if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_gc_references(long fapl_id, boolean gc_ref) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pget_fclose_degree returns the degree for the file close behavior for a file access @@ -8242,10 +8534,10 @@ public class H5 implements java.io.Serializable { * @return the degree for the file close behavior * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pget_fclose_degree(long fapl_id) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pget_fclose_degree(long fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fclose_degree sets the degree for the file close behavior. @@ -8258,10 +8550,10 @@ public class H5 implements java.io.Serializable { * @return non-negative if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pset_fclose_degree(long fapl_id, int degree) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pset_fclose_degree(long fapl_id, int degree) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_meta_block_size the current metadata block size setting. @@ -8272,7 +8564,7 @@ public class H5 implements java.io.Serializable { * @return the minimum size, in bytes, of metadata block allocations. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native long H5Pget_meta_block_size(long fapl_id) throws HDF5LibraryException; @@ -8286,14 +8578,15 @@ public class H5 implements java.io.Serializable { * IN: Minimum size, in bytes, of metadata block allocations. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native void H5Pset_meta_block_size(long fapl_id, long size) throws HDF5LibraryException; + public synchronized static native void H5Pset_meta_block_size(long fapl_id, long size) + throws HDF5LibraryException; /** * H5Pget_sieve_buf_size retrieves the current settings for the data sieve buffer size - * property from a file access property list. + * property from a file access property list. * * @param fapl_id * IN: Identifier for property list to query. @@ -8301,7 +8594,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value and the size of the user block; if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Pget_sieve_buf_size(long fapl_id) throws HDF5LibraryException; @@ -8323,12 +8616,14 @@ public class H5 implements java.io.Serializable { * IN: maximum size of the data seive buffer. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Pset_sieve_buf_size(long fapl_id, long size) throws HDF5LibraryException; + public synchronized static native void H5Pset_sieve_buf_size(long fapl_id, long size) + throws HDF5LibraryException; /** - * H5Pget_small_data_block_size retrieves the size of a block of small data in a file creation property list. + * H5Pget_small_data_block_size retrieves the size of a block of small data in a file creation property + * list. * * @param plist * IN: Identifier for property list to query. @@ -8336,13 +8631,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value and the size of the user block; if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Pget_small_data_block_size(long plist) throws HDF5LibraryException; + public synchronized static native long H5Pget_small_data_block_size(long plist) + throws HDF5LibraryException; /** - * H5Pset_small_data_block_size reserves blocks of size bytes for the contiguous storage of the raw data portion of - * small datasets. + * H5Pset_small_data_block_size reserves blocks of size bytes for the contiguous storage of the raw data + * portion of small datasets. * * @param plist * IN: Identifier of property list to modify. @@ -8352,14 +8648,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_small_data_block_size(long plist, long size) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_libver_bounds retrieves the lower and upper bounds on the HDF5 Library versions that indirectly determine - * the object formats versions used when creating objects in the file. + * H5Pget_libver_bounds retrieves the lower and upper bounds on the HDF5 Library versions that indirectly + * determine the object formats versions used when creating objects in the file. * * @param fapl_id * IN: File access property list identifier @@ -8374,17 +8670,17 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * **/ - public synchronized static native int H5Pget_libver_bounds(long fapl_id, int[] libver) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pget_libver_bounds(long fapl_id, int[] libver) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_libver_bounds Sets bounds on library versions, and indirectly format versions, to be used when creating - * objects + * H5Pset_libver_bounds Sets bounds on library versions, and indirectly format versions, to be used when + * creating objects * * @param fapl_id * IN: File access property list identifier @@ -8397,13 +8693,13 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Argument is Illegal + * Argument is Illegal * **/ public synchronized static native int H5Pset_libver_bounds(long fapl_id, int low, int high) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_elink_file_cache_size retrieves the size of the external link open file cache. @@ -8414,13 +8710,15 @@ public class H5 implements java.io.Serializable { * @return External link open file cache size in number of files. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_elink_file_cache_size(long fapl_id) throws HDF5LibraryException; + public synchronized static native int H5Pget_elink_file_cache_size(long fapl_id) + throws HDF5LibraryException; /** - * H5Pset_elink_file_cache_size sets the number of files that can be held open in an external link open file cache. + * H5Pset_elink_file_cache_size sets the number of files that can be held open in an external link open + * file cache. * * @param fapl_id * IN: File access property list identifier @@ -8428,11 +8726,11 @@ public class H5 implements java.io.Serializable { * IN: External link open file cache size in number of files. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_elink_file_cache_size(long fapl_id, int efc_size) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pset_mdc_log_options sets metadata cache logging options. @@ -8447,13 +8745,14 @@ public class H5 implements java.io.Serializable { * IN: Whether the logging begins as soon as the file is opened or created. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - location is null. + * location is null. * **/ - public synchronized static native void H5Pset_mdc_log_options(long fapl_id, boolean is_enabled, String location, boolean start_on_access) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Pset_mdc_log_options(long fapl_id, boolean is_enabled, + String location, boolean start_on_access) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_mdc_log_options gets metadata cache logging options. @@ -8463,19 +8762,21 @@ public class H5 implements java.io.Serializable { * @param mdc_log_options * the options * mdc_logging_options[0] = is_enabled, whether logging is enabled - * mdc_logging_options[1] = start_on_access, whether the logging begins as soon as the file is opened or created + * mdc_logging_options[1] = start_on_access, whether the logging begins as soon as the file is + * opened or created * * @return the location of log in UTF-8/ASCII (file path/name) (On Windows, this must be ASCII). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native String H5Pget_mdc_log_options(long fapl_id, boolean[] mdc_log_options) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_metadata_read_attempts retrieves the number of read attempts that is set in the file access property list plist_id. + * H5Pget_metadata_read_attempts retrieves the number of read attempts that is set in the file access + * property list plist_id. * * @param plist_id * IN: File access property list identifier @@ -8483,18 +8784,20 @@ public class H5 implements java.io.Serializable { * @return The number of read attempts. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native long H5Pget_metadata_read_attempts(long plist_id) throws HDF5LibraryException; + public synchronized static native long H5Pget_metadata_read_attempts(long plist_id) + throws HDF5LibraryException; /** - * H5Pset_metadata_read_attempts sets the number of reads that the library will try when reading checksummed - * metadata in an HDF5 file opened with SWMR access. When reading such metadata, the library will compare the - * checksum computed for the metadata just read with the checksum stored within the piece of checksum. When - * performing SWMR operations on a file, the checksum check might fail when the library reads data on a system - * that is not atomic. To remedy such situations, the library will repeatedly read the piece of metadata until - * the check passes or finally fails the read when the allowed number of attempts is reached. + * H5Pset_metadata_read_attempts sets the number of reads that the library will try when reading + * checksummed metadata in an HDF5 file opened with SWMR access. When reading such metadata, the library + * will compare the checksum computed for the metadata just read with the checksum stored within the piece + * of checksum. When performing SWMR operations on a file, the checksum check might fail when the library + * reads data on a system that is not atomic. To remedy such situations, the library will repeatedly read + * the piece of metadata until the check passes or finally fails the read when the allowed number of + * attempts is reached. * * @param plist_id * IN: File access property list identifier @@ -8502,15 +8805,15 @@ public class H5 implements java.io.Serializable { * IN: The number of read attempts which is a value greater than 0. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_metadata_read_attempts(long plist_id, long attempts) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 object - * will be evicted from the library's metadata cache when it is closed. + * H5Pget_evict_on_close retrieves the file access property list setting that determines whether an HDF5 + * object will be evicted from the library's metadata cache when it is closed. * * @param fapl_id * IN: File access property list identifier @@ -8518,14 +8821,14 @@ public class H5 implements java.io.Serializable { * @return indication if the object will be evicted on close. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native boolean H5Pget_evict_on_close(long fapl_id) - throws HDF5LibraryException; + public synchronized static native boolean H5Pget_evict_on_close(long fapl_id) throws HDF5LibraryException; /** - * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed object. + * H5Pset_evict_on_close controls the library's behavior of evicting metadata associated with a closed + * object. * * @param fapl_id * IN: File access property list identifier @@ -8533,11 +8836,11 @@ public class H5 implements java.io.Serializable { * IN: Whether the HDF5 object should be evicted on close. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_evict_on_close(long fapl_id, boolean evict_on_close) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pget_use_file_locking retrieves whether we are using file locking. @@ -8548,11 +8851,11 @@ public class H5 implements java.io.Serializable { * @return indication if file locking is used. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native boolean H5Pget_use_file_locking(long fapl_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pget_use_file_locking retrieves whether we ignore file locks when they are disabled. @@ -8563,11 +8866,11 @@ public class H5 implements java.io.Serializable { * @return indication if file locking is ignored. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native boolean H5Pget_ignore_disabled_file_locking(long fapl_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pset_file_locking sets parameters related to file locking. @@ -8576,17 +8879,19 @@ public class H5 implements java.io.Serializable { * IN: File access property list identifier * * @param use_file_locking - * IN: Whether the library will use file locking when opening files (mainly for SWMR semantics). + * IN: Whether the library will use file locking when opening files (mainly for SWMR + *semantics). * * @param ignore_when_disabled * IN: Whether file locking will be ignored when disabled on a file system (useful for Lustre). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native void H5Pset_file_locking(long fapl_id, boolean use_file_locking, boolean ignore_when_disabled) - throws HDF5LibraryException; + public synchronized static native void H5Pset_file_locking(long fapl_id, boolean use_file_locking, + boolean ignore_when_disabled) + throws HDF5LibraryException; // ///// unimplemented ///// // herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info); @@ -8601,11 +8906,11 @@ public class H5 implements java.io.Serializable { * @param plist * IN: Identifier for property list to query. * - * @return the layout type of a dataset creation property list if successful. Otherwise returns H5D_LAYOUT_ERROR - * (-1). + * @return the layout type of a dataset creation property list if successful. Otherwise returns + * H5D_LAYOUT_ERROR (-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pget_layout(long plist) throws HDF5LibraryException; @@ -8620,7 +8925,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_layout(long plist, int layout) throws HDF5LibraryException; @@ -8637,14 +8942,14 @@ public class H5 implements java.io.Serializable { * @return chunk dimensionality successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims array is null. + * dims array is null. * @exception IllegalArgumentException - * - max_ndims <=0 + * max_ndims <=0 **/ public synchronized static native int H5Pget_chunk(long plist, int max_ndims, long[] dims) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Pset_chunk sets the size of the chunks used to store a chunked layout dataset. @@ -8659,14 +8964,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims array is null. + * dims array is null. * @exception IllegalArgumentException - * - dims <=0 + * dims <=0 **/ - public synchronized static native int H5Pset_chunk(long plist, int ndims, byte[] dim) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native int H5Pset_chunk(long plist, int ndims, byte[] dim) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Pset_chunk sets the size of the chunks used to store a chunked layout dataset. @@ -8681,24 +8986,25 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims array is null. + * dims array is null. * @exception IllegalArgumentException - * - dims <=0 + * dims <=0 **/ - public synchronized static int H5Pset_chunk(long plist, int ndims, long[] dim) throws HDF5Exception, - NullPointerException, IllegalArgumentException { + public synchronized static int H5Pset_chunk(long plist, int ndims, long[] dim) + throws HDF5Exception, NullPointerException, IllegalArgumentException + { if (dim == null) { return -1; } HDFArray theArray = new HDFArray(dim); - byte[] thedims = theArray.byteify(); + byte[] thedims = theArray.byteify(); int retVal = H5Pset_chunk(plist, ndims, thedims); - thedims = null; + thedims = null; theArray = null; return retVal; } @@ -8711,28 +9017,35 @@ public class H5 implements java.io.Serializable { * and the name of the dataset, src_dset_name. * * @param dcpl_id - * IN: The identifier of the dataset creation property list that will be used when creating the virtual dataset. + * IN: The identifier of the dataset creation property list that will be used when creating the + * virtual dataset. * @param vspace_id - * IN: The dataspace identifier with the selection within the virtual dataset applied, possibly an unlimited selection. + * IN: The dataspace identifier with the selection within the virtual dataset applied, possibly + * an unlimited selection. * @param src_file_name - * IN: The name of the HDF5 file where the source dataset is located. The file might not exist yet. The name can be specified using a C-style printf statement. + * IN: The name of the HDF5 file where the source dataset is located. The file might not exist + * yet. The name can be specified using a C-style printf statement. * @param src_dset_name - * IN: The path to the HDF5 dataset in the file specified by src_file_name. The dataset might not exist yet. The dataset name can be specified using a C-style printf statement. + * IN: The path to the HDF5 dataset in the file specified by src_file_name. The dataset might + * not exist yet. The dataset name can be specified using a C-style printf statement. * @param src_space_id - * IN: The source dataset dataspace identifier with a selection applied, possibly an unlimited selection. + * IN: The source dataset dataspace identifier with a selection applied, possibly an unlimited + * selection. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an name string is null. + * an name string is null. * @exception IllegalArgumentException - * - An id is <=0 + * an id is <=0 **/ - public synchronized static native void H5Pset_virtual(long dcpl_id, long vspace_id, String src_file_name, String src_dset_name, long src_space_id) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native void H5Pset_virtual(long dcpl_id, long vspace_id, String src_file_name, + String src_dset_name, long src_space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * H5Pget_virtual_count gets the number of mappings for a virtual dataset that has the creation property list specified by dcpl_id. + * H5Pget_virtual_count gets the number of mappings for a virtual dataset that has the creation property + * list specified by dcpl_id. * * @param dcpl_id * IN: The identifier of the virtual dataset creation property list. @@ -8740,15 +9053,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative number of mappings if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - An id is <=0 + * An id is <=0 **/ - public synchronized static native long H5Pget_virtual_count(long dcpl_id) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native long H5Pget_virtual_count(long dcpl_id) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_virtual_vspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, - * and returns a dataspace identifier for the selection within the virtual dataset used in the mapping. + * H5Pget_virtual_vspace takes the dataset creation property list for the virtual dataset, dcpl_id, and + * the mapping index, index, and returns a dataspace identifier for the selection within the virtual + * dataset used in the mapping. * * @param dcpl_id * IN: The identifier of the virtual dataset creation property list. @@ -8758,15 +9073,17 @@ public class H5 implements java.io.Serializable { * @return a valid dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - An id is <=0 + * An id is <=0 **/ - public synchronized static native long H5Pget_virtual_vspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native long H5Pget_virtual_vspace(long dcpl_id, long index) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_virtual_srcspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, - * and returns a dataspace identifier for the selection within the source dataset used in the mapping. + * H5Pget_virtual_srcspace takes the dataset creation property list for the virtual dataset, dcpl_id, and + * the mapping index, index, and returns a dataspace identifier for the selection within the source + * dataset used in the mapping. * * @param dcpl_id * IN: The identifier of the virtual dataset creation property list. @@ -8776,15 +9093,17 @@ public class H5 implements java.io.Serializable { * @return a valid dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - An id is <=0 + * An id is <=0 **/ - public synchronized static native long H5Pget_virtual_srcspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native long H5Pget_virtual_srcspace(long dcpl_id, long index) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_virtual_filename takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, - * the size of the filename for a source dataset, size, and retrieves the name of the file for a source dataset used in the mapping. + * H5Pget_virtual_filename takes the dataset creation property list for the virtual dataset, dcpl_id, the + * mapping index, index, the size of the filename for a source dataset, size, and retrieves the name of + * the file for a source dataset used in the mapping. * * @param dcpl_id * IN: The identifier of the virtual dataset creation property list. @@ -8794,15 +9113,17 @@ public class H5 implements java.io.Serializable { * @return the name of the file containing the source dataset if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - An id is <=0 + * An id is <=0 **/ - public synchronized static native String H5Pget_virtual_filename(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native String H5Pget_virtual_filename(long dcpl_id, long index) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_virtual_dsetname takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, the - * size of the dataset name for a source dataset, size, and retrieves the name of the source dataset used in the mapping. + * H5Pget_virtual_dsetname takes the dataset creation property list for the virtual dataset, dcpl_id, the + * mapping index, index, the size of the dataset name for a source dataset, size, and retrieves the name + * of the source dataset used in the mapping. * * @param dcpl_id * IN: The identifier of the virtual dataset creation property list. @@ -8812,41 +9133,44 @@ public class H5 implements java.io.Serializable { * @return the name of the source dataset if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - An id is <=0 - **/ - public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; - -// ///// unimplemented ///// -// /** -// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. -// * -// * @param fapl_id -// * IN: File access property list identifier -// * -// * @return VDS link open file cache size in number of files. -// * -// * @exception HDF5LibraryException -// * - Error from the HDF-5 Library. -// * -// **/ -// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException; -// -// /** -// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache. -// * -// * @param fapl_id -// * IN: File access property list identifier -// * @param efc_size -// * IN: VDS link open file cache size in number of files. -// * -// * @exception HDF5LibraryException -// * - Error from the HDF-5 Library. -// * -// **/ -// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) -// throws HDF5LibraryException; + * An id is <=0 + **/ + public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) + throws HDF5LibraryException, IllegalArgumentException; + + // ///// unimplemented ///// + // /** + // * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache. + // * + // * @param fapl_id + // * IN: File access property list identifier + // * + // * @return VDS link open file cache size in number of files. + // * + // * @exception HDF5LibraryException + // * Error from the HDF-5 Library. + // * + // **/ + // public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws + // HDF5LibraryException; + // + // /** + // * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open + // * file cache. + // * + // * @param fapl_id + // * IN: File access property list identifier + // * @param efc_size + // * IN: VDS link open file cache size in number of files. + // * + // * @exception HDF5LibraryException + // * Error from the HDF-5 Library. + // * + // **/ + // public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size) + // throws HDF5LibraryException; /** * H5Pget_external returns information about an external file. @@ -8871,20 +9195,21 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception ArrayIndexOutOfBoundsException - * Fatal error on Copyback + * Fatal error on Copyback * @exception ArrayStoreException - * Fatal error on Copyback + * Fatal error on Copyback * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name or size is null. + * name or size is null. * @exception IllegalArgumentException - * - name_size <= 0 . + * name_size <= 0 . * **/ public synchronized static native int H5Pget_external(long plist, int idx, long name_size, String[] name, - long[] size) throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, - NullPointerException, IllegalArgumentException; + long[] size) + throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, + NullPointerException, IllegalArgumentException; /** * H5Pset_external adds an external file to the list of external files. @@ -8894,20 +9219,20 @@ public class H5 implements java.io.Serializable { * @param name * IN: Name of an external file. * @param offset - * IN: Offset, in bytes, from the beginning of the file to the location in the file where the data - * starts. + * IN: Offset, in bytes, from the beginning of the file to the location in the file where the + * data starts. * @param size * IN: Number of bytes reserved in the file for the data. * * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Pset_external(long plist, String name, long offset, long size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pget_external_count returns the number of external files for the specified dataset. @@ -8918,7 +9243,7 @@ public class H5 implements java.io.Serializable { * @return the number of external files if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pget_external_count(long plist) throws HDF5LibraryException; @@ -8935,11 +9260,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_szip(long plist, int options_mask, int pixels_per_block) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_shuffle Sets up the use of the shuffle filter. @@ -8950,11 +9275,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_shuffle(long plist_id) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pset_shuffle(long plist_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_nbit Sets up the use of the N-Bit filter. @@ -8965,7 +9290,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_nbit(long plist_id) throws HDF5LibraryException; @@ -8983,13 +9308,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid arguments + * Invalid arguments * **/ public synchronized static native int H5Pset_scaleoffset(long plist_id, int scale_type, int scale_factor) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_fill_value queries the fill value property of a dataset creation property list. @@ -9004,10 +9329,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error converting data array. + * Error converting data array. **/ public synchronized static native int H5Pget_fill_value(long plist_id, long type_id, byte[] value) - throws HDF5Exception; + throws HDF5Exception; /** * H5Pget_fill_value queries the fill value property of a dataset creation property list. @@ -9022,11 +9347,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error converting data array. + * Error converting data array. **/ - public synchronized static int H5Pget_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + public synchronized static int H5Pget_fill_value(long plist_id, long type_id, Object obj) + throws HDF5Exception + { HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.emptyBytes(); + byte[] buf = theArray.emptyBytes(); int status = H5Pget_fill_value(plist_id, type_id, buf); if (status >= 0) { @@ -9049,10 +9376,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error converting data array + * Error converting data array **/ public synchronized static native int H5Pset_fill_value(long plist_id, long type_id, byte[] value) - throws HDF5Exception; + throws HDF5Exception; /** * H5Pset_fill_value sets the fill value for a dataset creation property list. @@ -9067,15 +9394,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error converting data array + * Error converting data array **/ - public synchronized static int H5Pset_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + public synchronized static int H5Pset_fill_value(long plist_id, long type_id, Object obj) + throws HDF5Exception + { HDFArray theArray = new HDFArray(obj); - byte[] buf = theArray.byteify(); + byte[] buf = theArray.byteify(); int retVal = H5Pset_fill_value(plist_id, type_id, buf); - buf = null; + buf = null; theArray = null; return retVal; } @@ -9095,10 +9424,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error converting data array + * Error converting data array **/ public synchronized static native int H5Pfill_value_defined(long plist_id, int[] status) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_alloc_time Gets space allocation time for dataset during creation. @@ -9111,11 +9440,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pget_alloc_time(long plist_id, int[] alloc_time) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_alloc_time Sets space allocation time for dataset during creation. @@ -9128,11 +9457,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_alloc_time(long plist_id, int alloc_time) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pset_alloc_time(long plist_id, int alloc_time) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fill_time Gets fill value writing time. @@ -9145,10 +9474,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_fill_time(long plist_id, int[] fill_time) throws HDF5LibraryException; + public synchronized static native int H5Pget_fill_time(long plist_id, int[] fill_time) + throws HDF5LibraryException; /** * H5Pset_fill_time Sets the fill value writing time. @@ -9161,10 +9491,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException; + public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) + throws HDF5LibraryException; /** * H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list. @@ -9177,12 +9508,13 @@ public class H5 implements java.io.Serializable { * 0 - Disables option; partial edge chunks will be compressed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library + * Error from the HDF-5 Library **/ - public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) throws HDF5LibraryException; + public synchronized static native void H5Pset_chunk_opts(long dcpl_id, int opts) + throws HDF5LibraryException; /** - * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list . + * H5Pget_chunk_opts retrieves the edge chunk option setting stored in the dataset creation property list * * @param dcpl_id * IN: Dataset creation property list @@ -9190,13 +9522,14 @@ public class H5 implements java.io.Serializable { * @return The edge chunk option setting. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library - **/ + * Error from the HDF-5 Library + * + */ public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException; /** * H5Pget_dset_no_attrs_hint accesses the flag for whether or not datasets created by the given dcpl - * will be created with a "minimized" object header. + * will be created with a "minimized" object header. * * @param dcpl_id * IN: Dataset creation property list @@ -9204,33 +9537,32 @@ public class H5 implements java.io.Serializable { * @return true if the given dcpl is set to create minimized dataset object headers, false if not. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Pget_dset_no_attrs_hint(long dcpl_id) - throws HDF5LibraryException; - + throws HDF5LibraryException; /** * H5Pset_dset_no_attrs_hint sets the dcpl to minimize (or explicitly to not minimized) dataset object - * headers upon creation. + * headers upon creation. * * @param dcpl_id * IN: Dataset creation property list * * @param minimize - * the minimize hint setting + * IN: the minimize hint setting * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Pset_dset_no_attrs_hint(long dcpl_id, boolean minimize) - throws HDF5LibraryException; + throws HDF5LibraryException; // /////// Dataset access property list (DAPL) routines /////// /** - * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes - * and the RDCC_W0 value in the raw data chunk cache on a per-datset basis. + * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible + * number of bytes and the RDCC_W0 value in the raw data chunk cache on a per-datset basis. * * @param dapl_id * IN: Identifier of the dataset access property list. @@ -9242,16 +9574,17 @@ public class H5 implements java.io.Serializable { * IN/OUT: Preemption policy. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an array is null. + * an array is null. **/ - public synchronized static native void H5Pget_chunk_cache(long dapl_id, long[] rdcc_nslots, long[] rdcc_nbytes, - double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Pget_chunk_cache(long dapl_id, long[] rdcc_nslots, + long[] rdcc_nbytes, double[] rdcc_w0) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_chunk_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in - * the raw data chunk cache on a per-datset basis. + * H5Pset_chunk_cache sets the number of elements (objects) in the meta data cache and the total number of + * bytes in the raw data chunk cache on a per-datset basis. * * @param dapl_id * IN: Identifier of the dataset access property list. @@ -9263,10 +9596,11 @@ public class H5 implements java.io.Serializable { * IN: Preemption policy. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Pset_chunk_cache(long dapl_id, long rdcc_nslots, long rdcc_nbytes, - double rdcc_w0) throws HDF5LibraryException; + public synchronized static native void H5Pset_chunk_cache(long dapl_id, long rdcc_nslots, + long rdcc_nbytes, double rdcc_w0) + throws HDF5LibraryException; /** * H5Pset_virtual_view takes the access property list for the virtual dataset, dapl_id, and the flag, @@ -9278,9 +9612,10 @@ public class H5 implements java.io.Serializable { * IN: Flag specifying the extent of the data to be included in the view. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library + * Error from the HDF-5 Library **/ - public synchronized static native void H5Pset_virtual_view(long dapl_id, int view) throws HDF5LibraryException; + public synchronized static native void H5Pset_virtual_view(long dapl_id, int view) + throws HDF5LibraryException; /** * H5Pget_virtual_view takes the virtual dataset access property list, dapl_id, and retrieves the flag, @@ -9292,26 +9627,28 @@ public class H5 implements java.io.Serializable { * @return The flag specifying the view of the virtual dataset. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library - **/ + * Error from the HDF-5 Library + * + */ public synchronized static native int H5Pget_virtual_view(long dapl_id) throws HDF5LibraryException; /** - * H5Pset_virtual_printf_gap sets the access property list for the virtual dataset, dapl_id, to instruct the - * library to stop looking for the mapped data stored in the files and/or datasets with the printf-style names - * after not finding gap_size files and/or datasets. The found source files and datasets will determine the - * extent of the unlimited virtual dataset with the printf-style mappings. + * H5Pset_virtual_printf_gap sets the access property list for the virtual dataset, dapl_id, to instruct + * the library to stop looking for the mapped data stored in the files and/or datasets with the + * printf-style names after not finding gap_size files and/or datasets. The found source files and + * datasets will determine the extent of the unlimited virtual dataset with the printf-style mappings. * * @param dapl_id * IN: Dataset access property list identifier for the virtual dataset * @param gap_size * IN: Maximum number of files and/or datasets allowed to be missing for determining - * the extent of an unlimited virtual dataset with printf-style mappings. + * the extent of an unlimited virtual dataset with printf-style mappings. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library + * Error from the HDF-5 Library **/ - public synchronized static native void H5Pset_virtual_printf_gap(long dapl_id, long gap_size) throws HDF5LibraryException; + public synchronized static native void H5Pset_virtual_printf_gap(long dapl_id, long gap_size) + throws HDF5LibraryException; /** * H5Pget_virtual_printf_gap returns the maximum number of missing printf-style files and/or datasets for @@ -9325,9 +9662,11 @@ public class H5 implements java.io.Serializable { * the extent of an unlimited virtual dataset with printf-style mappings. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library - **/ - public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; + * Error from the HDF-5 Library + * + */ + public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) + throws HDF5LibraryException; /** * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths. @@ -9338,11 +9677,10 @@ public class H5 implements java.io.Serializable { * @return the prefix to be applied to virtual file paths. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native String H5Pget_virtual_prefix(long dapl_id) - throws HDF5LibraryException; + public synchronized static native String H5Pget_virtual_prefix(long dapl_id) throws HDF5LibraryException; /** * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths. @@ -9353,13 +9691,13 @@ public class H5 implements java.io.Serializable { * IN: Prefix to be applied to virtual file paths * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - prefix is null. + * prefix is null. * **/ public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pget_efile_prefix Retrieves prefix applied to external file paths. @@ -9370,11 +9708,10 @@ public class H5 implements java.io.Serializable { * @return the prefix to be applied to external file paths. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native String H5Pget_efile_prefix(long dapl_id) - throws HDF5LibraryException; + public synchronized static native String H5Pget_efile_prefix(long dapl_id) throws HDF5LibraryException; /** * H5Pset_efile_prefix Sets prefix to be applied to external file paths. @@ -9385,24 +9722,25 @@ public class H5 implements java.io.Serializable { * IN: Prefix to be applied to external file paths * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - prefix is null. + * prefix is null. * **/ public synchronized static native void H5Pset_efile_prefix(long dapl_id, String prefix) - throws HDF5LibraryException, NullPointerException; - - // public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; + throws HDF5LibraryException, NullPointerException; - // public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; + // public synchronized static native void H5Pset_append_flush(long plist_id, int ndims, long[] boundary, + // H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; + // public synchronized static native void H5Pget_append_flush(long plist_id, int dims, long[] boundary, + // H5D_append_cb func, H5D_append_t udata) throws HDF5LibraryException; // /////// Dataset xfer property list (DXPL) routines /////// /** - * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property - * list plist_id by H5Pset_data_transform. + * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer + * property list plist_id by H5Pset_data_transform. * * @param plist_id * IN: Identifier of the property list or class @@ -9411,18 +9749,19 @@ public class H5 implements java.io.Serializable { * @param expression * OUT: A data transform expression * - * @return The size of the transform expression if successful; 0(zero) if no transform expression exists. Otherwise - * returns a negative value. + * @return The size of the transform expression if successful; 0(zero) if no transform expression exists. + * Otherwise returns a negative value. * * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Size is <= 0. + * Size is <= 0. * **/ - public synchronized static native long H5Pget_data_transform(long plist_id, String[] expression, long size) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native long H5Pget_data_transform(long plist_id, String[] expression, + long size) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pset_data_transform sets a data transform expression @@ -9435,17 +9774,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative valule if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - expression is null. + * expression is null. * **/ public synchronized static native int H5Pset_data_transform(long plist_id, String expression) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * HH5Pget_buffer gets type conversion and background buffers. Returns buffer size, in bytes, if successful; - * otherwise 0 on failure. + * HH5Pget_buffer gets type conversion and background buffers. Returns buffer size, in bytes, if + * successful; otherwise 0 on failure. * * @param plist * Identifier for the dataset transfer property list. @@ -9457,12 +9796,12 @@ public class H5 implements java.io.Serializable { * @return buffer size, in bytes, if successful; otherwise 0 on failure * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - plist is invalid. + * plist is invalid. **/ public synchronized static native int H5Pget_buffer(long plist, byte[] tconv, byte[] bkg) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_buffer_size gets type conversion and background buffer size, in bytes, if successful; @@ -9474,26 +9813,27 @@ public class H5 implements java.io.Serializable { * @return buffer size, in bytes, if successful; otherwise 0 on failure * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - plist is invalid. + * plist is invalid. **/ public synchronized static native long H5Pget_buffer_size(long plist) - throws HDF5LibraryException, IllegalArgumentException; + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pset_buffer sets type conversion and background buffers. status to TRUE or FALSE. * - * Given a dataset transfer property list, H5Pset_buffer sets the maximum size for the type conversion buffer and - * background buffer and optionally supplies pointers to application-allocated buffers. If the buffer size is - * smaller than the entire amount of data being transferred between the application and the file, and a type - * conversion buffer or background buffer is required, then strip mining will be used. + * Given a dataset transfer property list, H5Pset_buffer sets the maximum size for the type conversion + * buffer and background buffer and optionally supplies pointers to application-allocated buffers. If the + * buffer size is smaller than the entire amount of data being transferred between the application and the + * file, and a type conversion buffer or background buffer is required, then strip mining will be used. * - * Note that there are minimum size requirements for the buffer. Strip mining can only break the data up along the - * first dimension, so the buffer must be large enough to accommodate a complete slice that encompasses all of the - * remaining dimensions. For example, when strip mining a 100x200x300 hyperslab of a simple data space, the buffer - * must be large enough to hold 1x200x300 data elements. When strip mining a 100x200x300x150 hyperslab of a simple - * data space, the buffer must be large enough to hold 1x200x300x150 data elements. + * Note that there are minimum size requirements for the buffer. Strip mining can only break the data up + * along the first dimension, so the buffer must be large enough to accommodate a complete slice that + * encompasses all of the remaining dimensions. For example, when strip mining a 100x200x300 hyperslab of + * a simple data space, the buffer must be large enough to hold 1x200x300 data elements. When strip mining + * a 100x200x300x150 hyperslab of a simple data space, the buffer must be large enough to hold + * 1x200x300x150 data elements. * * @param plist * Identifier for the dataset transfer property list. @@ -9501,12 +9841,12 @@ public class H5 implements java.io.Serializable { * Size, in bytes, of the type conversion and background buffers. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - plist is invalid. + * plist is invalid. **/ - public synchronized static native void H5Pset_buffer_size(long plist, long size) throws HDF5LibraryException, - IllegalArgumentException; + public synchronized static native void H5Pset_buffer_size(long plist, long size) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_edc_check gets the error-detecting algorithm in use. @@ -9517,7 +9857,7 @@ public class H5 implements java.io.Serializable { * @return the error-detecting algorithm * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pget_edc_check(long plist) throws HDF5LibraryException; @@ -9532,7 +9872,7 @@ public class H5 implements java.io.Serializable { * @return non-negative if succeed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Pset_edc_check(long plist, int check) throws HDF5LibraryException; @@ -9551,16 +9891,17 @@ public class H5 implements java.io.Serializable { * @return non-negative if succeed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. **/ public synchronized static native int H5Pget_btree_ratios(long plist_id, double[] left, double[] middle, - double[] right) throws HDF5LibraryException, NullPointerException; + double[] right) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_btree_ratio Sets B-tree split ratios for a dataset transfer property list. The split ratios determine what - * percent of children go in the first node when a node splits. + * H5Pset_btree_ratio Sets B-tree split ratios for a dataset transfer property list. The split ratios + * determine what percent of children go in the first node when a node splits. * * @param plist_id * IN Dataset transfer property list @@ -9574,10 +9915,10 @@ public class H5 implements java.io.Serializable { * @return non-negative if succeed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Pset_btree_ratios(long plist_id, double left, double middle, double right) - throws HDF5LibraryException; + public synchronized static native int H5Pset_btree_ratios(long plist_id, double left, double middle, + double right) throws HDF5LibraryException; /** * H5Pget_hyper_vector_size reads values previously set with H5Pset_hyper_vector_size. @@ -9590,11 +9931,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pget_hyper_vector_size(long dxpl_id, long[] vector_size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_hyper_vector_size sets the number of @@ -9604,7 +9945,7 @@ public class H5 implements java.io.Serializable { * Increasing the number should give better performance, but use * more memory during hyperslab I/O. The vector size must be * greater than 1. - *,p. + *<p> * The default is to use 1024 vectors for I/O during hyperslab * reading/writing. * @@ -9616,17 +9957,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; // /////// Link creation property list (LCPL) routines /////// /** - * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate - * groups. + * H5Pget_create_intermediate_group determines whether property is set to enable creating missing + * intermediate groups. * * @param lcpl_id * IN: Link creation property list identifier @@ -9634,14 +9975,15 @@ public class H5 implements java.io.Serializable { * @return Boolean true or false * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native boolean H5Pget_create_intermediate_group(long lcpl_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Pset_create_intermediate_group specifies in property list whether to create missing intermediate groups + * H5Pset_create_intermediate_group specifies in property list whether to create missing intermediate + * groups * * @param lcpl_id * IN: Link creation property list identifier @@ -9651,11 +9993,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative valule if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) - throws HDF5LibraryException; + public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, + boolean crt_intermed_group) + throws HDF5LibraryException; // /////// Group creation property list (GCPL) routines /////// @@ -9668,10 +10011,11 @@ public class H5 implements java.io.Serializable { * @return size_hint, the anticipated size of local heap * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native long H5Pget_local_heap_size_hint(long gcpl_id) throws HDF5LibraryException; + public synchronized static native long H5Pget_local_heap_size_hint(long gcpl_id) + throws HDF5LibraryException; /** * H5Pset_local_heap_size_hint Specifies the anticipated maximum size of a local heap. @@ -9684,11 +10028,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_local_heap_size_hint(long gcpl_id, long size_hint) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Pget_link_phase_change Queries the settings for conversion between compact and dense groups. @@ -9696,7 +10040,8 @@ public class H5 implements java.io.Serializable { * @param gcpl_id * IN: Group creation property list identifier * @param links - * The max. no. of compact links & the min. no. of dense links, which are used for storing groups + * The max. no. of compact links & the min. no. of dense links, which are used for storing + * groups * * <pre> * links[0] = The maximum number of links for compact storage @@ -9706,13 +10051,13 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * **/ public synchronized static native int H5Pget_link_phase_change(long gcpl_id, int[] links) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_link_phase_change Sets the parameters for conversion between compact and dense groups. @@ -9727,13 +10072,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values of max_compact and min_dense. + * Invalid values of max_compact and min_dense. * **/ - public synchronized static native int H5Pset_link_phase_change(long gcpl_id, int max_compact, int min_dense) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native int H5Pset_link_phase_change(long gcpl_id, int max_compact, + int min_dense) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_est_link_info Queries data required to estimate required local heap or object header size. @@ -9741,7 +10087,8 @@ public class H5 implements java.io.Serializable { * @param gcpl_id * IN: Group creation property list identifier * @param link_info - * Estimated number of links to be inserted into group And the estimated average length of link names + * Estimated number of links to be inserted into group And the estimated average length of link + * names * * <pre> * link_info[0] = Estimated number of links to be inserted into group @@ -9751,13 +10098,13 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - link_info is null. + * link_info is null. * **/ public synchronized static native int H5Pget_est_link_info(long gcpl_id, int[] link_info) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_est_link_info Sets estimated number of links and length of link names in a group. @@ -9772,17 +10119,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid values to est_num_entries and est_name_len. + * Invalid values to est_num_entries and est_name_len. * **/ - public synchronized static native int H5Pset_est_link_info(long gcpl_id, int est_num_entries, int est_name_len) - throws HDF5LibraryException, IllegalArgumentException; + public synchronized static native int H5Pset_est_link_info(long gcpl_id, int est_num_entries, + int est_name_len) + throws HDF5LibraryException, IllegalArgumentException; /** - * H5Pget_link_creation_order queries the group creation property list, gcpl_id, and returns a flag indicating - * whether link creation order is tracked and/or indexed in a group. + * H5Pget_link_creation_order queries the group creation property list, gcpl_id, and returns a flag + * indicating whether link creation order is tracked and/or indexed in a group. * * @param gcpl_id * IN: Group creation property list identifier @@ -9790,14 +10138,15 @@ public class H5 implements java.io.Serializable { * @return crt_order_flags -Creation order flag(s) * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_link_creation_order(long gcpl_id) throws HDF5LibraryException; + public synchronized static native int H5Pget_link_creation_order(long gcpl_id) + throws HDF5LibraryException; /** - * H5Pset_link_creation_order Sets flags in a group creation property list, gcpl_id, for tracking and/or indexing - * links on creation order. + * H5Pset_link_creation_order Sets flags in a group creation property list, gcpl_id, for tracking and/or + * indexing links on creation order. * * @param gcpl_id * IN: Group creation property list identifier @@ -9808,11 +10157,11 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) - throws HDF5LibraryException; + throws HDF5LibraryException; // /////// String creation property list (STRCPL) routines /////// @@ -9825,7 +10174,7 @@ public class H5 implements java.io.Serializable { * @return Returns the character encoding of the string. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException; @@ -9839,18 +10188,18 @@ public class H5 implements java.io.Serializable { * IN: the character encoding of the string * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding) - throws HDF5LibraryException; + throws HDF5LibraryException; // /////// Link access property list (LAPL) routines /////// /** - * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the - * library assumes it has found a cycle and aborts the traversal. This value is retrieved from the link access - * property list lapl_id. + * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, + * before the library assumes it has found a cycle and aborts the traversal. This value is retrieved from + * the link access property list lapl_id. * * @param lapl_id * IN: File access property list identifier @@ -9858,15 +10207,15 @@ public class H5 implements java.io.Serializable { * @return Returns a Maximum number of links to traverse. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native long H5Pget_nlinks(long lapl_id) throws HDF5LibraryException; /** - * H5Pset_nlinks sets the maximum number of soft or user-defined link traversals allowed, nlinks, before the library - * assumes it has found a cycle and aborts the traversal. This value is set in the link access property list - * lapl_id. + * H5Pset_nlinks sets the maximum number of soft or user-defined link traversals allowed, nlinks, before + * the library assumes it has found a cycle and aborts the traversal. This value is set in the link access + * property list lapl_id. * * @param lapl_id * IN: File access property list identifier @@ -9876,13 +10225,13 @@ public class H5 implements java.io.Serializable { * @return Returns a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Argument is Illegal + * Argument is Illegal * **/ - public synchronized static native int H5Pset_nlinks(long lapl_id, long nlinks) throws HDF5LibraryException, - IllegalArgumentException; + public synchronized static native int H5Pset_nlinks(long lapl_id, long nlinks) + throws HDF5LibraryException, IllegalArgumentException; /** * H5Pget_elink_prefix Retrieves prefix applied to external link paths. @@ -9892,17 +10241,17 @@ public class H5 implements java.io.Serializable { * @param prefix * OUT: Prefix applied to external link paths * - * @return If successful, returns a non-negative value specifying the size in bytes of the prefix without the NULL - * terminator; otherwise returns a negative value. + * @return If successful, returns a non-negative value specifying the size in bytes of the prefix without + * the NULL terminator; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - prefix is null. + * prefix is null. * **/ public synchronized static native long H5Pget_elink_prefix(long lapl_id, String[] prefix) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_elink_prefix Sets prefix to be applied to external link paths. @@ -9915,17 +10264,17 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - prefix is null. + * prefix is null. * **/ - public synchronized static native int H5Pset_elink_prefix(long lapl_id, String prefix) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Pset_elink_prefix(long lapl_id, String prefix) + throws HDF5LibraryException, NullPointerException; /** - * H5Pget_elink_fapl Retrieves the file access property list identifier associated with the link access property - * list. + * H5Pget_elink_fapl Retrieves the file access property list identifier associated with the link access + * property list. * * @param lapl_id * IN: Link access property list identifier @@ -9933,10 +10282,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public static long H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException { + public static long H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException + { long id = _H5Pget_elink_fapl(lapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Pget_elink_fapl add {}", id); @@ -9949,7 +10299,8 @@ public class H5 implements java.io.Serializable { private synchronized static native long _H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException; /** - * H5Pset_elink_fapl sets a file access property list for use in accessing a file pointed to by an external link. + * H5Pset_elink_fapl sets a file access property list for use in accessing a file pointed to by an + * external link. * * @param lapl_id * IN: Link access property list identifier @@ -9959,14 +10310,15 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_elink_fapl(long lapl_id, long fapl_id) throws HDF5LibraryException; + public synchronized static native int H5Pset_elink_fapl(long lapl_id, long fapl_id) + throws HDF5LibraryException; /** - * H5Pget_elink_acc_flags retrieves the external link traversal file access flag from the specified link access - * property list. + * H5Pget_elink_acc_flags retrieves the external link traversal file access flag from the specified link + * access property list. * * @param lapl_id * IN: Link access property list identifier @@ -9974,13 +10326,14 @@ public class H5 implements java.io.Serializable { * @return File access flag for link traversal. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pget_elink_acc_flags(long lapl_id) throws HDF5LibraryException; /** - * H5Pset_elink_acc_flags Sets the external link traversal file access flag in a link access property list. + * H5Pset_elink_acc_flags Sets the external link traversal file access flag in a link access property + * list. * * @param lapl_id * IN: Link access property list identifier @@ -9990,13 +10343,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception IllegalArgumentException - * - Invalid Flag values. + * Invalid Flag values. * **/ - public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, - IllegalArgumentException; + public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) + throws HDF5LibraryException, IllegalArgumentException; // /////// Object copy property list (OCPYPL) routines /////// @@ -10009,7 +10362,7 @@ public class H5 implements java.io.Serializable { * @return Copy option(s) set in the object copy property list * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pget_copy_object(long ocp_plist_id) throws HDF5LibraryException; @@ -10023,11 +10376,11 @@ public class H5 implements java.io.Serializable { * IN: Copy option(s) to be set * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) - throws HDF5LibraryException; + throws HDF5LibraryException; // /////// file drivers property list routines /////// @@ -10042,11 +10395,12 @@ public class H5 implements java.io.Serializable { * OUT: write to file name on flush setting * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, + boolean[] backing_store) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_core modifies the file access property list to use the H5FD_CORE driver. @@ -10061,11 +10415,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_core(long fapl_id, long increment, boolean backing_store) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_core(long fapl_id, long increment, + boolean backing_store) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_fapl_direct queries properties set by the H5Pset_fapl_direct. @@ -10080,10 +10435,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_fapl_direct(long fapl_id, long[] info) throws HDF5LibraryException; + public synchronized static native int H5Pget_fapl_direct(long fapl_id, long[] info) + throws HDF5LibraryException; /** * H5Pset_fapl_direct Sets up use of the direct I/O driver. @@ -10100,11 +10456,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_fapl_direct(long fapl_id, long alignment, long block_size, - long cbuf_size) throws HDF5LibraryException; + long cbuf_size) throws HDF5LibraryException; /** * H5Pget_fapl_family Returns information about the family file access property list. @@ -10119,11 +10475,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pget_fapl_family(long fapl_id, long[] memb_size, long[] memb_fapl_id) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pget_fapl_family(long fapl_id, long[] memb_size, + long[] memb_fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_family Sets up use of the direct I/O driver. @@ -10138,11 +10495,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ public synchronized static native int H5Pset_fapl_family(long fapl_id, long memb_size, long memb_fapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_hdfs Modify the file access property list to use the H5FD_HDFS driver. @@ -10155,10 +10512,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_hdfs(long fapl_id, H5FD_hdfs_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_hdfs(long fapl_id, H5FD_hdfs_fapl_t fapl_conf) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_fapl_hdfs gets the properties hdfs I/O driver. @@ -10169,10 +10527,11 @@ public class H5 implements java.io.Serializable { * @return the properties of the hdfs driver. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native H5FD_hdfs_fapl_t H5Pget_fapl_hdfs(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5FD_hdfs_fapl_t H5Pget_fapl_hdfs(long fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_fapl_multi Sets up use of the multi I/O driver. @@ -10186,19 +10545,21 @@ public class H5 implements java.io.Serializable { * @param memb_name * IN: Name generator for names of member files. * @param memb_addr - * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of - * data storage begins. + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each + * type of data storage begins. * * @return a boolean value; Allows read-only access to incomplete file sets when TRUE. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an array is null. + * an array is null. * **/ - public synchronized static native boolean H5Pget_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, - String[] memb_name, long[] memb_addr) throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Pget_fapl_multi(long fapl_id, int[] memb_map, + long[] memb_fapl, String[] memb_name, + long[] memb_addr) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_multi Sets up use of the multi I/O driver. @@ -10212,25 +10573,27 @@ public class H5 implements java.io.Serializable { * @param memb_name * IN: Name generator for names of member files. * @param memb_addr - * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of - * data storage begins. + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each + * type of data storage begins. * @param relax * IN: Allows read-only access to incomplete file sets when TRUE. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an array is null. + * an array is null. * **/ public synchronized static native void H5Pset_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, - String[] memb_name, long[] memb_addr, boolean relax) throws HDF5LibraryException, NullPointerException; - + String[] memb_name, long[] memb_addr, + boolean relax) + throws HDF5LibraryException, NullPointerException; /** - * H5Pset_fapl_log Sets up the logging virtual file driver (H5FD_LOG) for use. H5Pset_fapl_log modifies the file - * access property list to use the logging driver, H5FD_LOG. The logging virtual file driver (VFD) is a clone of the - * standard SEC2 (H5FD_SEC2) driver with additional facilities for logging VFD metrics and activity to a file. + * H5Pset_fapl_log Sets up the logging virtual file driver (H5FD_LOG) for use. H5Pset_fapl_log modifies + * the file access property list to use the logging driver, H5FD_LOG. The logging virtual file driver + * (VFD) is a clone of the standard SEC2 (H5FD_SEC2) driver with additional facilities for logging VFD + * metrics and activity to a file. * * @param fapl_id * IN: File access property list identifier. @@ -10242,12 +10605,13 @@ public class H5 implements java.io.Serializable { * IN: The size of the logging buffers, in bytes. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - logfile is null. + * logfile is null. **/ - public synchronized static native void H5Pset_fapl_log(long fapl_id, String logfile, long flags, long buf_size) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Pset_fapl_log(long fapl_id, String logfile, long flags, + long buf_size) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_sec2 Sets up use of the sec2 I/O driver. @@ -10258,10 +10622,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_sec2(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_sec2(long fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_split Sets up use of the split I/O driver. Makes the multi driver act like the @@ -10280,11 +10645,12 @@ public class H5 implements java.io.Serializable { * IN: File access property list identifier raw data * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native void H5Pset_fapl_split(long fapl_id, String meta_ext, long meta_plist_id, - String raw_ext, long raw_plist_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native void + H5Pset_fapl_split(long fapl_id, String meta_ext, long meta_plist_id, String raw_ext, long raw_plist_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_stdio Sets up use of the stdio I/O driver. @@ -10295,10 +10661,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_stdio(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_stdio(long fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_windows Sets up use of the windows I/O driver. @@ -10309,10 +10676,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_windows(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_windows(long fapl_id) + throws HDF5LibraryException, NullPointerException; /** * H5Pset_fapl_ros3 Modify the file access property list to use the H5FD_ROS3 driver. @@ -10325,10 +10693,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful; otherwise returns a negative value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native int H5Pset_fapl_ros3(long fapl_id, H5FD_ros3_fapl_t fapl_conf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Pset_fapl_ros3(long fapl_id, H5FD_ros3_fapl_t fapl_conf) + throws HDF5LibraryException, NullPointerException; /** * H5Pget_fapl_ros3 gets the properties of the ros3 I/O driver. @@ -10339,10 +10708,11 @@ public class H5 implements java.io.Serializable { * @return the properties of the ros3 driver. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * **/ - public synchronized static native H5FD_ros3_fapl_t H5Pget_fapl_ros3(long fapl_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native H5FD_ros3_fapl_t H5Pget_fapl_ros3(long fapl_id) + throws HDF5LibraryException, NullPointerException; // /////// unimplemented //////// @@ -10373,32 +10743,35 @@ public class H5 implements java.io.Serializable { // #endif /* H5_HAVE_PARALLEL */ // herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr); // herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/); - // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per); - // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc); - // herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); + // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned + // min_raw_per); + // herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned + // *min_raw_perc); herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data); // herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data); // Dataset creation property list (DCPL) routines // // Dataset access property list (DAPL) routines // - // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, void *user_data); - // herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], H5D_append_cb_t *func, void **user_data) + // herr_t H5Pset_append_flush (hid_t dapl_id, int ndims, const hsize_t boundary[], H5D_append_cb_t func, + // void *user_data); herr_t H5Pget_append_flush(hid_t dapl_id, int ndims, hsize_t boundary[], + // H5D_append_cb_t *func, void **user_data) // Dataset xfer property list (DXPL) routines // // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); // herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); // int H5Pget_preserve(hid_t plist_id); // herr_t H5Pset_filter_callback(hid_t plist, H5Z_filter_func_t func, void *op_data) - // herr_t H5Pget_vlen_mem_manager(hid_t plist, H5MM_allocate_t *alloc, void **alloc_info, H5MM_free_t *free, void + // herr_t H5Pget_vlen_mem_manager(hid_t plist, H5MM_allocate_t *alloc, void **alloc_info, H5MM_free_t + // *free, void // **free_info ) - // herr_t H5Pset_vlen_mem_manager(hid_t plist, H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void - // *free_info ) - // herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) + // herr_t H5Pset_vlen_mem_manager(hid_t plist, H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, + // void *free_info ) herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) // herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data) // #ifdef H5_HAVE_PARALLEL - // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode); - // herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode); - // herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause); + // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t + // *actual_chunk_opt_mode); herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t + // *actual_io_mode); herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t + // *local_no_collective_cause, uint32_t *global_no_collective_cause); // #endif /* H5_HAVE_PARALLEL */ // Link creation property list (LCPL) routines // @@ -10444,9 +10817,10 @@ public class H5 implements java.io.Serializable { * * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5PLset_loading_state(int plugin_flags) throws HDF5LibraryException; + public synchronized static native void H5PLset_loading_state(int plugin_flags) + throws HDF5LibraryException; /** * H5PLget_loading_state retrieves the state of the dynamic plugins flag, plugin_flags.. @@ -10458,7 +10832,7 @@ public class H5 implements java.io.Serializable { * If the value of plugin_flags is 0 (zero), all dynamic plugins are disabled. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5PLget_loading_state() throws HDF5LibraryException; @@ -10469,7 +10843,7 @@ public class H5 implements java.io.Serializable { * IN: Path for location of filter plugin libraries. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5PLappend(String plugin_path) throws HDF5LibraryException; @@ -10480,7 +10854,7 @@ public class H5 implements java.io.Serializable { * IN: Path for location of filter plugin libraries. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5PLprepend(String plugin_path) throws HDF5LibraryException; @@ -10493,9 +10867,10 @@ public class H5 implements java.io.Serializable { * IN: The table index (0-based). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5PLreplace(String plugin_path, int index) throws HDF5LibraryException; + public synchronized static native void H5PLreplace(String plugin_path, int index) + throws HDF5LibraryException; /** * H5PLinsert inserts the plugin path at the specified index. @@ -10506,9 +10881,10 @@ public class H5 implements java.io.Serializable { * IN: The table index (0-based). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5PLinsert(String plugin_path, int index) throws HDF5LibraryException; + public synchronized static native void H5PLinsert(String plugin_path, int index) + throws HDF5LibraryException; /** * H5PLremove removes the plugin path at the specified index. @@ -10517,7 +10893,7 @@ public class H5 implements java.io.Serializable { * IN: The table index (0-based). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5PLremove(int index) throws HDF5LibraryException; @@ -10530,7 +10906,7 @@ public class H5 implements java.io.Serializable { * @return the current path at the index in plugin path table * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native String H5PLget(int index) throws HDF5LibraryException; @@ -10540,7 +10916,7 @@ public class H5 implements java.io.Serializable { * @return the current number of paths in the plugin path table * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5PLsize() throws HDF5LibraryException; @@ -10565,14 +10941,14 @@ public class H5 implements java.io.Serializable { * @return the reference (byte[]) if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static native byte[] H5Rcreate_object(long loc_id, String name, long access_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rcreate_region creates the reference, pointing to the region represented by @@ -10590,14 +10966,15 @@ public class H5 implements java.io.Serializable { * @return the reference (byte[]) if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ - public synchronized static native byte[] H5Rcreate_region(long loc_id, String name, long space_id, long access_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native byte[] H5Rcreate_region(long loc_id, String name, long space_id, + long access_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rcreate_attr creates the reference, pointing to the attribute named attr name @@ -10615,14 +10992,15 @@ public class H5 implements java.io.Serializable { * @return the reference (byte[]) if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ - public synchronized static native byte[] H5Rcreate_attr(long loc_id, String name, String attr_name, long access_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native byte[] H5Rcreate_attr(long loc_id, String name, String attr_name, + long access_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rdestroy destroys a reference and releases resources. @@ -10631,14 +11009,14 @@ public class H5 implements java.io.Serializable { * IN: Reference to an object, region or attribute attached to an object. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static native void H5Rdestroy(byte[] ref_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // Info // @@ -10651,14 +11029,14 @@ public class H5 implements java.io.Serializable { * @return a valid reference type if successful; otherwise returns H5R UNKNOWN. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static native int H5Rget_type(byte[] ref_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Requal determines whether two references point to the same object, region or attribute. @@ -10671,14 +11049,14 @@ public class H5 implements java.io.Serializable { * @return true if equal, else false * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static native boolean H5Requal(byte[] ref1_ptr, byte[] ref2_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rcopy creates a copy of an existing reference. @@ -10689,14 +11067,14 @@ public class H5 implements java.io.Serializable { * @return a valid copy of the reference (byte[]) if successful. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static native byte[] H5Rcopy(byte[] src_ref_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // Dereference // @@ -10720,14 +11098,15 @@ public class H5 implements java.io.Serializable { * @return a valid identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public static long H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { long id = _H5Ropen_object(ref_ptr, rapl_id, oapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Ropen_object add {}", id); @@ -10738,12 +11117,13 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Ropen_object(byte[] ref_ptr, long rapl_id, long oapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Ropen region creates a copy of the dataspace of the dataset pointed to by a region reference, - * ref ptr, and defines a selection matching the selection pointed to by ref ptr within the dataspace copy. - * Use H5Sclose to release the dataspace identifier returned by this function when the identifier is no longer needed. + * ref ptr, and defines a selection matching the selection pointed to by ref ptr within the dataspace + * copy. Use H5Sclose to release the dataspace identifier returned by this function when the identifier is + * no longer needed. * * @param ref_ptr * IN: Reference to an object, region or attribute attached to an object. @@ -10759,14 +11139,15 @@ public class H5 implements java.io.Serializable { * @return a valid dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public static long H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { long id = _H5Ropen_region(ref_ptr, rapl_id, oapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Ropen_region add {}", id); @@ -10777,7 +11158,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Ropen_region(byte[] ref_ptr, long rapl_id, long oapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Ropen_attr opens the attribute attached to the object and returns an identifier. @@ -10798,14 +11179,15 @@ public class H5 implements java.io.Serializable { * @return a valid attribute identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public static long H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { long id = _H5Ropen_attr(ref_ptr, rapl_id, aapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Ropen_attr add {}", id); @@ -10816,7 +11198,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Ropen_attr(byte[] ref_ptr, long rapl_id, long aapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // Get type // @@ -10833,14 +11215,14 @@ public class H5 implements java.io.Serializable { * @return Returns the object type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - array is null. + * array is null. * @exception IllegalArgumentException - * - array is invalid. + * array is invalid. **/ public synchronized static native int H5Rget_obj_type3(byte[] ref_ptr, long rapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // Get name // @@ -10853,14 +11235,14 @@ public class H5 implements java.io.Serializable { * @return Returns the file name of the reference * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - array is null. + * array is null. * @exception IllegalArgumentException - * - array is invalid. + * array is invalid. **/ public synchronized static native String H5Rget_file_name(byte[] ref_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rget_obj_name retrieves the object name for the object, region or attribute reference pointed to. @@ -10875,14 +11257,14 @@ public class H5 implements java.io.Serializable { * @return Returns the object name of the reference * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - array is null. + * array is null. * @exception IllegalArgumentException - * - array is invalid. + * array is invalid. **/ public synchronized static native String H5Rget_obj_name(byte[] ref_ptr, long rapl_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rget_attr_name retrieves the attribute name for the object, region or attribute reference pointed to. @@ -10893,14 +11275,14 @@ public class H5 implements java.io.Serializable { * @return Returns the attribute name of the reference * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - array is null. + * array is null. * @exception IllegalArgumentException - * - array is invalid. + * array is invalid. **/ public synchronized static native String H5Rget_attr_name(byte[] ref_ptr) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // //////////////////////////////////////////////////////////// // // @@ -10908,12 +11290,13 @@ public class H5 implements java.io.Serializable { // // // //////////////////////////////////////////////////////////// - private synchronized static native int H5Rcreate(byte[] ref, long loc_id, String name, int ref_type, long space_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + private synchronized static native int H5Rcreate(byte[] ref, long loc_id, String name, int ref_type, + long space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * H5Rcreate creates the reference, ref, of the type specified in ref_type, pointing to the object name located at - * loc_id. + * H5Rcreate creates the reference, ref, of the type specified in ref_type, pointing to the object name + * located at loc_id. * * @param loc_id * IN: Location identifier used to locate the object being pointed to. @@ -10927,14 +11310,15 @@ public class H5 implements java.io.Serializable { * @return the reference (byte[]) if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static byte[] H5Rcreate(long loc_id, String name, int ref_type, long space_id) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { /* These sizes are correct for HDF5.1.2 */ int ref_size = 8; if (ref_type == HDF5Constants.H5R_DATASET_REGION) { @@ -10963,14 +11347,15 @@ public class H5 implements java.io.Serializable { * @return valid identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - output array is null. + * output array is null. * @exception IllegalArgumentException - * - output array is invalid. + * output array is invalid. **/ public static long H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { long id = _H5Rdereference(dataset, access_list, ref_type, ref); if (id > 0) { log.trace("OPEN_IDS: H5Rdereference add {}", id); @@ -10980,8 +11365,9 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + private synchronized static native long _H5Rdereference(long dataset, long access_list, int ref_type, + byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rget_name retrieves a name for the object identified by ref. @@ -10997,23 +11383,25 @@ public class H5 implements java.io.Serializable { * @param size * IN: The size of the name buffer. * - * @return Returns the length of the name if successful, returning 0 (zero) if no name is associated with the - * identifier. Otherwise returns a negative value. + * @return Returns the length of the name if successful, returning 0 (zero) if no name is associated with + * the identifier. Otherwise returns a negative value. * * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - size is null. + * size is null. * @exception IllegalArgumentException - * - Argument is illegal. + * Argument is illegal. * **/ - public synchronized static native long H5Rget_name(long loc_id, int ref_type, byte[] ref, String[] name, long size) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native long H5Rget_name(long loc_id, int ref_type, byte[] ref, String[] name, + long size) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * H5Rget_obj_type Given a reference to an object ref, H5Rget_obj_type returns the type of the object pointed to. + * H5Rget_obj_type Given a reference to an object ref, H5Rget_obj_type returns the type of the object + * pointed to. * * @param loc_id * IN: loc_id of the reference object. @@ -11025,26 +11413,27 @@ public class H5 implements java.io.Serializable { * @return Returns the object type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - array is null. + * array is null. * @exception IllegalArgumentException - * - array is invalid. + * array is invalid. **/ public synchronized static native int H5Rget_obj_type(long loc_id, int ref_type, byte ref[]) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Rget_obj_type2 Retrieves the type of object that an object reference points to. * * @see public static int H5Rget_obj_type(int loc_id, int ref_type, byte ref[]) **/ - private synchronized static native int H5Rget_obj_type2(long loc_id, int ref_type, byte ref[], int[] obj_type) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + private synchronized static native int H5Rget_obj_type2(long loc_id, int ref_type, byte ref[], + int[] obj_type) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * Given a reference to an object ref, H5Rget_region creates a copy of the dataspace of the dataset pointed to and - * defines a selection in the copy which is the region pointed to. + * Given a reference to an object ref, H5Rget_region creates a copy of the dataspace of the dataset + * pointed to and defines a selection in the copy which is the region pointed to. * * @param loc_id * IN: loc_id of the reference object. @@ -11056,14 +11445,15 @@ public class H5 implements java.io.Serializable { * @return a valid identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - output array is null. + * output array is null. * @exception IllegalArgumentException - * - output array is invalid. + * output array is invalid. **/ - public static long H5Rget_region(long loc_id, int ref_type, byte[] ref) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException { + public static long H5Rget_region(long loc_id, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { long id = _H5Rget_region(loc_id, ref_type, ref); if (id > 0) { log.trace("OPEN_IDS: H5Rget_region add {}", id); @@ -11074,7 +11464,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Rget_region(long loc_id, int ref_type, byte[] ref) - throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; // //////////////////////////////////////////////////////////// // // @@ -11093,9 +11483,10 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Screate(int type) throws HDF5LibraryException { + public static long H5Screate(int type) throws HDF5LibraryException + { long id = _H5Screate(type); if (id > 0) { log.trace("OPEN_IDS: H5Screate add {}", id); @@ -11120,12 +11511,13 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier * * @exception HDF5Exception - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims or maxdims is null. + * dims or maxdims is null. **/ - public static long H5Screate_simple(int rank, long[] dims, long[] maxdims) throws HDF5Exception, - NullPointerException { + public static long H5Screate_simple(int rank, long[] dims, long[] maxdims) + throws HDF5Exception, NullPointerException + { long id = _H5Screate_simple(rank, dims, maxdims); if (id > 0) { log.trace("OPEN_IDS: H5Screate_simple add {}", id); @@ -11136,7 +11528,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Screate_simple(int rank, long[] dims, long[] maxdims) - throws HDF5Exception, NullPointerException; + throws HDF5Exception, NullPointerException; /** * H5Sset_extent_simple sets or resets the size of an existing dataspace. @@ -11153,10 +11545,11 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Sset_extent_simple(long space_id, int rank, long[] current_size, - long[] maximum_size) throws HDF5LibraryException, NullPointerException; + long[] maximum_size) + throws HDF5LibraryException, NullPointerException; /** * H5Sset_extent_simple sets or resets the size of an existing dataspace. @@ -11173,14 +11566,16 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static long H5Sset_extent_simple(long space_id, int rank, byte[] current_size, - byte[] maximum_size) throws HDF5LibraryException, NullPointerException { - ByteBuffer csbb = ByteBuffer.wrap(current_size); - long[] lacs = (csbb.asLongBuffer()).array(); + byte[] maximum_size) + throws HDF5LibraryException, NullPointerException + { + ByteBuffer csbb = ByteBuffer.wrap(current_size); + long[] lacs = (csbb.asLongBuffer()).array(); ByteBuffer maxsbb = ByteBuffer.wrap(maximum_size); - long[] lamaxs = (maxsbb.asLongBuffer()).array(); + long[] lamaxs = (maxsbb.asLongBuffer()).array(); return H5Sset_extent_simple(space_id, rank, lacs, lamaxs); } @@ -11193,9 +11588,10 @@ public class H5 implements java.io.Serializable { * @return a dataspace identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Scopy(long space_id) throws HDF5LibraryException { + public static long H5Scopy(long space_id) throws HDF5LibraryException + { long id = _H5Scopy(space_id); if (id > 0) { log.trace("OPEN_IDS: H5Scopy add {}", id); @@ -11216,9 +11612,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Sclose(long space_id) throws HDF5LibraryException { + public static int H5Sclose(long space_id) throws HDF5LibraryException + { if (space_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -11239,9 +11636,10 @@ public class H5 implements java.io.Serializable { * @return the buffer for the object to be encoded into. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native byte[] H5Sencode(long obj_id) throws HDF5LibraryException, NullPointerException; + public synchronized static native byte[] H5Sencode(long obj_id) + throws HDF5LibraryException, NullPointerException; /** * H5Sdecode reconstructs the HDF5 data space object and returns a new object handle for it. @@ -11252,11 +11650,12 @@ public class H5 implements java.io.Serializable { * @return a new object handle * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native long H5Sdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native long H5Sdecode(byte[] buf) + throws HDF5LibraryException, NullPointerException; /** * H5Sget_simple_extent_npoints determines the number of elements in a dataspace. @@ -11266,9 +11665,10 @@ public class H5 implements java.io.Serializable { * @return the number of elements in the dataspace if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Sget_simple_extent_npoints(long space_id) throws HDF5LibraryException; + public synchronized static native long H5Sget_simple_extent_npoints(long space_id) + throws HDF5LibraryException; /** * H5Sget_simple_extent_ndims determines the dimensionality (or rank) of a dataspace. @@ -11279,13 +11679,14 @@ public class H5 implements java.io.Serializable { * @return the number of dimensions in the dataspace if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Sget_simple_extent_ndims(long space_id) throws HDF5LibraryException; + public synchronized static native int H5Sget_simple_extent_ndims(long space_id) + throws HDF5LibraryException; /** - * H5Sget_simple_extent_dims returns the size and maximum sizes of each dimension of a dataspace through the dims - * and maxdims parameters. + * H5Sget_simple_extent_dims returns the size and maximum sizes of each dimension of a dataspace through + * the dims and maxdims parameters. * * @param space_id * IN: Identifier of the dataspace object to query @@ -11297,12 +11698,13 @@ public class H5 implements java.io.Serializable { * @return the number of dimensions in the dataspace if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims or maxdims is null. + * dims or maxdims is null. **/ - public synchronized static native int H5Sget_simple_extent_dims(long space_id, long[] dims, long[] maxdims) - throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Sget_simple_extent_dims(long space_id, long[] dims, + long[] maxdims) + throws HDF5LibraryException, NullPointerException; /** * H5Sis_simple determines whether a dataspace is a simple dataspace. @@ -11313,7 +11715,7 @@ public class H5 implements java.io.Serializable { * @return true if is a simple dataspace * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Sis_simple(long space_id) throws HDF5LibraryException; @@ -11326,9 +11728,10 @@ public class H5 implements java.io.Serializable { * @return a dataspace class name if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Sget_simple_extent_type(long space_id) throws HDF5LibraryException; + public synchronized static native int H5Sget_simple_extent_type(long space_id) + throws HDF5LibraryException; /** * H5Sset_extent_none removes the extent from a dataspace and sets the type to H5S_NONE. @@ -11339,13 +11742,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Sset_extent_none(long space_id) throws HDF5LibraryException; /** - * H5Sextent_copy copies the extent from source_space_id to dest_space_id. This action may change the type of the - * dataspace. + * H5Sextent_copy copies the extent from source_space_id to dest_space_id. This action may change the type + * of the dataspace. * * @param dest_space_id * IN: The identifier for the dataspace from which the extent is copied. @@ -11355,13 +11758,14 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Sextent_copy(long dest_space_id, long source_space_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /** - * H5Sextent_equal determines whether the dataspace extents of two dataspaces, space1_id and space2_id, are equal. + * H5Sextent_equal determines whether the dataspace extents of two dataspaces, space1_id and space2_id, + * are equal. * * @param first_space_id * IN: The identifier for the first dataspace. @@ -11371,10 +11775,10 @@ public class H5 implements java.io.Serializable { * @return true if successful, else false * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Sextent_equal(long first_space_id, long second_space_id) - throws HDF5LibraryException; + throws HDF5LibraryException; /***************** Operations on dataspace selections *****************/ @@ -11387,7 +11791,7 @@ public class H5 implements java.io.Serializable { * @return the dataspace selection type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Sget_select_type(long space_id) throws HDF5LibraryException; @@ -11400,20 +11804,24 @@ public class H5 implements java.io.Serializable { * @return the number of elements in the selection if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Sget_select_npoints(long space_id) throws HDF5LibraryException; /** * H5Sselect_copy copies all the selection information (including offset) from the source * dataspace to the destination dataspace. - * @param dst_id ID of the destination dataspace - * @param src_id ID of the source dataspace + * + * @param dst_id + * ID of the destination dataspace + * @param src_id + * ID of the source dataspace * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Sselect_copy(long dst_id, long src_id) throws HDF5LibraryException; + public synchronized static native void H5Sselect_copy(long dst_id, long src_id) + throws HDF5LibraryException; /** * H5Sselect_valid verifies that the selection for the dataspace. @@ -11424,7 +11832,7 @@ public class H5 implements java.io.Serializable { * @return true if the selection is contained within the extent and FALSE if it is not or is an error. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Sselect_valid(long space_id) throws HDF5LibraryException; @@ -11437,18 +11845,17 @@ public class H5 implements java.io.Serializable { * Offset to subtract * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - offset is null. + * offset is null. **/ - public synchronized static native void H5Sselect_adjust(long space_id, long[][] offset) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Sselect_adjust(long space_id, long[][] offset) + throws HDF5LibraryException, NullPointerException; /** - * H5Sget_select_bounds retrieves the coordinates of the bounding box containing the current selection and places - * them into user-supplied buffers. - * <P> - * The start and end buffers must be large enough to hold the dataspace rank number of coordinates. + * H5Sget_select_bounds retrieves the coordinates of the bounding box containing the current selection and + * places them into user-supplied buffers. <P> The start and end buffers must be large enough to hold the + * dataspace rank number of coordinates. * * @param space_id * Identifier of dataspace to release. @@ -11460,50 +11867,54 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful,with start and end initialized. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - start or end is null. + * start or end is null. **/ public synchronized static native int H5Sget_select_bounds(long space_id, long[] start, long[] end) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Sselect_shape_same checks to see if the current selection in the dataspaces are the same * dimensionality and shape. * This is primarily used for reading the entire selection in one swoop. * - * @param space1_id ID of 1st Dataspace pointer to compare - * @param space2_id ID of 2nd Dataspace pointer to compare + * @param space1_id + * ID of 1st Dataspace pointer to compare + * @param space2_id + * ID of 2nd Dataspace pointer to compare * * @return true if the selection is the same dimensionality and shape; * false otherwise * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5Sselect_shape_same(long space1_id, long space2_id) throws HDF5LibraryException; + public synchronized static native boolean H5Sselect_shape_same(long space1_id, long space2_id) + throws HDF5LibraryException; /** * H5Sselect_intersect_block checks to see if the current selection in the * dataspace intersects with the block given. * * @param space_id - * ID of dataspace pointer to compare + * ID of dataspace pointer to compare * @param start - * Starting coordinate of block + * Starting coordinate of block * @param end - * Opposite ("ending") coordinate of block + * Opposite ("ending") coordinate of block * * @return a TRUE if the current selection in the dataspace intersects with the block given * FALSE otherwise * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - offset is null. + * offset is null. **/ - public synchronized static native boolean H5Sselect_intersect_block(long space_id, long[] start, long[] end) - throws HDF5LibraryException, NullPointerException; + public synchronized static native boolean H5Sselect_intersect_block(long space_id, long[] start, + long[] end) + throws HDF5LibraryException, NullPointerException; /** * H5Soffset_simple sets the offset of a simple dataspace space_id. @@ -11516,12 +11927,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - offset array is null. + * offset array is null. **/ - public synchronized static native int H5Soffset_simple(long space_id, byte[] offset) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Soffset_simple(long space_id, byte[] offset) + throws HDF5LibraryException, NullPointerException; /** * H5Soffset_simple sets the offset of a simple dataspace space_id. @@ -11534,22 +11945,22 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - offset array is null. + * offset array is null. **/ - public synchronized static int H5Soffset_simple(long space_id, long[] offset) throws HDF5Exception, - NullPointerException { - if (offset == null) { + public synchronized static int H5Soffset_simple(long space_id, long[] offset) + throws HDF5Exception, NullPointerException + { + if (offset == null) return -1; - } HDFArray theArray = new HDFArray(offset); - byte[] theArr = theArray.byteify(); + byte[] theArr = theArray.byteify(); int retVal = H5Soffset_simple(space_id, theArr); - theArr = null; + theArr = null; theArray = null; return retVal; } @@ -11563,7 +11974,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Sselect_all(long space_id) throws HDF5LibraryException; @@ -11575,7 +11986,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Sselect_none(long space_id) throws HDF5LibraryException; @@ -11594,10 +12005,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - private synchronized static native int H5Sselect_elements(long space_id, int op, int num_elements, byte[] coord) - throws HDF5LibraryException, NullPointerException; + private synchronized static native int H5Sselect_elements(long space_id, int op, int num_elements, + byte[] coord) + throws HDF5LibraryException, NullPointerException; /** * H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. @@ -11614,24 +12026,25 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5Exception - * - Error in the data conversion + * Error in the data conversion * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - cord array is + * cord array is **/ - public synchronized static int H5Sselect_elements(long space_id, int op, int num_elements, long[][] coord2D) - throws HDF5Exception, HDF5LibraryException, NullPointerException { - if (coord2D == null) { + public synchronized static int H5Sselect_elements(long space_id, int op, int num_elements, + long[][] coord2D) + throws HDF5Exception, HDF5LibraryException, NullPointerException + { + if (coord2D == null) return -1; - } HDFArray theArray = new HDFArray(coord2D); - byte[] coord = theArray.byteify(); + byte[] coord = theArray.byteify(); int retVal = H5Sselect_elements(space_id, op, num_elements, coord); - coord = null; + coord = null; theArray = null; return retVal; } @@ -11645,14 +12058,15 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Sget_select_elem_npoints(long spaceid) throws HDF5LibraryException; + public synchronized static native long H5Sget_select_elem_npoints(long spaceid) + throws HDF5LibraryException; /** - * H5Sget_select_elem_pointlist returns an array of of element points in the current dataspace selection. The point - * coordinates have the same dimensionality (rank) as the dataspace they are located within, one coordinate per - * point. + * H5Sget_select_elem_pointlist returns an array of of element points in the current dataspace selection. + * The point coordinates have the same dimensionality (rank) as the dataspace they are located within, one + * coordinate per point. * * @param spaceid * Identifier of dataspace to release. @@ -11666,16 +12080,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Sget_select_elem_pointlist(long spaceid, long startpoint, long numpoints, - long[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Sget_select_elem_pointlist(long spaceid, long startpoint, + long numpoints, long[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace specified - * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace + * specified by space_id. The start, stride, count, and block arrays must be the same size as the rank of + * the dataspace. * * @param space_id * IN: Identifier of dataspace selection to modify @@ -11693,29 +12109,32 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ public synchronized static int H5Sselect_hyperslab(long space_id, int op, byte[] start, byte[] stride, - byte[] count, byte[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException { - ByteBuffer startbb = ByteBuffer.wrap(start); - long[] lastart = (startbb.asLongBuffer()).array(); + byte[] count, byte[] block) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { + ByteBuffer startbb = ByteBuffer.wrap(start); + long[] lastart = (startbb.asLongBuffer()).array(); ByteBuffer stridebb = ByteBuffer.wrap(stride); - long[] lastride = (stridebb.asLongBuffer()).array(); - ByteBuffer countbb = ByteBuffer.wrap(count); - long[] lacount = (countbb.asLongBuffer()).array(); - ByteBuffer blockbb = ByteBuffer.wrap(block); - long[] lablock = (blockbb.asLongBuffer()).array(); + long[] lastride = (stridebb.asLongBuffer()).array(); + ByteBuffer countbb = ByteBuffer.wrap(count); + long[] lacount = (countbb.asLongBuffer()).array(); + ByteBuffer blockbb = ByteBuffer.wrap(block); + long[] lablock = (blockbb.asLongBuffer()).array(); return H5Sselect_hyperslab(space_id, op, lastart, lastride, lacount, lablock); } /** - * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace specified - * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace + * specified by space_id. The start, stride, count, and block arrays must be the same size as the rank of + * the dataspace. * * @param space_id * IN: Identifier of dataspace selection to modify @@ -11733,15 +12152,15 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ - public synchronized static native int H5Sselect_hyperslab(long space_id, int op, long[] start, long[] stride, - long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; - + public synchronized static native int H5Sselect_hyperslab(long space_id, int op, long[] start, + long[] stride, long[] count, long[] block) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Scombine_hyperslab combines a hyperslab selection with the current selection for a dataspace, @@ -11767,14 +12186,15 @@ public class H5 implements java.io.Serializable { * @return a dataspace ID on success / H5I_INVALID_HID on failure * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an input array is null. + * an input array is null. * @exception IllegalArgumentException - * - an input array is invalid. + * an input array is invalid. **/ - public synchronized static native long H5Scombine_hyperslab(long space_id, int op, long[] start, long[] stride, - long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native long H5Scombine_hyperslab(long space_id, int op, long[] start, + long[] stride, long[] count, long[] block) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Smodify_select refine an existing hyperslab selection with an operation, using a second @@ -11782,16 +12202,17 @@ public class H5 implements java.io.Serializable { * space1 operated on by space2. * * @param space1_id - * ID of the destination dataspace + * ID of the destination dataspace * @param op - * Operation to perform on current selection. + * Operation to perform on current selection. * @param space2_id - * ID of the source dataspace + * ID of the source dataspace * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Smodify_select(long space1_id, int op, long space2_id) throws HDF5LibraryException; + public synchronized static native void H5Smodify_select(long space1_id, int op, long space2_id) + throws HDF5LibraryException; /** * H5Scombine_select combines two existing hyperslab selections with an operation, returning @@ -11799,18 +12220,19 @@ public class H5 implements java.io.Serializable { * space1 is copied for the dataspace extent of the newly created dataspace. * * @param space1_id - * ID of the first dataspace + * ID of the first dataspace * @param op - * Operation to perform on current selection. + * Operation to perform on current selection. * @param space2_id - * ID of the second dataspace + * ID of the second dataspace * * @return a dataspace ID on success / H5I_INVALID_HID on failure * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Scombine_select(long space1_id, int op, long space2_id) throws HDF5LibraryException; + public synchronized static native long H5Scombine_select(long space1_id, int op, long space2_id) + throws HDF5LibraryException; /** * H5Sis_regular_hyperslab retrieves a regular hyperslab selection for the dataspace specified @@ -11822,50 +12244,56 @@ public class H5 implements java.io.Serializable { * @return a TRUE/FALSE for hyperslab selection if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5Sis_regular_hyperslab(long space_id) throws HDF5LibraryException; + public synchronized static native boolean H5Sis_regular_hyperslab(long space_id) + throws HDF5LibraryException; /** * H5Sget_regular_hyperslab determines if a hyperslab selection is regular for the dataspace specified - * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the + * dataspace. * * @param space_id * IN: Identifier of dataspace selection to modify * @param start - * OUT: Offset of start of hyperslab + * OUT: Offset of start of hyperslab * @param stride - * OUT: Hyperslab stride. + * OUT: Hyperslab stride. * @param count - * OUT: Number of blocks included in hyperslab. + * OUT: Number of blocks included in hyperslab. * @param block - * OUT: Size of block in hyperslab. + * OUT: Size of block in hyperslab. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - an output array is null. + * an output array is null. * @exception IllegalArgumentException - * - an output array is invalid. + * an output array is invalid. **/ - public synchronized static native void H5Sget_regular_hyperslab(long space_id, long[] start, long[] stride, long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + public synchronized static native void H5Sget_regular_hyperslab(long space_id, long[] start, + long[] stride, long[] count, long[] block) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; - /** - * H5Sget_select_hyper_nblocks returns the number of hyperslab blocks in the current dataspace selection. - * - * @param spaceid - * Identifier of dataspace to release. - * - * @return a non-negative value if successful - * - * @exception HDF5LibraryException - * - Error from the HDF-5 Library. - **/ - public synchronized static native long H5Sget_select_hyper_nblocks(long spaceid) throws HDF5LibraryException; + /** + * H5Sget_select_hyper_nblocks returns the number of hyperslab blocks in the current dataspace selection. + * + * @param spaceid + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_hyper_nblocks(long spaceid) + throws HDF5LibraryException; /** * H5Sget_select_hyper_blocklist returns an array of hyperslab blocks. The block coordinates have the same - * dimensionality (rank) as the dataspace they are located within. The list of blocks is formatted as follows: + * dimensionality (rank) as the dataspace they are located within. The list of blocks is formatted as + * follows: * * <pre> * <"start" coordinate>, immediately followed by @@ -11882,17 +12310,19 @@ public class H5 implements java.io.Serializable { * @param numblocks * number of blocks to retrieve * @param buf - * returns blocks startblock to startblock+num-1, each block is <i>rank</i> * 2 (corners) longs. + * returns blocks startblock to startblock+num-1, each block is <i>rank</i> * 2 (corners) + * longs. * * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Sget_select_hyper_blocklist(long spaceid, long startblock, long numblocks, - long[] buf) throws HDF5LibraryException, NullPointerException; + public synchronized static native int H5Sget_select_hyper_blocklist(long spaceid, long startblock, + long numblocks, long[] buf) + throws HDF5LibraryException, NullPointerException; /** * H5Sselect_project_intersection projects the intersection of the selections of src_space_id and @@ -11904,30 +12334,30 @@ public class H5 implements java.io.Serializable { * @param dst_space_id * Selection that is mapped to src_space_id * @param src_intersect_space_id - * Selection whose intersection with src_space_id is projected to dst_space_id to obtain the result + * Selection whose intersection with src_space_id is projected to dst_space_id to obtain the + * result * * @return a dataspace with a selection equal to the intersection of * src_intersect_space_id and src_space_id projected from src_space to dst_space on success * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5Sselect_project_intersection(long src_space_id, long dst_space_id, - long src_intersect_space_id) throws HDF5LibraryException; - - - // /////// unimplemented //////// - ///// Operations on dataspace selections ///// - - // - ///// Operations on dataspace selection iterators ///// - //public synchronized static native H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags); - //public synchronized static native H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq, - // size_t *nbytes, hsize_t *off, size_t *len); - //public synchronized static native H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id); - //public synchronized static native H5Ssel_iter_close(hid_t sel_iter_id); + public synchronized static native long + H5Sselect_project_intersection(long src_space_id, long dst_space_id, long src_intersect_space_id) + throws HDF5LibraryException; + // /////// unimplemented //////// + ///// Operations on dataspace selections ///// + // + ///// Operations on dataspace selection iterators ///// + // public synchronized static native H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned + // flags); public synchronized static native H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, + // size_t maxbytes, size_t *nseq, + // size_t *nbytes, hsize_t *off, size_t *len); + // public synchronized static native H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id); + // public synchronized static native H5Ssel_iter_close(hid_t sel_iter_id); // //////////////////////////////////////////////////////////// // // @@ -11948,12 +12378,13 @@ public class H5 implements java.io.Serializable { * @return a valid datatype identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dim is null. + * dim is null. **/ - public static long H5Tarray_create(long base_id, int ndims, long[] dim) throws HDF5LibraryException, - NullPointerException { + public static long H5Tarray_create(long base_id, int ndims, long[] dim) + throws HDF5LibraryException, NullPointerException + { long id = _H5Tarray_create2(base_id, ndims, dim); if (id > 0) { log.trace("OPEN_IDS: H5Tarray_create add {}", id); @@ -11964,7 +12395,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Tarray_create2(long base_id, int ndims, long[] dim) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tclose releases a datatype. @@ -11975,9 +12406,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Tclose(long type_id) throws HDF5LibraryException { + public static int H5Tclose(long type_id) throws HDF5LibraryException + { if (type_id < 0) return 0; // throw new HDF5LibraryException("Negative ID");; @@ -12006,16 +12438,17 @@ public class H5 implements java.io.Serializable { * IN: Datatype access property list. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native void H5Tcommit(long loc_id, String name, long type_id, long lcpl_id, - long tcpl_id, long tapl_id) throws HDF5LibraryException, NullPointerException; + long tcpl_id, long tapl_id) + throws HDF5LibraryException, NullPointerException; /** - * H5Tcommit_anon commits a transient datatype (not immutable) to a file, turning it into a named datatype with the - * specified creation and property lists. + * H5Tcommit_anon commits a transient datatype (not immutable) to a file, turning it into a named datatype + * with the specified creation and property lists. * * @param loc_id * IN: Location identifier. @@ -12027,14 +12460,14 @@ public class H5 implements java.io.Serializable { * IN: Datatype access property list. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Tcommit_anon(long loc_id, long type_id, long tcpl_id, long tapl_id) - throws HDF5LibraryException; + public synchronized static native void H5Tcommit_anon(long loc_id, long type_id, long tcpl_id, + long tapl_id) throws HDF5LibraryException; /** - * H5Tcommitted queries a type to determine whether the type specified by the type identifier is a named type or a - * transient type. + * H5Tcommitted queries a type to determine whether the type specified by the type identifier is a named + * type or a transient type. * * @param type_id * IN: Identifier of datatype. @@ -12042,13 +12475,13 @@ public class H5 implements java.io.Serializable { * @return true the datatype has been committed * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Tcommitted(long type_id) throws HDF5LibraryException; /** - * H5Tcompiler_conv finds out whether the library's conversion function from type src_id to type dst_id is a - * compiler (hard) conversion. + * H5Tcompiler_conv finds out whether the library's conversion function from type src_id to type dst_id is + * a compiler (hard) conversion. * * @param src_id * IN: Identifier of source datatype. @@ -12056,9 +12489,10 @@ public class H5 implements java.io.Serializable { * IN: Identifier of destination datatype. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Tcompiler_conv(long src_id, long dst_id) throws HDF5LibraryException; + public synchronized static native void H5Tcompiler_conv(long src_id, long dst_id) + throws HDF5LibraryException; /** ** H5Tconvert converts nelmts elements from the type specified by the src_id identifier to type dst_id. @@ -12077,12 +12511,13 @@ public class H5 implements java.io.Serializable { * IN: Dataset transfer property list identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ public synchronized static native void H5Tconvert(long src_id, long dst_id, long nelmts, byte[] buf, - byte[] background, long plist_id) throws HDF5LibraryException, NullPointerException; + byte[] background, long plist_id) + throws HDF5LibraryException, NullPointerException; // int H5Tconvert(int src_id, int dst_id, long nelmts, Pointer buf, Pointer background, int plist_id); @@ -12090,15 +12525,16 @@ public class H5 implements java.io.Serializable { * H5Tcopy copies an existing datatype. The returned type is always transient and unlocked. * * @param type_id - * IN: Identifier of datatype to copy. Can be a datatype identifier, a predefined datatype (defined in - * H5Tpublic.h), or a dataset Identifier. + * IN: Identifier of datatype to copy. Can be a datatype identifier, a predefined datatype + * (defined in H5Tpublic.h), or a dataset Identifier. * * @return a datatype identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tcopy(long type_id) throws HDF5LibraryException { + public static long H5Tcopy(long type_id) throws HDF5LibraryException + { long id = _H5Tcopy(type_id); if (id > 0) { log.trace("OPEN_IDS: H5Tcopy add {}", id); @@ -12121,9 +12557,10 @@ public class H5 implements java.io.Serializable { * @return datatype identifier * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tcreate(int tclass, long size) throws HDF5LibraryException { + public static long H5Tcreate(int tclass, long size) throws HDF5LibraryException + { long id = _H5Tcreate(tclass, size); if (id > 0) { log.trace("OPEN_IDS: H5Tcreate add {}", id); @@ -12144,11 +12581,12 @@ public class H5 implements java.io.Serializable { * @return a new object handle * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public static long H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException { + public static long H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException + { long id = _H5Tdecode(buf); if (id > 0) { log.trace("OPEN_IDS: H5Tdecode add {}", id); @@ -12158,11 +12596,12 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + private synchronized static native long _H5Tdecode(byte[] buf) + throws HDF5LibraryException, NullPointerException; /** - * H5Tdetect_class determines whether the datatype specified in dtype_id contains any datatypes of the datatype - * class specified in dtype_class. + * H5Tdetect_class determines whether the datatype specified in dtype_id contains any datatypes of the + * datatype class specified in dtype_class. * * @param type_id * IN: Identifier of datatype to query. @@ -12172,9 +12611,10 @@ public class H5 implements java.io.Serializable { * @return true if the datatype specified in dtype_id contains any datatypes of the datatype class * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5Tdetect_class(long type_id, int cls) throws HDF5LibraryException; + public synchronized static native boolean H5Tdetect_class(long type_id, int cls) + throws HDF5LibraryException; /** * H5Tencode converts a data type description into binary form in a buffer. @@ -12182,36 +12622,38 @@ public class H5 implements java.io.Serializable { * @param obj_id * IN: Identifier of the object to be encoded. * @param buf - * OUT: Buffer for the object to be encoded into. If the provided buffer is NULL, only the size of buffer - * needed is returned. + * OUT: Buffer for the object to be encoded into. If the provided buffer is NULL, only the size + * of buffer needed is returned. * @param nalloc * IN: The size of the allocated buffer. * * @return the size needed for the allocated buffer. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native int H5Tencode(long obj_id, byte[] buf, long nalloc) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Tencode(long obj_id, byte[] buf, long nalloc) + throws HDF5LibraryException, NullPointerException; // /** - // * H5Tencode converts a data type description into binary form in a buffer. - // * - // * @param obj_id IN: Identifier of the object to be encoded. - // * - // * @return the buffer for the object to be encoded into. - // * - // * @exception HDF5LibraryException - Error from the HDF-5 Library. - // **/ + // * H5Tencode converts a data type description into binary form in a buffer. + // * + // * @param obj_id + // * IN: Identifier of the object to be encoded. + // * + // * @return the buffer for the object to be encoded into. + // * + // * @exception HDF5LibraryException + // * Error from the HDF-5 Library. + // **/ // public synchronized static native byte[] H5Tencode(int obj_id) // throws HDF5LibraryException; /** - * H5Tenum_create creates a new enumeration datatype based on the specified base datatype, parent_id, which must be - * an integer type. + * H5Tenum_create creates a new enumeration datatype based on the specified base datatype, parent_id, + * which must be an integer type. * * @param base_id * IN: Identifier of the parent datatype to release. @@ -12219,9 +12661,10 @@ public class H5 implements java.io.Serializable { * @return the datatype identifier for the new enumeration datatype * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tenum_create(long base_id) throws HDF5LibraryException { + public static long H5Tenum_create(long base_id) throws HDF5LibraryException + { long id = _H5Tenum_create(base_id); if (id > 0) { log.trace("OPEN_IDS: H5Tenum_create add {}", id); @@ -12244,12 +12687,12 @@ public class H5 implements java.io.Serializable { * IN: The value of the member, data of the correct type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native void H5Tenum_insert(long type, String name, byte[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tenum_insert inserts a new enumeration datatype member into an enumeration datatype. @@ -12264,12 +12707,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static int H5Tenum_insert(long type, String name, int[] value) throws HDF5LibraryException, - NullPointerException { + public static int H5Tenum_insert(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException + { return H5Tenum_insert_int(type, name, value); } @@ -12286,21 +12730,23 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static int H5Tenum_insert(long type, String name, int value) throws HDF5LibraryException, - NullPointerException { - int[] val = { value }; + public static int H5Tenum_insert(long type, String name, int value) + throws HDF5LibraryException, NullPointerException + { + int[] val = {value}; return H5Tenum_insert_int(type, name, val); } private synchronized static native int H5Tenum_insert_int(long type, String name, int[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration + * datatype type. * * @param type * IN: Identifier of datatype. @@ -12312,17 +12758,18 @@ public class H5 implements java.io.Serializable { * @return the symbol name. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - value is null. + * value is null. **/ public synchronized static native String H5Tenum_nameof(long type, byte[] value, long size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; // int H5Tenum_nameof(int type, Pointer value, Buffer name/* out */, long size); /** - * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration + * datatype type. * * @param type * IN: Identifier of datatype. @@ -12336,20 +12783,22 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static int H5Tenum_nameof(long type, int[] value, String[] name, int size) throws HDF5LibraryException, - NullPointerException { + public static int H5Tenum_nameof(long type, int[] value, String[] name, int size) + throws HDF5LibraryException, NullPointerException + { return H5Tenum_nameof_int(type, value, name, size); } private synchronized static native int H5Tenum_nameof_int(long type, int[] value, String[] name, int size) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype + * type. * * @param type * IN: Identifier of datatype. @@ -12359,13 +12808,14 @@ public class H5 implements java.io.Serializable { * OUT: The value of the member * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Tenum_valueof(long type, String name, byte[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype + * type. * * @param type * IN: Identifier of datatype. @@ -12377,17 +12827,18 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static int H5Tenum_valueof(long type, String name, int[] value) throws HDF5LibraryException, - NullPointerException { + public static int H5Tenum_valueof(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException + { return H5Tenum_valueof_int(type, name, value); } private synchronized static native int H5Tenum_valueof_int(long type, String name, int[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tequal determines whether two datatype identifiers refer to the same datatype. @@ -12400,9 +12851,10 @@ public class H5 implements java.io.Serializable { * @return true if the datatype identifiers refer to the same datatype, else false. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5Tequal(long type_id1, long type_id2) throws HDF5LibraryException; + public synchronized static native boolean H5Tequal(long type_id1, long type_id2) + throws HDF5LibraryException; /** * H5Tget_array_dims returns the sizes of the dimensions of the specified array datatype object. @@ -12415,11 +12867,13 @@ public class H5 implements java.io.Serializable { * @return the non-negative number of dimensions of the array type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims is null. + * dims is null. **/ - public static int H5Tget_array_dims(long type_id, long[] dims) throws HDF5LibraryException, NullPointerException { + public static int H5Tget_array_dims(long type_id, long[] dims) + throws HDF5LibraryException, NullPointerException + { return H5Tget_array_dims2(type_id, dims); } @@ -12434,12 +12888,12 @@ public class H5 implements java.io.Serializable { * @return the non-negative number of dimensions of the array type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - dims is null. + * dims is null. **/ - public synchronized static native int H5Tget_array_dims2(long type_id, long[] dims) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Tget_array_dims2(long type_id, long[] dims) + throws HDF5LibraryException, NullPointerException; /** * H5Tget_array_ndims returns the rank, the number of dimensions, of an array datatype object. @@ -12450,7 +12904,7 @@ public class H5 implements java.io.Serializable { * @return the rank of the array * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_array_ndims(long type_id) throws HDF5LibraryException; @@ -12463,7 +12917,7 @@ public class H5 implements java.io.Serializable { * @return datatype class identifier if successful; otherwise H5T_NO_CLASS(-1). * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_class(long type_id) throws HDF5LibraryException; @@ -12476,7 +12930,8 @@ public class H5 implements java.io.Serializable { * @return class name if successful; otherwise H5T_NO_CLASS. * **/ - public static String H5Tget_class_name(long class_id) { + public static String H5Tget_class_name(long class_id) + { String retValue = null; if (HDF5Constants.H5T_INTEGER == class_id) /* integer types */ retValue = "H5T_INTEGER"; @@ -12492,7 +12947,7 @@ public class H5 implements java.io.Serializable { retValue = "H5T_OPAQUE"; else if (HDF5Constants.H5T_COMPOUND == class_id) /* compound types */ retValue = "H5T_COMPOUND"; - else if (HDF5Constants.H5T_REFERENCE == class_id)/* reference types */ + else if (HDF5Constants.H5T_REFERENCE == class_id) /* reference types */ retValue = "H5T_REFERENCE"; else if (HDF5Constants.H5T_ENUM == class_id) /* enumeration types */ retValue = "H5T_ENUM"; @@ -12507,8 +12962,8 @@ public class H5 implements java.io.Serializable { } /** - * H5Tget_create_plist returns a property list identifier for the datatype creation property list associated with - * the datatype specified by type_id. + * H5Tget_create_plist returns a property list identifier for the datatype creation property list + * associated with the datatype specified by type_id. * * @param type_id * IN: Identifier of datatype. @@ -12516,9 +12971,10 @@ public class H5 implements java.io.Serializable { * @return a datatype property list identifier. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tget_create_plist(long type_id) throws HDF5LibraryException { + public static long H5Tget_create_plist(long type_id) throws HDF5LibraryException + { long id = _H5Tget_create_plist(type_id); if (id > 0) { log.trace("OPEN_IDS: _H5Tget_create_plist add {}", id); @@ -12539,7 +12995,7 @@ public class H5 implements java.io.Serializable { * @return a valid character set type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_cset(long type_id) throws HDF5LibraryException; @@ -12554,7 +13010,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_cset(long type_id, int cset) throws HDF5LibraryException; @@ -12567,7 +13023,7 @@ public class H5 implements java.io.Serializable { * @return the bias if successful; otherwise 0. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_ebias(long type_id) throws HDF5LibraryException; @@ -12582,10 +13038,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Tset_ebias(long type_id, int ebias) throws HDF5LibraryException { - H5Tset_ebias(type_id, (long) ebias); + public static int H5Tset_ebias(long type_id, int ebias) throws HDF5LibraryException + { + H5Tset_ebias(type_id, (long)ebias); return 0; } @@ -12598,7 +13055,7 @@ public class H5 implements java.io.Serializable { * @return the bias * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Tget_ebias_long(long type_id) throws HDF5LibraryException; @@ -12611,12 +13068,13 @@ public class H5 implements java.io.Serializable { * IN: Exponent bias value. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Tset_ebias(long type_id, long ebias) throws HDF5LibraryException; /** - * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point + * datatype. * * @param type_id * IN: Identifier of datatype to query. @@ -12631,17 +13089,18 @@ public class H5 implements java.io.Serializable { * </ul> * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - fields is null. + * fields is null. * @exception IllegalArgumentException - * - fields array is invalid. + * fields array is invalid. **/ - public synchronized static native void H5Tget_fields(long type_id, long[] fields) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + public synchronized static native void H5Tget_fields(long type_id, long[] fields) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** - * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point + * datatype. * * @param type_id * IN: Identifier of datatype to query. @@ -12659,19 +13118,20 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - fields is null. + * fields is null. * @exception IllegalArgumentException - * - fields array is invalid. + * fields array is invalid. **/ - public static int H5Tget_fields(long type_id, int[] fields) throws HDF5LibraryException, NullPointerException, - IllegalArgumentException { + public static int H5Tget_fields(long type_id, int[] fields) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException + { return H5Tget_fields_int(type_id, fields); } - private synchronized static native int H5Tget_fields_int(long type_id, int[] fields) throws HDF5LibraryException, - NullPointerException, IllegalArgumentException; + private synchronized static native int H5Tget_fields_int(long type_id, int[] fields) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; /** * H5Tset_fields sets the locations and sizes of the various floating point bit fields. @@ -12690,10 +13150,10 @@ public class H5 implements java.io.Serializable { * IN: Size of mantissa in bits. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Tset_fields(long type_id, long spos, long epos, long esize, long mpos, - long msize) throws HDF5LibraryException; + public synchronized static native void H5Tset_fields(long type_id, long spos, long epos, long esize, + long mpos, long msize) throws HDF5LibraryException; /** * H5Tset_fields sets the locations and sizes of the various floating point bit fields. @@ -12714,11 +13174,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public static int H5Tset_fields(long type_id, int spos, int epos, int esize, int mpos, int msize) - throws HDF5LibraryException { - H5Tset_fields(type_id, (long) spos, (long) epos, (long) esize, (long) mpos, (long) msize); + throws HDF5LibraryException + { + H5Tset_fields(type_id, (long)spos, (long)epos, (long)esize, (long)mpos, (long)msize); return 0; } @@ -12731,14 +13192,14 @@ public class H5 implements java.io.Serializable { * @return a valid padding type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_inpad(long type_id) throws HDF5LibraryException; /** - * If any internal bits of a floating point type are unused (that is, those significant bits which are not part of - * the sign, exponent, or mantissa), then H5Tset_inpad will be filled according to the value of the padding value - * property inpad. + * If any internal bits of a floating point type are unused (that is, those significant bits which are not + * part of the sign, exponent, or mantissa), then H5Tset_inpad will be filled according to the value of + * the padding value property inpad. * * @param type_id * IN: Identifier of datatype to modify. @@ -12748,7 +13209,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_inpad(long type_id, int inpad) throws HDF5LibraryException; @@ -12763,9 +13224,10 @@ public class H5 implements java.io.Serializable { * @return the class of the datatype of the field if successful; * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Tget_member_class(long type_id, int membno) throws HDF5LibraryException; + public synchronized static native int H5Tget_member_class(long type_id, int membno) + throws HDF5LibraryException; /** * H5Tget_member_index retrieves the index of a field of a compound datatype. @@ -12778,12 +13240,14 @@ public class H5 implements java.io.Serializable { * @return if field is defined, the index; else negative. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Tget_member_index(long type_id, String field_name) throws HDF5LibraryException; + public synchronized static native int H5Tget_member_index(long type_id, String field_name) + throws HDF5LibraryException; /** - * H5Tget_member_name retrieves the name of a field of a compound datatype or an element of an enumeration datatype. + * H5Tget_member_name retrieves the name of a field of a compound datatype or an element of an enumeration + * datatype. * * @param type_id * IN: Identifier of datatype to query. @@ -12793,13 +13257,15 @@ public class H5 implements java.io.Serializable { * @return a valid pointer to the name if successful; otherwise null. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5Tget_member_name(long type_id, int field_idx) throws HDF5LibraryException; + public synchronized static native String H5Tget_member_name(long type_id, int field_idx) + throws HDF5LibraryException; /** - * H5Tget_member_offset returns the byte offset of the specified member of the compound datatype. This is the byte - * offset in the HDF-5 file/library, NOT the offset of any Java object which might be mapped to this data item. + * H5Tget_member_offset returns the byte offset of the specified member of the compound datatype. This is + * the byte offset in the HDF-5 file/library, NOT the offset of any Java object which might be mapped to + * this data item. * * @param type_id * IN: Identifier of datatype to query. @@ -12821,9 +13287,10 @@ public class H5 implements java.io.Serializable { * @return the identifier of a copy of the datatype of the field if successful; * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tget_member_type(long type_id, int field_idx) throws HDF5LibraryException { + public static long H5Tget_member_type(long type_id, int field_idx) throws HDF5LibraryException + { long id = _H5Tget_member_type(type_id, field_idx); if (id > 0) { log.trace("OPEN_IDS: H5Tget_member_type add {}", id); @@ -12834,7 +13301,7 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Tget_member_type(long type_id, int field_idx) - throws HDF5LibraryException; + throws HDF5LibraryException; /** * H5Tget_member_value returns the value of the enumeration datatype member memb_no. @@ -12847,12 +13314,12 @@ public class H5 implements java.io.Serializable { * OUT: The value of the member * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - value is null. + * value is null. **/ public synchronized static native void H5Tget_member_value(long type_id, int membno, byte[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tget_member_value returns the value of the enumeration datatype member memb_no. @@ -12867,30 +13334,33 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - value is null. + * value is null. **/ - public static int H5Tget_member_value(long type_id, int membno, int[] value) throws HDF5LibraryException, - NullPointerException { + public static int H5Tget_member_value(long type_id, int membno, int[] value) + throws HDF5LibraryException, NullPointerException + { return H5Tget_member_value_int(type_id, membno, value); } private synchronized static native int H5Tget_member_value_int(long type_id, int membno, int[] value) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tget_native_type returns the equivalent native datatype for the datatype specified in type_id. * * @param type_id - * IN: Identifier of datatype to query. Direction of search is assumed to be in ascending order. + * IN: Identifier of datatype to query. Direction of search is assumed to be in ascending + * order. * * @return the native datatype identifier for the specified dataset datatype. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static long H5Tget_native_type(long type_id) throws HDF5LibraryException { + public synchronized static long H5Tget_native_type(long type_id) throws HDF5LibraryException + { return H5Tget_native_type(type_id, HDF5Constants.H5T_DIR_ASCEND); } @@ -12905,9 +13375,10 @@ public class H5 implements java.io.Serializable { * @return the native datatype identifier for the specified dataset datatype. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tget_native_type(long type_id, int direction) throws HDF5LibraryException { + public static long H5Tget_native_type(long type_id, int direction) throws HDF5LibraryException + { long id = _H5Tget_native_type(type_id, direction); if (id > 0) { log.trace("OPEN_IDS: H5Tget_native_type add {}", id); @@ -12917,7 +13388,8 @@ public class H5 implements java.io.Serializable { return id; } - private synchronized static native long _H5Tget_native_type(long tid, int direction) throws HDF5LibraryException; + private synchronized static native long _H5Tget_native_type(long tid, int direction) + throws HDF5LibraryException; /** * H5Tget_nmembers retrieves the number of fields a compound datatype has. @@ -12928,7 +13400,7 @@ public class H5 implements java.io.Serializable { * @return number of members datatype has if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_nmembers(long type_id) throws HDF5LibraryException; @@ -12941,7 +13413,7 @@ public class H5 implements java.io.Serializable { * @return a valid normalization type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_norm(long type_id) throws HDF5LibraryException; @@ -12956,7 +13428,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_norm(long type_id, int norm) throws HDF5LibraryException; @@ -12969,7 +13441,7 @@ public class H5 implements java.io.Serializable { * @return a positive offset value if successful; otherwise 0. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_offset(long type_id) throws HDF5LibraryException; @@ -12984,10 +13456,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Tset_offset(long type_id, int offset) throws HDF5LibraryException { - H5Tset_offset(type_id, (long) offset); + public static int H5Tset_offset(long type_id, int offset) throws HDF5LibraryException + { + H5Tset_offset(type_id, (long)offset); return 0; } @@ -13000,9 +13473,10 @@ public class H5 implements java.io.Serializable { * IN: Offset of first significant bit. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Tset_offset(long type_id, long offset) throws HDF5LibraryException; + public synchronized static native void H5Tset_offset(long type_id, long offset) + throws HDF5LibraryException; /** * H5Tget_order returns the byte order of an atomic datatype. @@ -13013,7 +13487,7 @@ public class H5 implements java.io.Serializable { * @return a byte order constant if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_order(long type_id) throws HDF5LibraryException; @@ -13028,7 +13502,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_order(long type_id, int order) throws HDF5LibraryException; @@ -13048,12 +13522,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - pad is null. + * pad is null. **/ - public synchronized static native int H5Tget_pad(long type_id, int[] pad) throws HDF5LibraryException, - NullPointerException; + public synchronized static native int H5Tget_pad(long type_id, int[] pad) + throws HDF5LibraryException, NullPointerException; /** * H5Tset_pad sets the least and most-significant bits padding types. @@ -13068,9 +13542,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native int H5Tset_pad(long type_id, int lsb, int msb) throws HDF5LibraryException; + public synchronized static native int H5Tset_pad(long type_id, int lsb, int msb) + throws HDF5LibraryException; /** * H5Tget_precision returns the precision of an atomic datatype. @@ -13081,7 +13556,7 @@ public class H5 implements java.io.Serializable { * @return the number of significant bits if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_precision(long type_id) throws HDF5LibraryException; @@ -13096,10 +13571,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static int H5Tset_precision(long type_id, int precision) throws HDF5LibraryException { - H5Tset_precision(type_id, (long) precision); + public static int H5Tset_precision(long type_id, int precision) throws HDF5LibraryException + { + H5Tset_precision(type_id, (long)precision); return 0; } @@ -13112,7 +13588,7 @@ public class H5 implements java.io.Serializable { * @return the number of significant bits if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Tget_precision_long(long type_id) throws HDF5LibraryException; @@ -13125,9 +13601,10 @@ public class H5 implements java.io.Serializable { * IN: Number of bits of precision for datatype. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5Tset_precision(long type_id, long precision) throws HDF5LibraryException; + public synchronized static native void H5Tset_precision(long type_id, long precision) + throws HDF5LibraryException; /** * H5Tget_sign retrieves the sign type for an integer type. @@ -13138,7 +13615,7 @@ public class H5 implements java.io.Serializable { * @return a valid sign type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_sign(long type_id) throws HDF5LibraryException; @@ -13153,7 +13630,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_sign(long type_id, int sign) throws HDF5LibraryException; @@ -13166,13 +13643,13 @@ public class H5 implements java.io.Serializable { * @return the size of the datatype in bytes * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5Tget_size(long type_id) throws HDF5LibraryException; /** - * H5Tset_size sets the total size in bytes, size, for an atomic datatype (this operation is not permitted on - * compound datatypes). + * H5Tset_size sets the total size in bytes, size, for an atomic datatype (this operation is not permitted + * on compound datatypes). * * @param type_id * IN: Identifier of datatype to change size. @@ -13182,7 +13659,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_size(long type_id, long size) throws HDF5LibraryException; @@ -13195,7 +13672,7 @@ public class H5 implements java.io.Serializable { * @return a valid string padding type if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tget_strpad(long type_id) throws HDF5LibraryException; @@ -13210,7 +13687,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_strpad(long type_id, int strpad) throws HDF5LibraryException; @@ -13223,9 +13700,10 @@ public class H5 implements java.io.Serializable { * @return the parent type * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tget_super(long type) throws HDF5LibraryException { + public static long H5Tget_super(long type) throws HDF5LibraryException + { long id = _H5Tget_super(type); if (id > 0) { log.trace("OPEN_IDS: H5Tget_super add {}", id); @@ -13246,7 +13724,7 @@ public class H5 implements java.io.Serializable { * @return the tag * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native String H5Tget_tag(long type) throws HDF5LibraryException; @@ -13261,7 +13739,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tset_tag(long type, String tag) throws HDF5LibraryException; @@ -13280,12 +13758,12 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ public synchronized static native int H5Tinsert(long type_id, String name, long offset, long field_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** * H5Tis_variable_str determines whether the datatype identified in type_id is a variable-length string. @@ -13296,12 +13774,13 @@ public class H5 implements java.io.Serializable { * @return true if type_id is a variable-length string. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native boolean H5Tis_variable_str(long type_id) throws HDF5LibraryException; /** - * H5Tlock locks the datatype specified by the type_id identifier, making it read-only and non-destrucible. + * H5Tlock locks the datatype specified by the type_id identifier, making it read-only and + * non-destrucible. * * @param type_id * IN: Identifier of datatype to lock. @@ -13309,12 +13788,13 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tlock(long type_id) throws HDF5LibraryException; /** - * H5Topen opens a named datatype at the location specified by loc_id and return an identifier for the datatype. + * H5Topen opens a named datatype at the location specified by loc_id and return an identifier for the + * datatype. * * @param loc_id * IN: A file, group, or datatype identifier. @@ -13326,12 +13806,13 @@ public class H5 implements java.io.Serializable { * @return a named datatype identifier if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - name is null. + * name is null. **/ - public static long H5Topen(long loc_id, String name, long tapl_id) throws HDF5LibraryException, - NullPointerException { + public static long H5Topen(long loc_id, String name, long tapl_id) + throws HDF5LibraryException, NullPointerException + { long id = _H5Topen2(loc_id, name, tapl_id); if (id > 0) { log.trace("OPEN_IDS: H5Topen add {}", id); @@ -13342,14 +13823,12 @@ public class H5 implements java.io.Serializable { } private synchronized static native long _H5Topen2(long loc_id, String name, long tapl_id) - throws HDF5LibraryException, NullPointerException; + throws HDF5LibraryException, NullPointerException; /** - * H5Tpack recursively removes padding from within a compound datatype to make it more efficient (space-wise) to - * store that data. - * <P> - * <b>WARNING:</b> This call only affects the C-data, even if it succeeds, there may be no visible effect on Java - * objects. + * H5Tpack recursively removes padding from within a compound datatype to make it more efficient + * (space-wise) to store that data. <P> <b>WARNING:</b> This call only affects the C-data, even if it + * succeeds, there may be no visible effect on Java objects. * * @param type_id * IN: Identifier of datatype to modify. @@ -13357,7 +13836,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Tpack(long type_id) throws HDF5LibraryException; @@ -13374,12 +13853,13 @@ public class H5 implements java.io.Serializable { * Buffer with data to be reclaimed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. * @exception NullPointerException - * - buf is null. + * buf is null. **/ - public synchronized static native void H5Treclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf) - throws HDF5LibraryException, NullPointerException; + public synchronized static native void H5Treclaim(long type_id, long space_id, long xfer_plist_id, + byte[] buf) + throws HDF5LibraryException, NullPointerException; /** * H5Tvlen_create creates a new variable-length (VL) dataype. @@ -13390,9 +13870,10 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public static long H5Tvlen_create(long base_id) throws HDF5LibraryException { + public static long H5Tvlen_create(long base_id) throws HDF5LibraryException + { long id = _H5Tvlen_create(base_id); if (id > 0) { log.trace("OPEN_IDS: H5Tvlen_create add {}", id); @@ -13412,7 +13893,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the committed datatype to be flushed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Tflush(long dtype_id) throws HDF5LibraryException; @@ -13426,7 +13907,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the committed datatype to be refreshed. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5Trefresh(long dtype_id) throws HDF5LibraryException; @@ -13438,9 +13919,8 @@ public class H5 implements java.io.Serializable { // H5T_conv_t func) // throws HDF5LibraryException, NullPointerException; - // public synchronized static native int H5Tunregister(H5T_pers_t pers, String name, int src_id, int dst_id, - // H5T_conv_t func) - // throws HDF5LibraryException, NullPointerException; + // public synchronized static native int H5Tunregister(H5T_pers_t pers, String name, int src_id, int + // dst_id, H5T_conv_t func) throws HDF5LibraryException, NullPointerException; // //////////////////////////////////////////////////////////// // // @@ -13450,7 +13930,8 @@ public class H5 implements java.io.Serializable { /// VOL Connector Functionality /** - * H5VLregister_connector_by_name registers a new VOL connector as a member of the virtual object layer class. + * H5VLregister_connector_by_name registers a new VOL connector as a member of the virtual object layer + * class. * * @param connector_name * IN: name of the connector. @@ -13461,11 +13942,13 @@ public class H5 implements java.io.Serializable { * @return a VOL connector ID * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id) throws HDF5LibraryException; + public synchronized static native long H5VLregister_connector_by_name(String connector_name, long vipl_id) + throws HDF5LibraryException; /** - * H5VLregister_connector_by_value registers a new VOL connector as a member of the virtual object layer class. + * H5VLregister_connector_by_value registers a new VOL connector as a member of the virtual object layer + * class. * * @param connector_value * IN: value of the connector. @@ -13476,9 +13959,10 @@ public class H5 implements java.io.Serializable { * @return a VOL connector ID * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id) throws HDF5LibraryException; + public synchronized static native long H5VLregister_connector_by_value(int connector_value, long vipl_id) + throws HDF5LibraryException; /** * H5VLis_connector_registered_by_name tests whether a VOL class has been registered. * @@ -13488,9 +13972,10 @@ public class H5 implements java.io.Serializable { * @return true if a VOL connector with that name has been registered * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5VLis_connector_registered_by_name(String name) throws HDF5LibraryException; + public synchronized static native boolean H5VLis_connector_registered_by_name(String name) + throws HDF5LibraryException; /** * H5VLis_connector_registered_by_value tests whether a VOL class has been registered. * @@ -13500,9 +13985,10 @@ public class H5 implements java.io.Serializable { * @return true if a VOL connector with that value has been registered * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native boolean H5VLis_connector_registered_by_value(int connector_value) throws HDF5LibraryException; + public synchronized static native boolean H5VLis_connector_registered_by_value(int connector_value) + throws HDF5LibraryException; /** * H5VLget_connector_id retrieves the ID for a registered VOL connector for a given object. * @@ -13512,7 +13998,7 @@ public class H5 implements java.io.Serializable { * @return a VOL connector ID * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native long H5VLget_connector_id(long object_id) throws HDF5LibraryException; /** @@ -13524,9 +14010,10 @@ public class H5 implements java.io.Serializable { * @return a VOL connector ID * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5VLget_connector_id_by_name(String name) throws HDF5LibraryException; + public synchronized static native long H5VLget_connector_id_by_name(String name) + throws HDF5LibraryException; /** * H5VLget_connector_id_by_value retrieves the ID for a registered VOL connector. * @@ -13536,12 +14023,13 @@ public class H5 implements java.io.Serializable { * @return a VOL connector ID * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native long H5VLget_connector_id_by_value(int connector_value) throws HDF5LibraryException; + public synchronized static native long H5VLget_connector_id_by_value(int connector_value) + throws HDF5LibraryException; /** * H5VLget_connector_name returns the connector name for the VOL associated with the - * object or file ID. + * object or file ID. * * @param object_id * IN: Identifier of the object. @@ -13549,9 +14037,10 @@ public class H5 implements java.io.Serializable { * @return the connector name * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native String H5VLget_connector_name(long object_id) throws HDF5LibraryException; + public synchronized static native String H5VLget_connector_name(long object_id) + throws HDF5LibraryException; /** * H5VLclose closes a VOL connector ID. * @@ -13559,7 +14048,7 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the connector. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native void H5VLclose(long connector_id) throws HDF5LibraryException; /** @@ -13569,14 +14058,14 @@ public class H5 implements java.io.Serializable { * IN: Identifier of the connector. * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ - public synchronized static native void H5VLunregister_connector(long connector_id) throws HDF5LibraryException; + public synchronized static native void H5VLunregister_connector(long connector_id) + throws HDF5LibraryException; // /////// unimplemented //////// // hid_t H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id); - // //////////////////////////////////////////////////////////// // // // H5Z: Filter Interface Functions // @@ -13592,7 +14081,7 @@ public class H5 implements java.io.Serializable { * @return a non-negative(TRUE/FALSE) value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Zfilter_avail(int filter) throws HDF5LibraryException; @@ -13605,7 +14094,7 @@ public class H5 implements java.io.Serializable { * @return the filter information flags * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Zget_filter_info(int filter) throws HDF5LibraryException; @@ -13618,13 +14107,11 @@ public class H5 implements java.io.Serializable { * @return a non-negative value if successful * * @exception HDF5LibraryException - * - Error from the HDF-5 Library. + * Error from the HDF-5 Library. **/ public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException; // /////// unimplemented //////// // herr_t H5Zregister(const void *cls); - } - diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 4125907..cbdf463 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -11,7 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - package hdf.hdf5lib; import hdf.hdf5lib.structs.H5O_token_t; @@ -27,15 +26,13 @@ import hdf.hdf5lib.structs.H5O_token_t; * <b>See also:</b> hdf.hdf5lib.HDF5Library */ public class HDF5Constants { - static { - H5.loadH5Lib(); - } + static { H5.loadH5Lib(); } // ///////////////////////////////////////////////////////////////////////// // Get the HDF5 constants from the library // // ///////////////////////////////////////////////////////////////////////// - //public static final long H5_QUARTER_HADDR_MAX = H5_QUARTER_HADDR_MAX(); + // public static final long H5_QUARTER_HADDR_MAX = H5_QUARTER_HADDR_MAX(); /** Special parameters for szip compression */ public static final int H5_SZIP_MAX_PIXELS_PER_BLOCK = H5_SZIP_MAX_PIXELS_PER_BLOCK(); @@ -70,9 +67,11 @@ public class HDF5Constants { /** */ public static final int H5AC_MAX_TRACE_FILE_NAME_LEN = H5AC_MAX_TRACE_FILE_NAME_LEN(); /** */ - public static final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY = H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + public static final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY = + H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); /** */ - public static final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED = H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + public static final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED = + H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); /** */ public static final int H5C_incr_off = H5C_incr_off(); /** */ @@ -681,22 +680,22 @@ public class HDF5Constants { /** */ public static final long H5FD_MEM_DEFAULT_OHDR_SIZE = H5FD_MEM_DEFAULT_OHDR_SIZE(); -// public static final int H5G_DATASET = H5G_DATASET(); -// public static final int H5G_GROUP = H5G_GROUP(); -// public static final int H5G_LINK = H5G_LINK(); -// public static final int H5G_UDLINK = H5G_UDLINK(); -// public static final int H5G_LINK_ERROR = H5G_LINK_ERROR(); -// public static final int H5G_LINK_HARD = H5G_LINK_HARD(); -// public static final int H5G_LINK_SOFT = H5G_LINK_SOFT(); -// public static final int H5G_NLIBTYPES = H5G_NLIBTYPES(); -// public static final int H5G_NTYPES = H5G_NTYPES(); -// public static final int H5G_NUSERTYPES = H5G_NUSERTYPES(); -// public static final int H5G_RESERVED_5 = H5G_RESERVED_5(); -// public static final int H5G_RESERVED_6 = H5G_RESERVED_6(); -// public static final int H5G_RESERVED_7 = H5G_RESERVED_7(); -// public static final int H5G_SAME_LOC = H5G_SAME_LOC(); -// public static final int H5G_TYPE = H5G_TYPE(); -// public static final int H5G_UNKNOWN = H5G_UNKNOWN(); + // public static final int H5G_DATASET = H5G_DATASET(); + // public static final int H5G_GROUP = H5G_GROUP(); + // public static final int H5G_LINK = H5G_LINK(); + // public static final int H5G_UDLINK = H5G_UDLINK(); + // public static final int H5G_LINK_ERROR = H5G_LINK_ERROR(); + // public static final int H5G_LINK_HARD = H5G_LINK_HARD(); + // public static final int H5G_LINK_SOFT = H5G_LINK_SOFT(); + // public static final int H5G_NLIBTYPES = H5G_NLIBTYPES(); + // public static final int H5G_NTYPES = H5G_NTYPES(); + // public static final int H5G_NUSERTYPES = H5G_NUSERTYPES(); + // public static final int H5G_RESERVED_5 = H5G_RESERVED_5(); + // public static final int H5G_RESERVED_6 = H5G_RESERVED_6(); + // public static final int H5G_RESERVED_7 = H5G_RESERVED_7(); + // public static final int H5G_SAME_LOC = H5G_SAME_LOC(); + // public static final int H5G_TYPE = H5G_TYPE(); + // public static final int H5G_UNKNOWN = H5G_UNKNOWN(); /** */ public static final int H5G_STORAGE_TYPE_UNKNOWN = H5G_STORAGE_TYPE_UNKNOWN(); @@ -756,7 +755,7 @@ public class HDF5Constants { /** */ public static final int H5O_COPY_SHALLOW_HIERARCHY_FLAG = H5O_COPY_SHALLOW_HIERARCHY_FLAG(); /** */ - public static final int H5O_COPY_EXPAND_SOFT_LINK_FLAG = H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + public static final int H5O_COPY_EXPAND_SOFT_LINK_FLAG = H5O_COPY_EXPAND_SOFT_LINK_FLAG(); /** */ public static final int H5O_COPY_EXPAND_EXT_LINK_FLAG = H5O_COPY_EXPAND_EXT_LINK_FLAG(); /** */ @@ -1438,23 +1437,35 @@ public class HDF5Constants { public static final int H5Z_FILTER_SHUFFLE = H5Z_FILTER_SHUFFLE(); /** Filter IDs - szip compression */ public static final int H5Z_FILTER_SZIP = H5Z_FILTER_SZIP(); - /** Flags for filter definition (stored) - * definition flag mask */ + /** + * Flags for filter definition (stored) + * definition flag mask + */ public static final int H5Z_FLAG_DEFMASK = H5Z_FLAG_DEFMASK(); - /** Additional flags for filter invocation (not stored) - * invocation flag mask */ + /** + * Additional flags for filter invocation (not stored) + * invocation flag mask + */ public static final int H5Z_FLAG_INVMASK = H5Z_FLAG_INVMASK(); - /** Flags for filter definition (stored) - * filter is mandatory */ + /** + * Flags for filter definition (stored) + * filter is mandatory + */ public static final int H5Z_FLAG_MANDATORY = H5Z_FLAG_MANDATORY(); - /** Flags for filter definition (stored) - * filter is optional */ + /** + * Flags for filter definition (stored) + * filter is optional + */ public static final int H5Z_FLAG_OPTIONAL = H5Z_FLAG_OPTIONAL(); - /** Additional flags for filter invocation (not stored) - * reverse direction; read */ + /** + * Additional flags for filter invocation (not stored) + * reverse direction; read + */ public static final int H5Z_FLAG_REVERSE = H5Z_FLAG_REVERSE(); - /** Additional flags for filter invocation (not stored) - * skip EDC filters for read */ + /** + * Additional flags for filter invocation (not stored) + * skip EDC filters for read + */ public static final int H5Z_FLAG_SKIP_EDC = H5Z_FLAG_SKIP_EDC(); /** Symbol to remove all filters in H5Premove_filter */ public static final int H5Z_FILTER_ALL = H5Z_FILTER_ALL(); @@ -2953,5 +2964,4 @@ public class HDF5Constants { private static native final int H5Z_SCALEOFFSET_USER_NPARMS(); private static native final int H5Z_FILTER_ALL(); - } diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java index 4c31af7..220cfb6 100644 --- a/java/src/hdf/hdf5lib/HDF5GroupInfo.java +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -11,7 +11,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - package hdf.hdf5lib; /** @@ -41,14 +40,17 @@ 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]; - nlink = -1; - type = -1; - mtime = 0; + /** + * 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]; + nlink = -1; + type = -1; + mtime = 0; linklen = 0; } @@ -68,84 +70,79 @@ public class HDF5GroupInfo { * @param len * Length of link **/ - public void setGroupInfo(long[] fn, long[] on, int nl, int t, long mt, - int len) { - fileno = fn; - objno = on; - nlink = nl; - type = t; - mtime = mt; + public void setGroupInfo(long[] fn, long[] on, int nl, int t, long mt, int len) + { + fileno = fn; + objno = on; + nlink = nl; + type = t; + mtime = mt; linklen = len; } /** Resets all the group information to defaults. */ - public void reset() { + public void reset() + { fileno[0] = 0; fileno[1] = 0; - objno[0] = 0; - objno[1] = 0; - nlink = -1; - type = -1; - mtime = 0; - linklen = 0; + objno[0] = 0; + objno[1] = 0; + nlink = -1; + type = -1; + mtime = 0; + linklen = 0; } - /** fileno accessors + /** + * fileno accessors * @return the file number if successful */ - public long[] getFileno() { - return fileno; - } + public long[] getFileno() { return fileno; } - /** accessors + /** + * accessors * @return the object number if successful */ - public long[] getObjno() { - return objno; - } + public long[] getObjno() { return objno; } - /** accessors + /** + * accessors * @return type of group if successful */ - public int getType() { - return type; - } + public int getType() { return type; } - /** accessors + /** + * accessors * @return the number of links in the group if successful */ - public int getNlink() { - return nlink; - } + public int getNlink() { return nlink; } - /** accessors + /** + * accessors * @return the modified time value if successful */ - public long getMtime() { - return mtime; - } + public long getMtime() { return mtime; } - /** accessors + /** + * accessors * @return a length of link name if successful */ - public int getLinklen() { - return linklen; - } + public int getLinklen() { return linklen; } /** * The fileno and objno fields contain four values which uniquely identify * an object among those HDF5 files. */ @Override - public boolean equals(Object obj) { + public boolean equals(Object obj) + { if (!(obj instanceof HDF5GroupInfo)) { return false; } - HDF5GroupInfo target = (HDF5GroupInfo) obj; - if ((fileno[0] == target.fileno[0]) && (fileno[1] == target.fileno[1]) - && (objno[0] == target.objno[0]) - && (objno[1] == target.objno[1])) { + HDF5GroupInfo target = (HDF5GroupInfo)obj; + if ((fileno[0] == target.fileno[0]) && (fileno[1] == target.fileno[1]) && + (objno[0] == target.objno[0]) && (objno[1] == target.objno[1])) { return true; } else { @@ -158,9 +155,7 @@ public class HDF5GroupInfo { * * @return the object id */ - public long getOID() { - return objno[0]; - } + public long getOID() { return objno[0]; } /** * /** Converts this object to a String representation. @@ -168,9 +163,10 @@ public class HDF5GroupInfo { * @return a string representation of this object */ @Override - public String toString() { + public String toString() + { String fileStr = "fileno=null"; - String objStr = "objno=null"; + String objStr = "objno=null"; if (fileno != null) { fileStr = "fileno[0]=" + fileno[0] + ",fileno[1]=" + fileno[1]; @@ -180,9 +176,7 @@ public class HDF5GroupInfo { objStr = "objno[0]=" + objno[0] + ",objno[1]=" + objno[1]; } - return getClass().getName() + "[" + fileStr + "," + objStr + ",type=" - + type + ",nlink=" + nlink + ",mtime=" + mtime + ",linklen=" - + linklen + "]"; + return getClass().getName() + "[" + fileStr + "," + objStr + ",type=" + type + ",nlink=" + nlink + + ",mtime=" + mtime + ",linklen=" + linklen + "]"; } - } diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java index 21e2b02..8525fb0 100644 --- a/java/src/hdf/hdf5lib/HDFArray.java +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -13,36 +13,34 @@ package hdf.hdf5lib; +import java.util.Arrays; + import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5JavaException; -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. * <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. - * <p> - * This class heavily uses the <a href="./hdf.hdf5lib.HDFNativeData.html">HDFNativeData</a> class to convert between - * Java and C representations. + * 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. */ public class HDFArray { - private Object _theArray = null; + private Object _theArray = null; private ArrayDescriptor _desc = null; - private byte[] _barray = null; + private byte[] _barray = null; // public HDFArray() {} /** - * 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. - * <p> - * The description is saved in private variables, and used to convert data. + * 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. <p> The description is saved in private variables, and used to + * convert data. * * @param anArray * The array object. @@ -58,25 +56,26 @@ public class HDFArray { if (tc.isArray() == false) { /* exception: not an array */ HDF5JavaException ex = new HDF5JavaException("HDFArray: not an array?: "); - throw (ex); + throw(ex); } _theArray = anArray; - _desc = new ArrayDescriptor(_theArray); + _desc = new ArrayDescriptor(_theArray); /* extra error checking -- probably not needed */ if (_desc == null) { - HDF5JavaException ex = new HDF5JavaException("HDFArray: internal error: array description failed?: "); - throw (ex); + HDF5JavaException ex = + new HDF5JavaException("HDFArray: internal error: array description failed?: "); + throw(ex); } } /** * Allocate a one-dimensional array of bytes sufficient to store the array. * - * @return A one-D array of bytes, filled with zeroes. The bytes are sufficient to hold the data of the Array passed - * to the constructor. + * @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 @@ -84,14 +83,14 @@ public class HDFArray { byte[] b = null; if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) { - b = (byte[]) _theArray; + b = (byte[])_theArray; } else { b = new byte[ArrayDescriptor.totalSize]; } if (b == null) { HDF5JavaException ex = new HDF5JavaException("HDFArray: emptyBytes: allocation failed"); - throw (ex); + throw(ex); } return (b); } @@ -112,14 +111,14 @@ public class HDFArray { if (_theArray == null) { /* exception: not an array */ HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify not an array?: "); - throw (ex); + throw(ex); } if (ArrayDescriptor.dims == 1) { /* special case */ if (ArrayDescriptor.NT == 'B') { /* really special case! */ - _barray = (byte[]) _theArray; + _barray = (byte[])_theArray; return _barray; } else { @@ -128,54 +127,56 @@ 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); + therow = ByteObjToByte((Byte[])_theArray); } else if (ArrayDescriptor.className.equals("java.lang.Integer")) { - therow = IntegerToByte((Integer[]) _theArray); + therow = IntegerToByte((Integer[])_theArray); } else if (ArrayDescriptor.className.equals("java.lang.Short")) { - therow = ShortToByte((Short[]) _theArray); + therow = ShortToByte((Short[])_theArray); } else if (ArrayDescriptor.className.equals("java.lang.Float")) { - therow = FloatObjToByte((Float[]) _theArray); + therow = FloatObjToByte((Float[])_theArray); } else if (ArrayDescriptor.className.equals("java.lang.Double")) { - therow = DoubleObjToByte((Double[]) _theArray); + therow = DoubleObjToByte((Double[])_theArray); } else if (ArrayDescriptor.className.equals("java.lang.Long")) { - therow = LongObjToByte((Long[]) _theArray); + therow = LongObjToByte((Long[])_theArray); } else { HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of Object?"); - throw (ex); + throw(ex); } } else { HDF5JavaException ex = new HDF5JavaException("HDFArray: unknown type of data?"); - throw (ex); + 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?"); - throw (ex); + throw(ex); } } } @@ -185,15 +186,15 @@ public class HDFArray { } catch (OutOfMemoryError err) { HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?"); - throw (ex); + throw(ex); } Object oo = _theArray; - int n = 0; /* the current byte */ + int n = 0; /* the current byte */ int index = 0; int i; while (n < ArrayDescriptor.totalSize) { - oo = ArrayDescriptor.objs[0]; + oo = ArrayDescriptor.objs[0]; index = n / ArrayDescriptor.bytetoindex[0]; index %= ArrayDescriptor.dimlen[0]; for (i = 0; i < (ArrayDescriptor.dims); i++) { @@ -209,9 +210,9 @@ public class HDFArray { if (index > (ArrayDescriptor.dimlen[i] - 1)) { throw new java.lang.IndexOutOfBoundsException("HDFArray: byteify index OOB?"); } - oo = java.lang.reflect.Array.get(oo, index); + oo = java.lang.reflect.Array.get(oo, index); ArrayDescriptor.currentindex[i] = index; - ArrayDescriptor.objs[i] = oo; + ArrayDescriptor.objs[i] = oo; } } @@ -220,85 +221,90 @@ public class HDFArray { try { if (ArrayDescriptor.NT == 'J') { arow = HDFNativeData.longToByte(0, ArrayDescriptor.dimlen[ArrayDescriptor.dims], - (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + (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]); + (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]); + (short[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.NT == 'B') { - arow = (byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]; + 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]); + (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]); + arow = ByteObjToByte((Byte[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Integer")) { - arow = IntegerToByte((Integer[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = IntegerToByte((Integer[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Short")) { - arow = ShortToByte((Short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = ShortToByte((Short[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Float")) { - arow = FloatObjToByte((Float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = FloatObjToByte((Float[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Double")) { - arow = DoubleObjToByte((Double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = DoubleObjToByte((Double[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else if (ArrayDescriptor.className.equals("java.lang.Long")) { - arow = LongObjToByte((Long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = LongObjToByte((Long[])ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); } else { - HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify Object type not implemented?"); - throw (ex); + HDF5JavaException ex = + new HDF5JavaException("HDFArray: byteify Object type not implemented?"); + throw(ex); } } else { - HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify unknown type not implemented?"); - throw (ex); + HDF5JavaException ex = + new HDF5JavaException("HDFArray: byteify unknown type not implemented?"); + throw(ex); } System.arraycopy(arow, 0, _barray, n, - (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); + (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; } catch (OutOfMemoryError err) { HDF5JavaException ex = new HDF5JavaException("HDFArray: byteify array too big?"); - throw (ex); + 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) + " ?)")); + throw new java.lang.InternalError(new String("Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + " ?)")); } } return _barray; } /** - * Given a one-dimensional array of bytes representing numbers, convert it to a java array of the shape and size - * passed to the constructor. + * 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. @@ -312,13 +318,13 @@ public class HDFArray { if (_theArray == null) { /* exception: not an array */ HDF5JavaException ex = new HDF5JavaException("arrayify: not an array?: "); - throw (ex); + throw(ex); } if (java.lang.reflect.Array.getLength(bytes) != ArrayDescriptor.totalSize) { /* exception: array not right size */ HDF5JavaException ex = new HDF5JavaException("arrayify: array is wrong size?: "); - throw (ex); + throw(ex); } _barray = bytes; /* hope that the bytes are correct.... */ @@ -387,74 +393,77 @@ public class HDFArray { return _theArray; } else { - HDF5JavaException ex = new HDF5JavaException("arrayify: Object type not implemented yet..."); - throw (ex); + HDF5JavaException ex = + new HDF5JavaException("arrayify: Object type not implemented yet..."); + throw(ex); } } else { - HDF5JavaException ex = new HDF5JavaException("arrayify: unknown type not implemented yet..."); - throw (ex); + HDF5JavaException ex = + new HDF5JavaException("arrayify: unknown type not implemented yet..."); + throw(ex); } } catch (OutOfMemoryError err) { HDF5JavaException ex = new HDF5JavaException("HDFArray: arrayify array too big?"); - throw (ex); + throw(ex); } } /* Assert dims >= 2 */ Object oo = _theArray; - int n = 0; /* the current byte */ - int m = 0; /* the current array index */ + int n = 0; /* the current byte */ + int m = 0; /* the current array index */ int index = 0; int i; Object flattenedArray = null; switch (ArrayDescriptor.NT) { case 'J': - flattenedArray = (Object) HDFNativeData.byteToLong(_barray); + flattenedArray = (Object)HDFNativeData.byteToLong(_barray); break; case 'S': - flattenedArray = (Object) HDFNativeData.byteToShort(_barray); + flattenedArray = (Object)HDFNativeData.byteToShort(_barray); break; case 'I': - flattenedArray = (Object) HDFNativeData.byteToInt(_barray); + flattenedArray = (Object)HDFNativeData.byteToInt(_barray); break; case 'F': - flattenedArray = (Object) HDFNativeData.byteToFloat(_barray); + flattenedArray = (Object)HDFNativeData.byteToFloat(_barray); break; case 'D': - flattenedArray = (Object) HDFNativeData.byteToDouble(_barray); + flattenedArray = (Object)HDFNativeData.byteToDouble(_barray); break; case 'B': - flattenedArray = (Object) _barray; + flattenedArray = (Object)_barray; break; - case 'L': - { - 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 + case 'L': { + 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); + 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) { - oo = ArrayDescriptor.objs[0]; + oo = ArrayDescriptor.objs[0]; index = n / ArrayDescriptor.bytetoindex[0]; index %= ArrayDescriptor.dimlen[0]; for (i = 0; i < (ArrayDescriptor.dims); i++) { @@ -471,86 +480,88 @@ public class HDFArray { System.out.println("out of bounds?"); return null; } - oo = java.lang.reflect.Array.get(oo, index); + oo = java.lang.reflect.Array.get(oo, index); ArrayDescriptor.currentindex[i] = index; - ArrayDescriptor.objs[i] = oo; + ArrayDescriptor.objs[i] = oo; } } /* array-ify */ try { Object arow = null; - int mm = m + ArrayDescriptor.dimlen[ArrayDescriptor.dims]; + int mm = m + ArrayDescriptor.dimlen[ArrayDescriptor.dims]; switch (ArrayDescriptor.NT) { case 'B': - arow = (Object) Arrays.copyOfRange((byte[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((byte[])flattenedArray, m, mm); break; case 'S': - arow = (Object) Arrays.copyOfRange((short[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((short[])flattenedArray, m, mm); break; case 'I': - arow = (Object) Arrays.copyOfRange((int[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((int[])flattenedArray, m, mm); break; case 'J': - arow = (Object) Arrays.copyOfRange((long[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((long[])flattenedArray, m, mm); break; case 'F': - arow = (Object) Arrays.copyOfRange((float[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((float[])flattenedArray, m, mm); break; case 'D': - arow = (Object) Arrays.copyOfRange((double[]) flattenedArray, m, mm); + arow = (Object)Arrays.copyOfRange((double[])flattenedArray, m, mm); break; - case 'L': - { - 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 + case 'L': { + 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); + (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?"); - throw (ex); + 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) - + "?")); + 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; @@ -559,7 +570,7 @@ public class HDFArray { private byte[] IntegerToByte(Integer in[]) { int nelems = java.lang.reflect.Array.getLength(in); - int[] out = new int[nelems]; + int[] out = new int[nelems]; for (int i = 0; i < nelems; i++) { out[i] = in[i].intValue(); @@ -569,8 +580,8 @@ public class HDFArray { private Integer[] ByteToInteger(byte[] bin) { - int in[] = HDFNativeData.byteToInt(bin); - int nelems = java.lang.reflect.Array.getLength(in); + int in[] = HDFNativeData.byteToInt(bin); + int nelems = java.lang.reflect.Array.getLength(in); Integer[] out = new Integer[nelems]; for (int i = 0; i < nelems; i++) { @@ -581,8 +592,8 @@ public class HDFArray { private Integer[] ByteToInteger(int start, int len, byte[] bin) { - int in[] = HDFNativeData.byteToInt(start, len, bin); - int nelems = java.lang.reflect.Array.getLength(in); + int in[] = HDFNativeData.byteToInt(start, len, bin); + int nelems = java.lang.reflect.Array.getLength(in); Integer[] out = new Integer[nelems]; for (int i = 0; i < nelems; i++) { @@ -593,7 +604,7 @@ public class HDFArray { private byte[] ShortToByte(Short in[]) { - int nelems = java.lang.reflect.Array.getLength(in); + int nelems = java.lang.reflect.Array.getLength(in); short[] out = new short[nelems]; for (int i = 0; i < nelems; i++) { @@ -604,8 +615,8 @@ public class HDFArray { private Short[] ByteToShort(byte[] bin) { - short in[] = HDFNativeData.byteToShort(bin); - int nelems = java.lang.reflect.Array.getLength((Object) in); + short in[] = HDFNativeData.byteToShort(bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Short[] out = new Short[nelems]; for (int i = 0; i < nelems; i++) { @@ -616,8 +627,8 @@ public class HDFArray { 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 in[] = (short[])HDFNativeData.byteToShort(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Short[] out = new Short[nelems]; for (int i = 0; i < nelems; i++) { @@ -628,7 +639,7 @@ public class HDFArray { private byte[] ByteObjToByte(Byte in[]) { - int nelems = java.lang.reflect.Array.getLength((Object) in); + int nelems = java.lang.reflect.Array.getLength((Object)in); byte[] out = new byte[nelems]; for (int i = 0; i < nelems; i++) { @@ -639,7 +650,7 @@ public class HDFArray { private Byte[] ByteToByteObj(byte[] bin) { - int nelems = java.lang.reflect.Array.getLength((Object) bin); + int nelems = java.lang.reflect.Array.getLength((Object)bin); Byte[] out = new Byte[nelems]; for (int i = 0; i < nelems; i++) { @@ -660,7 +671,7 @@ public class HDFArray { private byte[] FloatObjToByte(Float in[]) { - int nelems = java.lang.reflect.Array.getLength((Object) in); + int nelems = java.lang.reflect.Array.getLength((Object)in); float[] out = new float[nelems]; for (int i = 0; i < nelems; i++) { @@ -671,8 +682,8 @@ public class HDFArray { private Float[] ByteToFloatObj(byte[] bin) { - float in[] = (float[]) HDFNativeData.byteToFloat(bin); - int nelems = java.lang.reflect.Array.getLength((Object) in); + float in[] = (float[])HDFNativeData.byteToFloat(bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Float[] out = new Float[nelems]; for (int i = 0; i < nelems; i++) { @@ -683,8 +694,8 @@ public class HDFArray { 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 in[] = (float[])HDFNativeData.byteToFloat(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Float[] out = new Float[nelems]; for (int i = 0; i < nelems; i++) { @@ -695,7 +706,7 @@ public class HDFArray { private byte[] DoubleObjToByte(Double in[]) { - int nelems = java.lang.reflect.Array.getLength((Object) in); + int nelems = java.lang.reflect.Array.getLength((Object)in); double[] out = new double[nelems]; for (int i = 0; i < nelems; i++) { @@ -706,8 +717,8 @@ public class HDFArray { private Double[] ByteToDoubleObj(byte[] bin) { - double in[] = (double[]) HDFNativeData.byteToDouble(bin); - int nelems = java.lang.reflect.Array.getLength((Object) in); + double in[] = (double[])HDFNativeData.byteToDouble(bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Double[] out = new Double[nelems]; for (int i = 0; i < nelems; i++) { @@ -718,8 +729,8 @@ public class HDFArray { 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 in[] = (double[])HDFNativeData.byteToDouble(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Double[] out = new Double[nelems]; for (int i = 0; i < nelems; i++) { @@ -730,7 +741,7 @@ public class HDFArray { private byte[] LongObjToByte(Long in[]) { - int nelems = java.lang.reflect.Array.getLength((Object) in); + int nelems = java.lang.reflect.Array.getLength((Object)in); long[] out = new long[nelems]; for (int i = 0; i < nelems; i++) { @@ -741,8 +752,8 @@ public class HDFArray { private Long[] ByteToLongObj(byte[] bin) { - long in[] = (long[]) HDFNativeData.byteToLong(bin); - int nelems = java.lang.reflect.Array.getLength((Object) in); + long in[] = (long[])HDFNativeData.byteToLong(bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Long[] out = new Long[nelems]; for (int i = 0; i < nelems; i++) { @@ -753,8 +764,8 @@ public class HDFArray { 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 in[] = (long[])HDFNativeData.byteToLong(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object)in); Long[] out = new Long[nelems]; for (int i = 0; i < nelems; i++) { @@ -770,18 +781,18 @@ public class HDFArray { * We use java.lang.reflection here. */ class ArrayDescriptor { - static String theType = ""; - static Class theClass = null; - static int[] dimlen = null; - static int[] dimstart = null; + static String theType = ""; + static Class theClass = null; + static int[] dimlen = null; + static int[] dimstart = null; static int[] currentindex = null; - static int[] bytetoindex = null; - static int totalSize = 0; - static int totalElements = 0; - static Object[] objs = null; - static char NT = ' '; /* must be B,S,I,L,F,D, else error */ - static int NTsize = 0; - static int dims = 0; + static int[] bytetoindex = null; + static int totalSize = 0; + static int totalElements = 0; + static Object[] objs = null; + static char NT = ' '; /* must be B,S,I,L,F,D, else error */ + static int NTsize = 0; + static int dims = 0; static String className; public ArrayDescriptor(Object anArray) throws HDF5JavaException @@ -790,7 +801,7 @@ class ArrayDescriptor { if (tc.isArray() == false) { /* exception: not an array */ HDF5JavaException ex = new HDF5JavaException("ArrayDescriptor: not an array?: "); - throw (ex); + throw(ex); } theClass = tc; @@ -799,10 +810,10 @@ class ArrayDescriptor { * parse the type descriptor to discover the shape of the array */ String ss = tc.toString(); - theType = ss; - int n = 6; - dims = 0; - char c = ' '; + theType = ss; + int n = 6; + dims = 0; + char c = ' '; while (n < ss.length()) { c = ss.charAt(n); n++; @@ -811,10 +822,10 @@ class ArrayDescriptor { } } - String css = ss.substring(ss.lastIndexOf('[') + 1); + String css = ss.substring(ss.lastIndexOf('[') + 1); Class compC = tc.getComponentType(); - String cs = compC.toString(); - NT = c; /* must be B,S,I,L,F,D, else error */ + String cs = compC.toString(); + NT = c; /* must be B,S,I,L,F,D, else error */ if (NT == 'B') { NTsize = 1; } @@ -828,68 +839,69 @@ class ArrayDescriptor { NTsize = 8; } else if (css.startsWith("Ljava.lang.Byte")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Byte"; - NTsize = 1; + NTsize = 1; } else if (css.startsWith("Ljava.lang.Short")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Short"; - NTsize = 2; + NTsize = 2; } else if (css.startsWith("Ljava.lang.Integer")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Integer"; - NTsize = 4; + NTsize = 4; } else if (css.startsWith("Ljava.lang.Float")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Float"; - NTsize = 4; + NTsize = 4; } else if (css.startsWith("Ljava.lang.Double")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Double"; - NTsize = 8; + NTsize = 8; } else if (css.startsWith("Ljava.lang.Long")) { - NT = 'L'; + NT = 'L'; className = "java.lang.Long"; - NTsize = 8; + NTsize = 8; } else if (css.startsWith("Ljava.lang.String")) { - NT = 'L'; + NT = 'L'; className = "java.lang.String"; - NTsize = 1; - throw new HDF5JavaException(new String("ArrayDesciptor: Warning: String array not fully supported yet")); + NTsize = 1; + 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 + ") ?")); + new String("ArrayDesciptor: Error: array is not numeric (type is " + css + ") ?")); } /* fill in the table */ - dimlen = new int[dims + 1]; - dimstart = new int[dims + 1]; + dimlen = new int[dims + 1]; + dimstart = new int[dims + 1]; currentindex = new int[dims + 1]; - bytetoindex = new int[dims + 1]; - objs = new Object[dims + 1]; + bytetoindex = new int[dims + 1]; + objs = new Object[dims + 1]; - Object o = anArray; - objs[0] = o; - dimlen[0] = 1; - dimstart[0] = 0; + Object o = anArray; + objs[0] = o; + dimlen[0] = 1; + dimstart[0] = 0; currentindex[0] = 0; - int elements = 1; + int elements = 1; int i; for (i = 1; i <= dims; i++) { - dimlen[i] = java.lang.reflect.Array.getLength((Object) o); - o = java.lang.reflect.Array.get((Object) o, 0); - objs[i] = o; - dimstart[i] = 0; + dimlen[i] = java.lang.reflect.Array.getLength((Object)o); + o = java.lang.reflect.Array.get((Object)o, 0); + objs[i] = o; + dimstart[i] = 0; currentindex[i] = 0; elements *= dimlen[i]; } @@ -917,14 +929,15 @@ class ArrayDescriptor { System.out.println("Type: " + theType); System.out.println("Class: " + theClass); System.out.println("NT: " + NT + " NTsize: " + NTsize); - System.out.println("Array has " + dims + " dimensions (" + totalSize - + " bytes, " + totalElements + " elements)"); + System.out.println("Array has " + dims + " dimensions (" + totalSize + " bytes, " + totalElements + + " elements)"); int i; for (i = 0; i <= dims; i++) { - Class tc = objs[i].getClass(); + 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/HDFNativeData.java b/java/src/hdf/hdf5lib/HDFNativeData.java index 85378db..c497043 100644 --- a/java/src/hdf/hdf5lib/HDFNativeData.java +++ b/java/src/hdf/hdf5lib/HDFNativeData.java @@ -95,8 +95,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' int */ - public synchronized static native int[] byteToInt(int start, int len, - byte[] data); + public synchronized static native int[] byteToInt(int start, int len, byte[] data); /** * Convert 4 bytes from an array of bytes into a single int @@ -107,9 +106,10 @@ public class HDFNativeData { * The input array of bytes * @return The integer value of the bytes. */ - public synchronized static int byteToInt(byte[] data, int start) { + public synchronized static int byteToInt(byte[] data, int start) + { int[] ival = new int[1]; - ival = byteToInt(start, 1, data); + ival = byteToInt(start, 1, data); return (ival[0]); } @@ -124,8 +124,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' short */ - public synchronized static native short[] byteToShort(int start, int len, - byte[] data); + public synchronized static native short[] byteToShort(int start, int len, byte[] data); /** * Convert 2 bytes from an array of bytes into a single short @@ -136,9 +135,10 @@ public class HDFNativeData { * The input array of bytes * @return The short value of the bytes. */ - public synchronized static short byteToShort(byte[] data, int start) { + public synchronized static short byteToShort(byte[] data, int start) + { short[] sval = new short[1]; - sval = byteToShort(start, 1, data); + sval = byteToShort(start, 1, data); return (sval[0]); } @@ -164,9 +164,10 @@ public class HDFNativeData { * The input array of bytes * @return The float value of the bytes. */ - public synchronized static float byteToFloat(byte[] data, int start) { + public synchronized static float byteToFloat(byte[] data, int start) + { float[] fval = new float[1]; - fval = byteToFloat(start, 1, data); + fval = byteToFloat(start, 1, data); return (fval[0]); } @@ -181,8 +182,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' long */ - public synchronized static native long[] byteToLong(int start, int len, - byte[] data); + public synchronized static native long[] byteToLong(int start, int len, byte[] data); /** * Convert 8 bytes from an array of bytes into a single long @@ -193,9 +193,10 @@ public class HDFNativeData { * The input array of bytes * @return The long value of the bytes. */ - public synchronized static long byteToLong(byte[] data, int start) { + public synchronized static long byteToLong(byte[] data, int start) + { long[] lval = new long[1]; - lval = byteToLong(start, 1, data); + lval = byteToLong(start, 1, data); return (lval[0]); } @@ -210,8 +211,7 @@ public class HDFNativeData { * The input array of bytes * @return an array of 'len' double */ - public synchronized static native double[] byteToDouble(int start, int len, - byte[] data); + public synchronized static native double[] byteToDouble(int start, int len, byte[] data); /** * Convert 8 bytes from an array of bytes into a single double @@ -222,9 +222,10 @@ public class HDFNativeData { * The input array of bytes * @return The double value of the bytes. */ - public synchronized static double byteToDouble(byte[] data, int start) { + public synchronized static double byteToDouble(byte[] data, int start) + { double[] dval = new double[1]; - dval = byteToDouble(start, 1, data); + dval = byteToDouble(start, 1, data); return (dval[0]); } @@ -239,8 +240,7 @@ public class HDFNativeData { * The input array of int * @return an array of bytes */ - public synchronized static native byte[] intToByte(int start, int len, - int[] data); + public synchronized static native byte[] intToByte(int start, int len, int[] data); /** * Convert a range from an array of short into an array of bytes. @@ -253,8 +253,7 @@ public class HDFNativeData { * The input array of short * @return an array of bytes */ - public synchronized static native byte[] shortToByte(int start, int len, - short[] data); + public synchronized static native byte[] shortToByte(int start, int len, short[] data); /** * Convert a range from an array of float into an array of bytes. @@ -267,8 +266,7 @@ public class HDFNativeData { * The input array of float * @return an array of bytes */ - public synchronized static native byte[] floatToByte(int start, int len, - float[] data); + public synchronized static native byte[] floatToByte(int start, int len, float[] data); /** * Convert a range from an array of long into an array of bytes. @@ -281,8 +279,7 @@ public class HDFNativeData { * The input array of long * @return an array of bytes */ - public synchronized static native byte[] longToByte(int start, int len, - long[] data); + public synchronized static native byte[] longToByte(int start, int len, long[] data); /** * Convert a range from an array of double into an array of bytes. @@ -295,8 +292,7 @@ public class HDFNativeData { * The input array of double * @return an array of bytes */ - public synchronized static native byte[] doubleToByte(int start, int len, - double[] data); + public synchronized static native byte[] doubleToByte(int start, int len, double[] data); /** * Convert a single byte into an array of one byte. @@ -318,9 +314,7 @@ public class HDFNativeData { * The input Byte * @return an array of bytes */ - public synchronized static byte[] byteToByte(Byte data) { - return byteToByte(data.byteValue()); - } + public synchronized static byte[] byteToByte(Byte data) { return byteToByte(data.byteValue()); } /** * Convert a single int into an array of 4 bytes. @@ -338,9 +332,7 @@ public class HDFNativeData { * The input Integer * @return an array of bytes */ - public synchronized static byte[] intToByte(Integer data) { - return intToByte(data.intValue()); - } + public synchronized static byte[] intToByte(Integer data) { return intToByte(data.intValue()); } /** * Convert a single short into an array of 2 bytes. @@ -358,9 +350,7 @@ public class HDFNativeData { * The input Short * @return an array of bytes */ - public synchronized static byte[] shortToByte(Short data) { - return shortToByte(data.shortValue()); - } + public synchronized static byte[] shortToByte(Short data) { return shortToByte(data.shortValue()); } /** * Convert a single float into an array of 4 bytes. @@ -378,9 +368,7 @@ public class HDFNativeData { * The input Float * @return an array of bytes */ - public synchronized static byte[] floatToByte(Float data) { - return floatToByte(data.floatValue()); - }; + public synchronized static byte[] floatToByte(Float data) { return floatToByte(data.floatValue()); }; /** * Convert a single long into an array of 8 bytes. @@ -398,9 +386,7 @@ public class HDFNativeData { * The input Long * @return an array of bytes */ - public synchronized static byte[] longToByte(Long data) { - return longToByte(data.longValue()); - } + public synchronized static byte[] longToByte(Long data) { return longToByte(data.longValue()); } /** * Convert a single double into an array of 8 bytes. @@ -418,9 +404,7 @@ public class HDFNativeData { * The input Double * @return an array of bytes */ - public synchronized static byte[] doubleToByte(Double data) { - return doubleToByte(data.doubleValue()); - } + public synchronized static byte[] doubleToByte(Double data) { return doubleToByte(data.doubleValue()); } /** * Create a Number object from an array of bytes. @@ -435,40 +419,39 @@ public class HDFNativeData { * @exception HDF5Exception * - Error unsupported type. */ - public synchronized static Object byteToNumber(byte[] barray, Object obj) - throws HDF5Exception + public synchronized static Object byteToNumber(byte[] barray, Object obj) throws HDF5Exception { Class theClass = obj.getClass(); - String type = theClass.getName(); - Object retobj = null; + String type = theClass.getName(); + Object retobj = null; if (type.equals("java.lang.Integer")) { int[] i = hdf.hdf5lib.HDFNativeData.byteToInt(0, 1, barray); - retobj = Integer.valueOf(i[0]); + retobj = Integer.valueOf(i[0]); } else if (type.equals("java.lang.Byte")) { retobj = Byte.valueOf(barray[0]); } else if (type.equals("java.lang.Short")) { short[] f = hdf.hdf5lib.HDFNativeData.byteToShort(0, 1, barray); - retobj = Short.valueOf(f[0]); + retobj = Short.valueOf(f[0]); } else if (type.equals("java.lang.Float")) { float[] f = hdf.hdf5lib.HDFNativeData.byteToFloat(0, 1, barray); - retobj = Float.valueOf(f[0]); + retobj = Float.valueOf(f[0]); } else if (type.equals("java.lang.Long")) { long[] f = hdf.hdf5lib.HDFNativeData.byteToLong(0, 1, barray); - retobj = Long.valueOf(f[0]); + retobj = Long.valueOf(f[0]); } else if (type.equals("java.lang.Double")) { double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, barray); - retobj = Double.valueOf(f[0]); + retobj = Double.valueOf(f[0]); } else { /* exception: unsupported type */ HDF5Exception ex = new HDF5JavaException("byteToNumber: setfield bad type: " + obj + " " + type); - throw (ex); + throw(ex); } return (retobj); } diff --git a/java/src/hdf/hdf5lib/callbacks/Callbacks.java b/java/src/hdf/hdf5lib/callbacks/Callbacks.java index 11fa465..86d6193 100644 --- a/java/src/hdf/hdf5lib/callbacks/Callbacks.java +++ b/java/src/hdf/hdf5lib/callbacks/Callbacks.java @@ -12,7 +12,8 @@ package hdf.hdf5lib.callbacks; -/** All callback definitions must derive from this interface. Any +/** + * All callback definitions must derive from this interface. Any * derived interfaces must define a single public method named "callback". * You are responsible for deregistering your callback (if necessary) * in its {@link Object#finalize} method. If native code attempts to call @@ -26,5 +27,4 @@ package hdf.hdf5lib.callbacks; * handler. */ public interface Callbacks { - } diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java index d612db3..45bde9a 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5A_iterate_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java index 7fdb454..cb17896 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_append_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5D_append_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java index 305cf98..fb48c73 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5D_iterate_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java index 5bf0c8b..131b33f 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5E_walk_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java index d89fd2a..c657dbc 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_opdata_t.java @@ -17,5 +17,4 @@ package hdf.hdf5lib.callbacks; * */ public interface H5L_iterate_opdata_t { - } diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java index fd643b4..f4a4412 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_opdata_t.java @@ -17,5 +17,4 @@ package hdf.hdf5lib.callbacks; * */ public interface H5O_iterate_opdata_t { - } diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java index 11e3a99..059addf 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5P_cls_close_func_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java index 78e5282..4b7cf11 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5P_cls_copy_func_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java index d919d97..917264d 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5P_cls_create_func_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java index 0035619..9c0d0eb 100644 --- a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java @@ -17,7 +17,8 @@ package hdf.hdf5lib.callbacks; * */ public interface H5P_iterate_t { -/** public ArrayList iterdata = new ArrayList(); - * Any derived interfaces must define the single public variable as above. - */ + /** + * public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ } diff --git a/java/src/hdf/hdf5lib/callbacks/package-info.java b/java/src/hdf/hdf5lib/callbacks/package-info.java index 0833162..114045c 100644 --- a/java/src/hdf/hdf5lib/callbacks/package-info.java +++ b/java/src/hdf/hdf5lib/callbacks/package-info.java @@ -11,7 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/** All callback definitions must derive from the Callbacks interface. Any +/** + * All callback definitions must derive from the Callbacks interface. Any * derived interfaces must define a single public method named "callback". * You are responsible for deregistering your callback (if necessary) * in its {@link Object#finalize} method. If native code attempts to call diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java index 86dad88..4cb7b1d 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java @@ -23,9 +23,7 @@ public class HDF5AttributeException extends HDF5LibraryException { * Constructs an <code>HDF5AttributeException</code> with no specified * detail message. */ - public HDF5AttributeException() { - super(); - } + public HDF5AttributeException() { super(); } /** * Constructs an <code>HDF5AttributeException</code> with the specified @@ -34,7 +32,5 @@ public class HDF5AttributeException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5AttributeException(String s) { - super(s); - } + public HDF5AttributeException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java index 97585d3..9f70456 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java @@ -23,9 +23,7 @@ public class HDF5BtreeException extends HDF5LibraryException { * Constructs an <code>HDF5BtreeException</code> with no specified detail * message. */ - public HDF5BtreeException() { - super(); - } + public HDF5BtreeException() { super(); } /** * Constructs an <code>HDF5BtreeException</code> with the specified detail @@ -34,7 +32,5 @@ public class HDF5BtreeException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5BtreeException(String s) { - super(s); - } + public HDF5BtreeException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java index b02d815..b4397b7 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java @@ -23,9 +23,7 @@ public class HDF5DataFiltersException extends HDF5LibraryException { * Constructs an <code>HDF5DataFiltersException</code> with no specified * detail message. */ - public HDF5DataFiltersException() { - super(); - } + public HDF5DataFiltersException() { super(); } /** * Constructs an <code>HDF5DataFiltersException</code> with the specified @@ -34,7 +32,5 @@ public class HDF5DataFiltersException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5DataFiltersException(String s) { - super(s); - } + public HDF5DataFiltersException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java index 416b06a..f6993a8 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java @@ -24,9 +24,7 @@ public class HDF5DataStorageException extends HDF5LibraryException { * Constructs an <code>HDF5DataStorageExceptionn</code> with no specified * detail message. */ - public HDF5DataStorageException() { - super(); - } + public HDF5DataStorageException() { super(); } /** * Constructs an <code>HDF5DataStorageException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5DataStorageException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5DataStorageException(String s) { - super(s); - } + public HDF5DataStorageException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java index 7bb22fa..8fd4ae9 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java @@ -23,9 +23,7 @@ public class HDF5DatasetInterfaceException extends HDF5LibraryException { * Constructs an <code>HDF5DatasetInterfaceException</code> with no * specified detail message. */ - public HDF5DatasetInterfaceException() { - super(); - } + public HDF5DatasetInterfaceException() { super(); } /** * Constructs an <code>HDF5DatasetInterfaceException</code> with the @@ -34,7 +32,5 @@ public class HDF5DatasetInterfaceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5DatasetInterfaceException(String s) { - super(s); - } + public HDF5DatasetInterfaceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java index 9a85ff0..d0d2a09 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java @@ -24,9 +24,7 @@ public class HDF5DataspaceInterfaceException extends HDF5LibraryException { * Constructs an <code>HDF5DataspaceInterfaceException</code> with no * specified detail message. */ - public HDF5DataspaceInterfaceException() { - super(); - } + public HDF5DataspaceInterfaceException() { super(); } /** * Constructs an <code>HDF5DataspaceInterfaceException</code> with the @@ -35,7 +33,5 @@ public class HDF5DataspaceInterfaceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5DataspaceInterfaceException(String s) { - super(s); - } + public HDF5DataspaceInterfaceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java index 45b0c55..2ab4ff9 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java @@ -24,9 +24,7 @@ public class HDF5DatatypeInterfaceException extends HDF5LibraryException { * Constructs an <code>HDF5DatatypeInterfaceException</code> with no * specified detail message. */ - public HDF5DatatypeInterfaceException() { - super(); - } + public HDF5DatatypeInterfaceException() { super(); } /** * Constructs an <code>HDF5DatatypeInterfaceException</code> with the @@ -35,7 +33,5 @@ public class HDF5DatatypeInterfaceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5DatatypeInterfaceException(String s) { - super(s); - } + public HDF5DatatypeInterfaceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java index 0c23af1..b098a12 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java @@ -40,9 +40,7 @@ public class HDF5Exception extends RuntimeException { * Constructs an <code>HDF5Exception</code> with no specified detail * message. */ - public HDF5Exception() { - super(); - } + public HDF5Exception() { super(); } /** * Constructs an <code>HDF5Exception</code> with the specified detail @@ -51,7 +49,8 @@ public class HDF5Exception extends RuntimeException { * @param message * the detail message. */ - public HDF5Exception(String message) { + public HDF5Exception(String message) + { super(); detailMessage = message; } @@ -63,7 +62,8 @@ public class HDF5Exception extends RuntimeException { * have a detail message. */ @Override - public String getMessage() { + public String getMessage() + { return detailMessage; } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java index 73bf069..c8df3d0 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java @@ -24,9 +24,7 @@ public class HDF5ExternalFileListException extends HDF5LibraryException { * Constructs an <code>HDF5ExternalFileListException</code> with no * specified detail message. */ - public HDF5ExternalFileListException() { - super(); - } + public HDF5ExternalFileListException() { super(); } /** * Constructs an <code>HDF5ExternalFileListException</code> with the @@ -35,7 +33,5 @@ public class HDF5ExternalFileListException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5ExternalFileListException(String s) { - super(s); - } + public HDF5ExternalFileListException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java index ac82258..afd6d69 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java @@ -24,9 +24,7 @@ public class HDF5FileInterfaceException extends HDF5LibraryException { * Constructs an <code>HDF5FileInterfaceException</code> with no specified * detail message. */ - public HDF5FileInterfaceException() { - super(); - } + public HDF5FileInterfaceException() { super(); } /** * Constructs an <code>HDF5FileInterfaceException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5FileInterfaceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5FileInterfaceException(String s) { - super(s); - } + public HDF5FileInterfaceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java index c4fcf30..58e2980 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java @@ -24,9 +24,7 @@ public class HDF5FunctionArgumentException extends HDF5LibraryException { * Constructs an <code>HDF5FunctionArgumentException</code> with no * specified detail message. */ - public HDF5FunctionArgumentException() { - super(); - } + public HDF5FunctionArgumentException() { super(); } /** * Constructs an <code>HDF5FunctionArgumentException</code> with the @@ -35,7 +33,5 @@ public class HDF5FunctionArgumentException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5FunctionArgumentException(String s) { - super(s); - } + public HDF5FunctionArgumentException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java index ee34b59..db46aae 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java @@ -24,9 +24,7 @@ public class HDF5FunctionEntryExitException extends HDF5LibraryException { * Constructs an <code>HDF5FunctionEntryExitException</code> with no * specified detail message. */ - public HDF5FunctionEntryExitException() { - super(); - } + public HDF5FunctionEntryExitException() { super(); } /** * Constructs an <code>HDF5FunctionEntryExitException</code> with the @@ -35,7 +33,5 @@ public class HDF5FunctionEntryExitException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5FunctionEntryExitException(String s) { - super(s); - } + public HDF5FunctionEntryExitException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java index 1bb3251..7f1691d 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java @@ -24,9 +24,7 @@ public class HDF5HeapException extends HDF5LibraryException { * Constructs an <code>HDF5HeapException</code> with no specified detail * message. */ - public HDF5HeapException() { - super(); - } + public HDF5HeapException() { super(); } /** * Constructs an <code>HDF5HeapException</code> with the specified detail @@ -35,7 +33,5 @@ public class HDF5HeapException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5HeapException(String s) { - super(s); - } + public HDF5HeapException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5IdException.java b/java/src/hdf/hdf5lib/exceptions/HDF5IdException.java index 04ee0bc..5ce1f01 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5IdException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5IdException.java @@ -24,9 +24,7 @@ public class HDF5IdException extends HDF5LibraryException { * Constructs an <code>HDF5IdException</code> with no specified detail * message. */ - public HDF5IdException() { - super(); - } + public HDF5IdException() { super(); } /** * Constructs an <code>HDF5IdException</code> with the specified detail @@ -35,8 +33,5 @@ public class HDF5IdException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5IdException(String s) { - super(s); - } - + public HDF5IdException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java index 810c126..4489486 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java @@ -24,9 +24,7 @@ public class HDF5InternalErrorException extends HDF5LibraryException { * Constructs an <code>HDF5InternalErrorException</code> with no specified * detail message. */ - public HDF5InternalErrorException() { - super(); - } + public HDF5InternalErrorException() { super(); } /** * Constructs an <code>HDF5InternalErrorException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5InternalErrorException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5InternalErrorException(String s) { - super(s); - } + public HDF5InternalErrorException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java index 35720da..ae1cf85 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java @@ -26,9 +26,7 @@ public class HDF5JavaException extends HDF5Exception { * Constructs an <code>HDF5JavaException</code> with no specified detail * message. */ - public HDF5JavaException() { - super(); - } + public HDF5JavaException() { super(); } /** * Constructs an <code>HDF5JavaException</code> with the specified detail @@ -37,7 +35,5 @@ public class HDF5JavaException extends HDF5Exception { * @param s * the detail message. */ - public HDF5JavaException(String s) { - super(s); - } + public HDF5JavaException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java index 9f94882..2a4c8c7 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -39,7 +39,8 @@ public class HDF5LibraryException extends HDF5Exception { * Constructs an <code>HDF5LibraryException</code> with no specified detail * message. */ - public HDF5LibraryException() { + public HDF5LibraryException() + { super(); // this code forces the loading of the HDF-5 library @@ -52,7 +53,7 @@ public class HDF5LibraryException extends HDF5Exception { this.majorErrorNumber = _getMajorErrorNumber(); this.minorErrorNumber = _getMinorErrorNumber(); - detailMessage = getMinorError(minorErrorNumber); + detailMessage = getMinorError(minorErrorNumber); } /** @@ -62,7 +63,8 @@ public class HDF5LibraryException extends HDF5Exception { * @param s * the detail message. */ - public HDF5LibraryException(String s) { + public HDF5LibraryException(String s) + { super(s); // this code forces the loading of the HDF-5 library // to assure that the native methods are available @@ -81,10 +83,7 @@ public class HDF5LibraryException extends HDF5Exception { * * @return the major error number */ - public long getMajorErrorNumber() - { - return majorErrorNumber; - } + public long getMajorErrorNumber() { return majorErrorNumber; } private native long _getMajorErrorNumber(); /** @@ -93,10 +92,7 @@ public class HDF5LibraryException extends HDF5Exception { * * @return the minor error number */ - public long getMinorErrorNumber() - { - return minorErrorNumber; - } + public long getMinorErrorNumber() { return minorErrorNumber; } private native long _getMinorErrorNumber(); /** @@ -109,7 +105,8 @@ public class HDF5LibraryException extends HDF5Exception { * * @return the string of the minor error */ - public String getMinorError(long err_code) { + public String getMinorError(long err_code) + { if (err_code == 0) { return "special zero no error"; } @@ -356,9 +353,10 @@ public class HDF5LibraryException extends HDF5Exception { * stack, and and the Java stack trace to the standard error stream. */ @Override - public void printStackTrace() { + public void printStackTrace() + { System.err.println(this); - printStackTrace0(null); // the HDF-5 Library error stack + printStackTrace0(null); // the HDF-5 Library error stack super.printStackTrace(); // the Java stack trace } @@ -369,21 +367,21 @@ public class HDF5LibraryException extends HDF5Exception { * @param f * the file print stream. */ - public void printStackTrace(java.io.File f) { + public void printStackTrace(java.io.File f) + { if ((f == null) || !f.exists() || f.isDirectory() || !f.canWrite()) { printStackTrace(); } else { try { java.io.FileOutputStream o = new java.io.FileOutputStream(f); - java.io.PrintWriter p = new java.io.PrintWriter(o); + java.io.PrintWriter p = new java.io.PrintWriter(o); p.println(this); p.close(); } catch (Exception ex) { System.err.println(this); - } - ; + }; // the HDF-5 Library error stack printStackTrace0(f.getPath()); super.printStackTrace(); // the Java stack trace @@ -395,5 +393,4 @@ public class HDF5LibraryException extends HDF5Exception { * and error stack. */ private native void printStackTrace0(String s); - } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java index d61f4e9..fef5721 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java @@ -24,9 +24,7 @@ public class HDF5LowLevelIOException extends HDF5LibraryException { * Constructs an <code>HDF5LowLevelIOException</code> with no specified * detail message. */ - public HDF5LowLevelIOException() { - super(); - } + public HDF5LowLevelIOException() { super(); } /** * Constructs an <code>HDF5LowLevelIOException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5LowLevelIOException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5LowLevelIOException(String s) { - super(s); - } + public HDF5LowLevelIOException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java index 3b64b15..4f00006 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java @@ -24,9 +24,7 @@ public class HDF5MetaDataCacheException extends HDF5LibraryException { * Constructs an <code>HDF5MetaDataCacheException</code> with no specified * detail message. */ - public HDF5MetaDataCacheException() { - super(); - } + public HDF5MetaDataCacheException() { super(); } /** * Constructs an <code>HDF5MetaDataCacheException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5MetaDataCacheException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5MetaDataCacheException(String s) { - super(s); - } + public HDF5MetaDataCacheException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java index b9f40f8..9675354 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java @@ -24,9 +24,7 @@ public class HDF5ObjectHeaderException extends HDF5LibraryException { * Constructs an <code>HDF5ObjectHeaderException</code> with no specified * detail message. */ - public HDF5ObjectHeaderException() { - super(); - } + public HDF5ObjectHeaderException() { super(); } /** * Constructs an <code>HDF5ObjectHeaderException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5ObjectHeaderException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5ObjectHeaderException(String s) { - super(s); - } + public HDF5ObjectHeaderException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java index d2a20e0..66f0bd1 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java @@ -24,9 +24,7 @@ public class HDF5PropertyListInterfaceException extends HDF5LibraryException { * Constructs an <code>HDF5PropertyListInterfaceException</code> with no * specified detail message. */ - public HDF5PropertyListInterfaceException() { - super(); - } + public HDF5PropertyListInterfaceException() { super(); } /** * Constructs an <code>HDF5PropertyListInterfaceException</code> with the @@ -35,7 +33,5 @@ public class HDF5PropertyListInterfaceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5PropertyListInterfaceException(String s) { - super(s); - } + public HDF5PropertyListInterfaceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java index 0701244..4feaba7 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java @@ -24,9 +24,7 @@ public class HDF5ReferenceException extends HDF5LibraryException { * Constructs an <code>HDF5ReferenceException</code> with no specified * detail message. */ - public HDF5ReferenceException() { - super(); - } + public HDF5ReferenceException() { super(); } /** * Constructs an <code>HDF5ReferenceException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5ReferenceException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5ReferenceException(String s) { - super(s); - } + public HDF5ReferenceException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java index ad052b5..1a007e7 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java @@ -24,9 +24,7 @@ public class HDF5ResourceUnavailableException extends HDF5LibraryException { * Constructs an <code>HDF5ResourceUnavailableException</code> with no * specified detail message. */ - public HDF5ResourceUnavailableException() { - super(); - } + public HDF5ResourceUnavailableException() { super(); } /** * Constructs an <code>HDF5FunctionArgumentException</code> with the @@ -35,7 +33,5 @@ public class HDF5ResourceUnavailableException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5ResourceUnavailableException(String s) { - super(s); - } + public HDF5ResourceUnavailableException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java index ba9150f..4fb8c2e 100644 --- a/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java +++ b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java @@ -24,9 +24,7 @@ public class HDF5SymbolTableException extends HDF5LibraryException { * Constructs an <code>HDF5SymbolTableException</code> with no specified * detail message. */ - public HDF5SymbolTableException() { - super(); - } + public HDF5SymbolTableException() { super(); } /** * Constructs an <code>HDF5SymbolTableException</code> with the specified @@ -35,7 +33,5 @@ public class HDF5SymbolTableException extends HDF5LibraryException { * @param s * the detail message. */ - public HDF5SymbolTableException(String s) { - super(s); - } + public HDF5SymbolTableException(String s) { super(s); } } diff --git a/java/src/hdf/hdf5lib/package-info.java b/java/src/hdf/hdf5lib/package-info.java index 2863f5a..c04b862 100644 --- a/java/src/hdf/hdf5lib/package-info.java +++ b/java/src/hdf/hdf5lib/package-info.java @@ -11,11 +11,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - /** * This package is the Java interface for the HDF5 library. * <p> - * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps a single + * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps + a single * HDF5 entry point, generally with the arguments and return codes analogous to the C interface. * <p> * For details of the HDF5 library, see the HDF5 Documentation at: @@ -25,7 +25,8 @@ * <b>Mapping of arguments for Java</b> * * <p> - * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF + * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in + the HDF * Reference Manual. * * <table border=1> @@ -66,16 +67,21 @@ * </table> * <b>General Rules for Passing Arguments and Results</b> * <p> - * In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is for arrays, + * In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is + for arrays, * which are discussed below. * <p> - * The <i>return value</i> of Java methods is also the analogous type, as above. A major exception to that rule is that - * all HDF functions that return SUCCEED/FAIL are declared <i>boolean</i> in the Java version, rather than <i>int</i> as - * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. However, in most + * The <i>return value</i> of Java methods is also the analogous type, as above. A major exception to that + rule is that + * all HDF functions that return SUCCEED/FAIL are declared <i>boolean</i> in the Java version, rather than + <i>int</i> as + * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. + However, in most * cases the Java method will raise an exception instead of returning an error code. * See <a href="#ERRORS">Errors and Exceptions</a> below. * <p> - * Java does not support pass by reference of arguments, so arguments that are returned through <b>OUT</b> parameters + * Java does not support pass by reference of arguments, so arguments that are returned through <b>OUT</b> + parameters * must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in arrays. * <p> * For instance, a function that returns two integers is declared: @@ -97,11 +103,13 @@ * </pre> * * <p> - * All the routines where this convention is used will have specific documentation of the details, given below. + * All the routines where this convention is used will have specific documentation of the details, given + below. * <p> * <b>Arrays</b> * <p> - * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the + * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API + describes the * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, * * <pre> @@ -109,39 +117,53 @@ * </pre> * * <p> - * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that is the - * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the array on + * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that + is the + * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the + array on * disk (source) and in memory (destination). * <p> - * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional - * arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible to declare a separate + * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, + multidimensional + * arrays are definitely <i>not</i> laid out contiguously in memory. It would be infeasible to declare a + separate * routine for every combination of number type and dimensionality. For that reason, the - * <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and size of the - * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order. - * <p> - * The upshot is that any Java array of numbers (either primitive or sub-classes of type <b>Number</b>) can be passed as - * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by the C + * <a href="./hdf.hdf5lib.HDFArray.html"><b>HDFArray</b></a> class is used to discover the type, shape, and + size of the + * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static + native C order. + * <p> + * The upshot is that any Java array of numbers (either primitive or sub-classes of type <b>Number</b>) can be + passed as + * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by + the C * library. So the function above would be declared: * * <pre> - * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object data); + * public synchronized static native int H5Dread(long fid, long filetype, long memtype, long memspace, Object + data); * </pre> * OPEN_IDS.addElement(id); - * and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or int[][][], or + * and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or + int[][][], or * Double[][]. * <p> * <b>HDF-5 Constants</b> * <p> - * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs - * via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the parameters for + * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java + programs + * via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the + parameters for * the h5open() call include two numeric values, <b><i>HDFConstants.H5F_ACC_RDWR</i></b> and * <b><i>HDF5Constants.H5P_DEFAULT</i></b>. As would be expected, these numbers correspond to the C constants * <b><i>H5F_ACC_RDWR</i></b> and <b><i>H5P_DEFAULT</i></b>. * <p> - * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and "hsize_t". + * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and + "hsize_t". * These values are determined at run time by the HDF-5 C library. To support these parameters, the Java class - * <a href="./hdf.hdf5lib.HDF5CDataTypes.html"> <b>HDF5CDataTypes</b></a> looks up the values when initiated. The values + * <a href="./hdf.hdf5lib.HDF5CDataTypes.html"> <b>HDF5CDataTypes</b></a> looks up the values when initiated. + The values * can be accessed as public variables of the Java class, such as: * * <pre> @@ -153,22 +175,31 @@ * <p> * <b>Error handling and Exceptions</b> * <p> - * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is available from the - * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural + * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is + available from the + * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is + very natural * for Java programming. * <p> * The exceptions of the JHI5 are organized as sub-classes of the class - * <a href="./hdf.hdf5lib.exceptions.HDF5Exception.html"> <b>HDF5Exception</b></a>. There are two subclasses of - * <b>HDF5Exception</b>, <a href="./hdf.hdf5lib.exceptions.HDF5LibraryException.html"> <b>HDF5LibraryException</b></a> - * and <a href="./hdf.hdf5lib.exceptions.HDF5JavaException.html"> <b>HDF5JavaException</b></a>. The sub-classes of the - * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the JHI5 + * <a href="./hdf.hdf5lib.exceptions.HDF5Exception.html"> <b>HDF5Exception</b></a>. There are two subclasses + of + * <b>HDF5Exception</b>, <a href="./hdf.hdf5lib.exceptions.HDF5LibraryException.html"> + <b>HDF5LibraryException</b></a> + * and <a href="./hdf.hdf5lib.exceptions.HDF5JavaException.html"> <b>HDF5JavaException</b></a>. The + sub-classes of the + * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the + JHI5 * wrapper and support code. * <p> - * The super-class <b><i>HDF5LibraryException</i></b> implements the method '<b><i>printStackTrace()</i></b>', which - * prints out the HDF-5 error stack, as described in the HDF-5 C API <i><b>H5Eprint()</b>.</i> This may be used by Java + * The super-class <b><i>HDF5LibraryException</i></b> implements the method '<b><i>printStackTrace()</i></b>', + which + * prints out the HDF-5 error stack, as described in the HDF-5 C API <i><b>H5Eprint()</b>.</i> This may be + used by Java * exception handlers to print out the HDF-5 error stack. * <hr> * * <b>See also: <a href="http://hdfgroup.org/HDF5/"> http://hdfgroup.org/HDF5"</a></b> - **/ + * + */ package hdf.hdf5lib; diff --git a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java index cf84532..a224124 100644 --- a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java +++ b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java @@ -18,7 +18,7 @@ import java.io.Serializable; * Information struct for H5Pget_mdc_config/H5Pset_mdc_config * */ -public class H5AC_cache_config_t implements Serializable{ +public class H5AC_cache_config_t implements Serializable { private static final long serialVersionUID = -6748085696476149972L; // general configuration fields /** @@ -27,7 +27,7 @@ public class H5AC_cache_config_t implements Serializable{ * H5AC_cache_config_t passed to the cache must have a known * version number, or an error will be flagged. */ - public int version; + public int version; /** * rpt_fcn_enabled: Boolean field used to enable and disable the default * reporting function. This function is invoked every time the @@ -35,80 +35,80 @@ public class H5AC_cache_config_t implements Serializable{ * * This is a debugging function, and should normally be turned off. */ - public boolean rpt_fcn_enabled; + public boolean rpt_fcn_enabled; /** * open_trace_file: Boolean field indicating whether the trace_file_name * field should be used to open a trace file for the cache. * * *** DEPRECATED *** Use H5Fstart/stop logging functions instead */ - public boolean open_trace_file; + public boolean open_trace_file; /** * close_trace_file: Boolean field indicating whether the current trace * file (if any) should be closed. * * *** DEPRECATED *** Use H5Fstart/stop logging functions instead */ - public boolean close_trace_file; + public boolean close_trace_file; /** * trace_file_name: Full path of the trace file to be opened if the * open_trace_file field is TRUE. * * *** DEPRECATED *** Use H5Fstart/stop logging functions instead */ - public String trace_file_name; + public String trace_file_name; /** * evictions_enabled: Boolean field used to either report the current * evictions enabled status of the cache, or to set the cache's * evictions enabled status. */ - public boolean evictions_enabled; + public boolean evictions_enabled; /** * set_initial_size: Boolean flag indicating whether the size of the * initial size of the cache is to be set to the value given in * the initial_size field. If set_initial_size is FALSE, the * initial_size field is ignored. */ - public boolean set_initial_size; + public boolean set_initial_size; /** * initial_size: If enabled, this field contain the size the cache is * to be set to upon receipt of this structure. Needless to say, * initial_size must lie in the closed interval [min_size, max_size]. */ - public long initial_size; + public long initial_size; /** * min_clean_fraction: double in the range 0 to 1 indicating the fraction * of the cache that is to be kept clean. This field is only used * in parallel mode. Typical values are 0.1 to 0.5. */ - public double min_clean_fraction; + public double min_clean_fraction; /** * max_size: Maximum size to which the cache can be adjusted. The * supplied value must fall in the closed interval * [MIN_MAX_CACHE_SIZE, MAX_MAX_CACHE_SIZE]. Also, max_size must * be greater than or equal to min_size. */ - public long max_size; + public long max_size; /** * min_size: Minimum size to which the cache can be adjusted. The * supplied value must fall in the closed interval * [H5C__MIN_MAX_CACHE_SIZE, H5C__MAX_MAX_CACHE_SIZE]. Also, min_size * must be less than or equal to max_size. */ - public long min_size; + public long min_size; /** * epoch_length: Number of accesses on the cache over which to collect * hit rate stats before running the automatic cache resize code, * if it is enabled. */ - public long epoch_length; + public long epoch_length; // size increase control fields /** * incr_mode: Instance of the H5C_cache_incr_mode enumerated type whose * value indicates how we determine whether the cache size should be * increased. At present there are two possible values. */ - public int incr_mode; + public int incr_mode; /** * lower_hr_threshold: Lower hit rate threshold. If the increment mode * (incr_mode) is H5C_incr__threshold and the hit rate drops below the @@ -117,105 +117,106 @@ public class H5AC_cache_config_t implements Serializable{ * max_size, and that the increment may be further restricted by the * max_increment field if it is enabled. */ - public double lower_hr_threshold; + public double lower_hr_threshold; /** * increment: Double containing the multiplier used to derive the new * cache size from the old if a cache size increment is triggered. * The increment must be greater than 1.0, and should not exceed 2.0. */ - public double increment; + public double increment; /** * apply_max_increment: Boolean flag indicating whether the max_increment * field should be used to limit the maximum cache size increment. */ - public boolean apply_max_increment; + public boolean apply_max_increment; /** * max_increment: If enabled by the apply_max_increment field described * above, this field contains the maximum number of bytes by which the * cache size can be increased in a single re-size. */ - public long max_increment; + public long max_increment; /** * flash_incr_mode: Instance of the H5C_cache_flash_incr_mode enumerated * type whose value indicates whether and by which algorithm we should * make flash increases in the size of the cache to accommodate insertion * of large entries and large increases in the size of a single entry. */ - public int flash_incr_mode; + public int flash_incr_mode; /** * flash_multiple: Double containing the multiple described above in the * H5C_flash_incr__add_space section of the discussion of the * flash_incr_mode section. This field is ignored unless flash_incr_mode * is H5C_flash_incr__add_space. */ - public double flash_multiple; + public double flash_multiple; /** * flash_threshold: Double containing the factor by which current max cache * size is multiplied to obtain the size threshold for the add_space flash * increment algorithm. The field is ignored unless flash_incr_mode is * H5C_flash_incr__add_space. */ - public double flash_threshold; + public double flash_threshold; // size decrease control fields /** * decr_mode: Instance of the H5C_cache_decr_mode enumerated type whose * value indicates how we determine whether the cache size should be * decreased. At present there are four possibilities. */ - public int decr_mode; + public int decr_mode; /** * upper_hr_threshold: Upper hit rate threshold. The use of this field * varies according to the current decr_mode. */ - public double upper_hr_threshold; + public double upper_hr_threshold; /** * decrement: This field is only used when the decr_mode is * H5C_decr__threshold. */ - public double decrement; + public double decrement; /** * apply_max_decrement: Boolean flag used to determine whether decrements * in cache size are to be limited by the max_decrement field. */ - public boolean apply_max_decrement; + public boolean apply_max_decrement; /** * max_decrement: Maximum number of bytes by which the cache size can be * decreased in a single re-size. Note that decrements may also be * restricted by the min_size of the cache, and (in age out modes) by * the empty_reserve field. */ - public long max_decrement; + public long max_decrement; /** * epochs_before_eviction: Integer field used in H5C_decr__age_out and * H5C_decr__age_out_with_threshold decrement modes. */ - public int epochs_before_eviction; + public int epochs_before_eviction; /** * apply_empty_reserve: Boolean field controlling whether the empty_reserve * field is to be used in computing the new cache size when the * decr_mode is H5C_decr__age_out or H5C_decr__age_out_with_threshold. */ - public boolean apply_empty_reserve; + public boolean apply_empty_reserve; /** * empty_reserve: To avoid a constant racheting down of cache size by small * amounts in the H5C_decr__age_out and H5C_decr__age_out_with_threshold * modes, this field allows one to require that any cache size * reductions leave the specified fraction of unused space in the cache. */ - public double empty_reserve; + public double empty_reserve; // parallel configuration fields /** * dirty_bytes_threshold: Threshold of dirty byte creation used to * synchronize updates between caches. */ - public long dirty_bytes_threshold; + public long dirty_bytes_threshold; /** * metadata_write_strategy: Integer field containing a code indicating the * desired metadata write strategy. */ - public int metadata_write_strategy; + public int metadata_write_strategy; - /** H5AC_cache_config_t is a public structure intended for use in public APIs. + /** + * H5AC_cache_config_t is a public structure intended for use in public APIs. * At least in its initial incarnation, it is basically a copy of struct * H5C_auto_size_ctl_t, minus the report_fcn field, and plus the * dirty_bytes_threshold field. @@ -283,46 +284,47 @@ public class H5AC_cache_config_t implements Serializable{ * synchronize updates between caches. * @param metadata_write_strategy: Integer field containing a code indicating the * desired metadata write strategy. - */ - public H5AC_cache_config_t (int version, boolean rpt_fcn_enabled, boolean open_trace_file, - boolean close_trace_file, String trace_file_name, boolean evictions_enabled, - boolean set_initial_size, long initial_size, double min_clean_fraction, long max_size, - long min_size, long epoch_length, int incr_mode, double lower_hr_threshold, - double increment, boolean apply_max_increment, long max_increment, int flash_incr_mode, - double flash_multiple, double flash_threshold, int decr_mode, double upper_hr_threshold, - double decrement, boolean apply_max_decrement, long max_decrement, - int epochs_before_eviction, boolean apply_empty_reserve, double empty_reserve, - long dirty_bytes_threshold, int metadata_write_strategy) + */ + public H5AC_cache_config_t(int version, boolean rpt_fcn_enabled, boolean open_trace_file, + boolean close_trace_file, String trace_file_name, boolean evictions_enabled, + boolean set_initial_size, long initial_size, double min_clean_fraction, + long max_size, long min_size, long epoch_length, int incr_mode, + double lower_hr_threshold, double increment, boolean apply_max_increment, + long max_increment, int flash_incr_mode, double flash_multiple, + double flash_threshold, int decr_mode, double upper_hr_threshold, + double decrement, boolean apply_max_decrement, long max_decrement, + int epochs_before_eviction, boolean apply_empty_reserve, double empty_reserve, + long dirty_bytes_threshold, int metadata_write_strategy) { - this.version = version; - this.rpt_fcn_enabled = rpt_fcn_enabled; - this.open_trace_file = open_trace_file; - this.close_trace_file = close_trace_file; - this.trace_file_name = trace_file_name; - this.evictions_enabled = evictions_enabled; - this.set_initial_size = set_initial_size; - this.initial_size = initial_size; - this.min_clean_fraction = min_clean_fraction; - this.max_size = max_size; - this.min_size = min_size; - this.epoch_length = epoch_length; - this.incr_mode = incr_mode; - this.lower_hr_threshold = lower_hr_threshold; - this.increment = increment; - this.apply_max_increment = apply_max_increment; - this.max_increment = flash_incr_mode; - this.flash_incr_mode = flash_incr_mode; - this.flash_multiple = flash_multiple; - this.flash_threshold = flash_threshold; - this.decr_mode = decr_mode; - this.upper_hr_threshold = upper_hr_threshold; - this.decrement = decrement; - this.apply_max_decrement = apply_max_decrement; - this.max_decrement = max_decrement; - this.epochs_before_eviction = epochs_before_eviction; - this.apply_empty_reserve = apply_empty_reserve; - this.empty_reserve = empty_reserve; - this.dirty_bytes_threshold = dirty_bytes_threshold; + this.version = version; + this.rpt_fcn_enabled = rpt_fcn_enabled; + this.open_trace_file = open_trace_file; + this.close_trace_file = close_trace_file; + this.trace_file_name = trace_file_name; + this.evictions_enabled = evictions_enabled; + this.set_initial_size = set_initial_size; + this.initial_size = initial_size; + this.min_clean_fraction = min_clean_fraction; + this.max_size = max_size; + this.min_size = min_size; + this.epoch_length = epoch_length; + this.incr_mode = incr_mode; + this.lower_hr_threshold = lower_hr_threshold; + this.increment = increment; + this.apply_max_increment = apply_max_increment; + this.max_increment = flash_incr_mode; + this.flash_incr_mode = flash_incr_mode; + this.flash_multiple = flash_multiple; + this.flash_threshold = flash_threshold; + this.decr_mode = decr_mode; + this.upper_hr_threshold = upper_hr_threshold; + this.decrement = decrement; + this.apply_max_decrement = apply_max_decrement; + this.max_decrement = max_decrement; + this.epochs_before_eviction = epochs_before_eviction; + this.apply_empty_reserve = apply_empty_reserve; + this.empty_reserve = empty_reserve; + this.dirty_bytes_threshold = dirty_bytes_threshold; this.metadata_write_strategy = metadata_write_strategy; } } diff --git a/java/src/hdf/hdf5lib/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java index f2c10f0..364e480 100644 --- a/java/src/hdf/hdf5lib/structs/H5A_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java @@ -18,7 +18,7 @@ import java.io.Serializable; * Information struct for Attribute (For H5Aget_info/H5Aget_info_by_idx/H5Aget_info_by_name) * */ -public class H5A_info_t implements Serializable{ +public class H5A_info_t implements Serializable { private static final long serialVersionUID = 2791443594041667613L; /** Indicate if creation order is valid */ public boolean corder_valid; @@ -29,10 +29,11 @@ public class H5A_info_t implements Serializable{ /** Size of raw data */ public long data_size; - H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) { + H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) + { this.corder_valid = corder_valid; - this.corder = corder; - this.cset = cset; - this.data_size = data_size; + this.corder = corder; + this.cset = cset; + this.data_size = data_size; } } diff --git a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java index 5981fc7..1be836f 100644 --- a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java @@ -18,16 +18,16 @@ import java.io.Serializable; * Information struct for Attribute (For H5Ewalk) * */ -public class H5E_error2_t implements Serializable{ +public class H5E_error2_t implements Serializable { private static final long serialVersionUID = 279144359041667613L; /** class ID */ - public long cls_id; + public long cls_id; /** major error ID */ - public long maj_num; + public long maj_num; /** minor error number */ - public long min_num; + public long min_num; /** line in file where error occurs */ - public int line; + public int line; /** function in which error occurred */ public String func_name; /** file in which error occurred */ @@ -35,13 +35,15 @@ public class H5E_error2_t implements Serializable{ /** optional supplied description */ public String desc; - H5E_error2_t(long cls_id, long maj_num, long min_num, int line, String func_name, String file_name, String desc) { - this.cls_id = cls_id; - this.maj_num = maj_num; - this.min_num = min_num; - this.line = line; + H5E_error2_t(long cls_id, long maj_num, long min_num, int line, String func_name, String file_name, + String desc) + { + this.cls_id = cls_id; + this.maj_num = maj_num; + this.min_num = min_num; + this.line = line; this.func_name = func_name; this.file_name = file_name; - this.desc = desc; + this.desc = desc; } } diff --git a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java index 95a9254..181d681 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_hdfs_fapl_t.java @@ -26,17 +26,17 @@ public class H5FD_hdfs_fapl_t implements Serializable { private static final long serialVersionUID = 2072473407027648309L; /** Version number of the H5FD_hdfs_fapl_t structure. */ - private int version; + private int version; /** Name of "Name Node" to access as the HDFS server. */ private String namenode_name; /** Port number to use to connect with Name Node. */ - private int namenode_port; + private int namenode_port; /** Username to use when accessing file. */ private String user_name; /** Path to the location of the Kerberos authentication cache. */ private String kerberos_ticket_cache; /** Size (in bytes) of the file read stream buffer. */ - private int stream_buffer_size; + private int stream_buffer_size; /** * Create a fapl_t structure with the specified components. @@ -51,23 +51,20 @@ public class H5FD_hdfs_fapl_t implements Serializable { * @param stream_buffer_size * Size (in bytes) of the file read stream buffer. */ - public H5FD_hdfs_fapl_t( - String namenode_name, - int namenode_port, - String user_name, - String kerberos_ticket_cache, - int stream_buffer_size) + public H5FD_hdfs_fapl_t(String namenode_name, int namenode_port, String user_name, + String kerberos_ticket_cache, int stream_buffer_size) { - this.version = 1; - this.namenode_name = namenode_name; - this.namenode_port = namenode_port; - this.user_name = user_name; - this.kerberos_ticket_cache = kerberos_ticket_cache; - this.stream_buffer_size = stream_buffer_size; + this.version = 1; + this.namenode_name = namenode_name; + this.namenode_port = namenode_port; + this.user_name = user_name; + this.kerberos_ticket_cache = kerberos_ticket_cache; + this.stream_buffer_size = stream_buffer_size; } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (o == null) return false; if (!(o instanceof H5FD_hdfs_fapl_t)) @@ -90,7 +87,8 @@ public class H5FD_hdfs_fapl_t implements Serializable { } @Override - public int hashCode() { + public int hashCode() + { /* this is a _very bad_ hash algorithm for purposes of hashing! */ /* implemented to satisfy the "contract" regarding equality */ int k = (int)this.version; @@ -103,15 +101,11 @@ public class H5FD_hdfs_fapl_t implements Serializable { } @Override - public String toString() { - return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" + - "\n namenode_name: '" + this.namenode_name + - "'\n namenode_port: " + this.namenode_port + - "\n user_name: '" + this.user_name + - "'\n kerberos_ticket_cache: '" + this.kerberos_ticket_cache + - "'\n stream_buffer_size: " + this.stream_buffer_size + - "\n}\n"; + public String toString() + { + return "H5FD_hdfs_fapl_t (Version: " + this.version + ") {" + + "\n namenode_name: '" + this.namenode_name + "'\n namenode_port: " + this.namenode_port + + "\n user_name: '" + this.user_name + "'\n kerberos_ticket_cache: '" + + this.kerberos_ticket_cache + "'\n stream_buffer_size: " + this.stream_buffer_size + "\n}\n"; } } - - diff --git a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java index ad02979..67c2463 100644 --- a/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java +++ b/java/src/hdf/hdf5lib/structs/H5FD_ros3_fapl_t.java @@ -46,7 +46,7 @@ public class H5FD_ros3_fapl_t implements Serializable { private static final long serialVersionUID = 8985533001471224030L; /** Version number of the H5FD_ros3_fapl_t structure */ - private int version; + private int version; /** Flag TRUE or FALSE whether or not requests are to be authenticated with the AWS4 algorithm. */ private boolean authenticate; /** region "aws region" for authenticating request */ @@ -59,11 +59,12 @@ public class H5FD_ros3_fapl_t implements Serializable { /** * Create a "default" fapl_t structure, for anonymous access. */ - public H5FD_ros3_fapl_t () { + public H5FD_ros3_fapl_t() + { /* H5FD_ros3_fapl_t("", "", ""); */ /* defer */ - this.version = 1; + this.version = 1; this.aws_region = ""; - this.secret_id = ""; + this.secret_id = ""; this.secret_key = ""; } @@ -76,16 +77,18 @@ public class H5FD_ros3_fapl_t implements Serializable { * @param id "secret id" or "access id" for authenticating request * @param key "secret key" or "access key" for authenticating request */ - public H5FD_ros3_fapl_t (String region, String id, String key) { - this.version = 1; /* must equal H5FD_CURR_ROS3_FAPL_T_VERSION */ - /* as found in H5FDros3.h */ + public H5FD_ros3_fapl_t(String region, String id, String key) + { + this.version = 1; /* must equal H5FD_CURR_ROS3_FAPL_T_VERSION */ + /* as found in H5FDros3.h */ this.aws_region = region; this.secret_id = id; this.secret_key = key; } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (o == null) return false; if (!(o instanceof H5FD_ros3_fapl_t)) @@ -104,7 +107,8 @@ public class H5FD_ros3_fapl_t implements Serializable { } @Override - public int hashCode() { + public int hashCode() + { /* this is a _very bad_ hash algorithm for purposes of hashing! */ /* implemented to satisfy the "contract" regarding equality */ int k = (int)this.version; @@ -115,13 +119,10 @@ public class H5FD_ros3_fapl_t implements Serializable { } @Override - public String toString() { - return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" + - "\n aws_region : " + this.aws_region + - "\n secret_id : " + this.secret_id + - "\n secret_key : " + this.secret_key + - "\n}\n"; + public String toString() + { + return "H5FD_ros3_fapl_t (Version:" + this.version + ") {" + + "\n aws_region : " + this.aws_region + "\n secret_id : " + this.secret_id + + "\n secret_key : " + this.secret_key + "\n}\n"; } } - - diff --git a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java index 78e6d6c..1961b16 100644 --- a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java +++ b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java @@ -18,26 +18,26 @@ import java.io.Serializable; * Information struct for object (for H5Fget_info) * */ -public class H5F_info2_t implements Serializable{ +public class H5F_info2_t implements Serializable { private static final long serialVersionUID = 4691681162544054518L; /** Superblock version number */ - public int super_version; + public int super_version; /** Superblock size */ - public long super_size; + public long super_size; /** Superblock extension size */ - public long super_ext_size; + public long super_ext_size; /** Version number of file free space management */ - public int free_version; + public int free_version; /** Free space manager metadata size */ - public long free_meta_size; + public long free_meta_size; /** Amount of free space in the file */ - public long free_tot_space; + public long free_tot_space; /** Version number of shared object header info */ - public int sohm_version; + public int sohm_version; /** Shared object header message header size */ - public long sohm_hdr_size; + public long sohm_hdr_size; /** Shared object header message index and heap size */ - public H5_ih_info_t sohm_msgs_info; + public H5_ih_info_t sohm_msgs_info; /** * Constructor for current "global" information about file @@ -51,18 +51,18 @@ public class H5F_info2_t implements Serializable{ * @param sohm_hdr_size: Shared object header message header size * @param sohm_msgs_info: Shared object header message index and heap size */ - public H5F_info2_t (int super_version, long super_size, long super_ext_size, - int free_version, long free_meta_size, long free_tot_space, - int sohm_version, long sohm_hdr_size, H5_ih_info_t sohm_msgs_info) + public H5F_info2_t(int super_version, long super_size, long super_ext_size, int free_version, + long free_meta_size, long free_tot_space, int sohm_version, long sohm_hdr_size, + H5_ih_info_t sohm_msgs_info) { - this.super_version = super_version; - this.super_size = super_size; + this.super_version = super_version; + this.super_size = super_size; this.super_ext_size = super_ext_size; - this.free_version = free_version; + this.free_version = free_version; this.free_meta_size = free_meta_size; this.free_tot_space = free_tot_space; - this.sohm_version = sohm_version; - this.sohm_hdr_size = sohm_hdr_size; + this.sohm_version = sohm_version; + this.sohm_hdr_size = sohm_hdr_size; this.sohm_msgs_info = sohm_msgs_info; } } diff --git a/java/src/hdf/hdf5lib/structs/H5G_info_t.java b/java/src/hdf/hdf5lib/structs/H5G_info_t.java index e79f859..10ae76a 100644 --- a/java/src/hdf/hdf5lib/structs/H5G_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5G_info_t.java @@ -18,7 +18,7 @@ import java.io.Serializable; * Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) * */ -public class H5G_info_t implements Serializable{ +public class H5G_info_t implements Serializable { private static final long serialVersionUID = -3746463015312132912L; /** Type of storage for links in group */ public int storage_type; diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java index a3011c0..38b64d6 100644 --- a/java/src/hdf/hdf5lib/structs/H5L_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -23,39 +23,37 @@ import hdf.hdf5lib.HDF5Constants; public class H5L_info_t implements Serializable { private static final long serialVersionUID = -4754320605310155033L; /** Type of link */ - public int type; + public int type; /** Indicate if creation order is valid */ - public boolean corder_valid; + public boolean corder_valid; /** Creation order */ - public long corder; + public long corder; /** Character set of link name */ - public int cset; + public int cset; /** Character set of link name */ public H5O_token_t token; /** Size of a soft link or user-defined link value */ - public long val_size; + public long val_size; /** Constructor for using object token portion of C union */ - H5L_info_t (int type, boolean corder_valid, long corder, - int cset, H5O_token_t token) + H5L_info_t(int type, boolean corder_valid, long corder, int cset, H5O_token_t token) { - this.type = type; + this.type = type; this.corder_valid = corder_valid; - this.corder = corder; - this.cset = cset; - this.token = token; - this.val_size = -1; + this.corder = corder; + this.cset = cset; + this.token = token; + this.val_size = -1; } /** Constructor for using val_size portion of C union */ - H5L_info_t (int type, boolean corder_valid, long corder, - int cset, long val_size) + H5L_info_t(int type, boolean corder_valid, long corder, int cset, long val_size) { - this.type = type; + this.type = type; this.corder_valid = corder_valid; - this.corder = corder; - this.cset = cset; - this.token = HDF5Constants.H5O_TOKEN_UNDEF; - this.val_size = val_size; + this.corder = corder; + this.cset = cset; + this.token = HDF5Constants.H5O_TOKEN_UNDEF; + this.val_size = val_size; } } diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java index 2475dd9..16a0eae 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -41,31 +41,31 @@ public class H5O_hdr_info_t implements Serializable { /** Flags to indicate message type is shared in header */ public long mesg_shared; - H5O_hdr_info_t (int version, int nmesgs, int nchunks, int flags, - long space_total, long space_meta, long space_mesg, long space_free, - long mesg_present, long mesg_shared) + H5O_hdr_info_t(int version, int nmesgs, int nchunks, int flags, long space_total, long space_meta, + long space_mesg, long space_free, long mesg_present, long mesg_shared) { - this.version = version; - this.nmesgs = nmesgs; - this.nchunks = nchunks; - this.flags = flags; - this.space_total = space_total; - this.space_meta = space_meta; - this.space_mesg = space_mesg; - this.space_free = space_free; + this.version = version; + this.nmesgs = nmesgs; + this.nchunks = nchunks; + this.flags = flags; + this.space_total = space_total; + this.space_meta = space_meta; + this.space_mesg = space_mesg; + this.space_free = space_free; this.mesg_present = mesg_present; - this.mesg_shared = mesg_shared; + this.mesg_shared = mesg_shared; } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (this == o) return true; if (!(o instanceof H5O_hdr_info_t)) return false; - H5O_hdr_info_t info = (H5O_hdr_info_t) o; + H5O_hdr_info_t info = (H5O_hdr_info_t)o; if (this.version != info.version) return false; diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java index d2208d2..011a88e 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -21,25 +21,26 @@ import java.io.Serializable; public class H5O_info_t implements Serializable { private static final long serialVersionUID = 4691681163544054518L; /** File number that object is located in */ - public long fileno; + public long fileno; /** Object token in file */ public H5O_token_t token; /** Basic object type (group, dataset, etc.) */ - public int type; + public int type; /** Reference count of object */ - public int rc; + public int rc; /** Access time */ - public long atime; + public long atime; /** Modification time */ - public long mtime; + public long mtime; /** Change time */ - public long ctime; + public long ctime; /** Birth time */ - public long btime; + public long btime; /** Number of attributes attached to object */ - public long num_attrs; + public long num_attrs; - /** Constructor for data model information struct for objects + /** + * Constructor for data model information struct for objects * * @param fileno: File number that object is located in * @param token: Object token in file @@ -51,17 +52,17 @@ public class H5O_info_t implements Serializable { * @param btime: Birth time * @param num_attrs: Number of attributes attached to object */ - public H5O_info_t (long fileno, H5O_token_t token, int type, - int rc, long atime, long mtime, long ctime, long btime, long num_attrs) + public H5O_info_t(long fileno, H5O_token_t token, int type, int rc, long atime, long mtime, long ctime, + long btime, long num_attrs) { - this.fileno = fileno; - this.token = token; - this.type = type; - this.rc = rc; - this.atime = atime; - this.mtime = mtime; - this.ctime = ctime; - this.btime = btime; + this.fileno = fileno; + this.token = token; + this.type = type; + this.rc = rc; + this.atime = atime; + this.mtime = mtime; + this.ctime = ctime; + this.btime = btime; this.num_attrs = num_attrs; } } diff --git a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java index 70e5231..ec01b40 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_native_info_t.java @@ -15,7 +15,8 @@ package hdf.hdf5lib.structs; import java.io.Serializable; /** - * Information struct for native HDF5 object info, such as object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx). + * Information struct for native HDF5 object info, such as object header metadata (for + * H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx). * */ public class H5O_native_info_t implements Serializable { @@ -29,26 +30,26 @@ public class H5O_native_info_t implements Serializable { /** v2 B-tree and heap for attributes */ public H5_ih_info_t attr_info; - H5O_native_info_t (H5O_hdr_info_t oheader_info, H5_ih_info_t obj_info, H5_ih_info_t attr_info) + H5O_native_info_t(H5O_hdr_info_t oheader_info, H5_ih_info_t obj_info, H5_ih_info_t attr_info) { - this.hdr_info = oheader_info; - this.obj_info = obj_info; + this.hdr_info = oheader_info; + this.obj_info = obj_info; this.attr_info = attr_info; } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (this == o) return true; if (!(o instanceof H5O_native_info_t)) return false; - H5O_native_info_t info = (H5O_native_info_t) o; + H5O_native_info_t info = (H5O_native_info_t)o; - if (!this.hdr_info.equals(info.hdr_info) - || !this.obj_info.equals(info.obj_info) - || !this.attr_info.equals(info.attr_info)) + if (!this.hdr_info.equals(info.hdr_info) || !this.obj_info.equals(info.obj_info) || + !this.attr_info.equals(info.attr_info)) return false; return true; diff --git a/java/src/hdf/hdf5lib/structs/H5O_token_t.java b/java/src/hdf/hdf5lib/structs/H5O_token_t.java index f0bb978..8f2b7e2 100644 --- a/java/src/hdf/hdf5lib/structs/H5O_token_t.java +++ b/java/src/hdf/hdf5lib/structs/H5O_token_t.java @@ -30,28 +30,25 @@ public class H5O_token_t implements Serializable { */ public byte[] data; - H5O_token_t (byte[] data) { - this.data = data; - } + H5O_token_t(byte[] data) { this.data = data; } /** * Check if token data is undefined * * @return true if token data is undefined */ - public boolean isUndefined() { - return this.equals(HDF5Constants.H5O_TOKEN_UNDEF); - } + public boolean isUndefined() { return this.equals(HDF5Constants.H5O_TOKEN_UNDEF); } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (this == o) return true; if (!(o instanceof H5O_token_t)) return false; - H5O_token_t token = (H5O_token_t) o; + H5O_token_t token = (H5O_token_t)o; return Arrays.equals(this.data, token.data); } diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java index 0c6111b..3213695 100644 --- a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -21,25 +21,26 @@ import java.io.Serializable; public class H5_ih_info_t implements Serializable { private static final long serialVersionUID = -142238015615462707L; /** btree and/or list size of index */ - public long index_size; + public long index_size; /** btree and/or list size of hp */ - public long heap_size; + public long heap_size; - H5_ih_info_t (long index_size, long heap_size) + H5_ih_info_t(long index_size, long heap_size) { this.index_size = index_size; - this.heap_size = heap_size; + this.heap_size = heap_size; } @Override - public boolean equals(Object o) { + public boolean equals(Object o) + { if (this == o) return true; if (!(o instanceof H5_ih_info_t)) return false; - H5_ih_info_t info = (H5_ih_info_t) o; + H5_ih_info_t info = (H5_ih_info_t)o; if (this.index_size != info.index_size) return false; diff --git a/java/src/hdf/hdf5lib/structs/package-info.java b/java/src/hdf/hdf5lib/structs/package-info.java index 8a9d97d..a3ec6cd 100644 --- a/java/src/hdf/hdf5lib/structs/package-info.java +++ b/java/src/hdf/hdf5lib/structs/package-info.java @@ -11,7 +11,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/** All structure definitions define java equivalents of the C structures needed +/** + * All structure definitions define java equivalents of the C structures needed * by the C API calls. See the C API for information about the structures. */ package hdf.hdf5lib.structs; diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index b1186a4..9d1ed2b 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -86,6 +86,13 @@ foreach (test_file ${HDF5_JAVA_TEST_SOURCES}) add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} ${HDF5_JAVA_HDF5_LIB_TARGET}) set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET}_${test_file} PROPERTIES FOLDER test/java) + + #----------------------------------------------------------------------------- + # Add Target to clang-format + #----------------------------------------------------------------------------- + if (HDF5_ENABLE_FORMATTERS) + clang_format (HDF5_JAVA_TEST_${test_file}_SRC_FORMAT ${test_file}.java) + endif () endforeach () foreach (h5_file ${HDF5_JAVA_TEST_SOURCES}) diff --git a/java/test/TestAll.java b/java/test/TestAll.java index 16414e4..c22fbfe 100644 --- a/java/test/TestAll.java +++ b/java/test/TestAll.java @@ -16,21 +16,17 @@ import org.junit.runner.RunWith; import org.junit.runners.Suite; @RunWith(Suite.class) -@Suite.SuiteClasses( { TestH5.class, - TestH5Eparams.class, TestH5Eregister.class, TestH5Edefault.class, TestH5E.class, - TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, TestH5Fswmr.class, - TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class, - TestH5Sbasic.class, TestH5S.class, - TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class, - TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, TestH5Drw.class, - TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, - TestH5R.class, TestH5Rref.class, - TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, - TestH5Pfapls3.class, TestH5Pfaplhdfs.class, - TestH5A.class, TestH5Arw.class, - TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, - TestH5PL.class, TestH5Z.class -}) +@Suite.SuiteClasses({TestH5.class, TestH5Eparams.class, TestH5Eregister.class, TestH5Edefault.class, + TestH5E.class, TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, + TestH5Fswmr.class, TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class, + TestH5Sbasic.class, TestH5S.class, TestH5Tparams.class, TestH5Tbasic.class, + TestH5T.class, TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, + TestH5Drw.class, TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, + TestH5R.class, TestH5Rref.class, TestH5P.class, TestH5PData.class, + TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, TestH5Pfapls3.class, + TestH5Pfaplhdfs.class, TestH5A.class, TestH5Arw.class, TestH5Oparams.class, + TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, TestH5PL.class, + TestH5Z.class}) public class TestAll { } diff --git a/java/test/TestH5.java b/java/test/TestH5.java index 168f28a..67a522c 100644 --- a/java/test/TestH5.java +++ b/java/test/TestH5.java @@ -20,9 +20,9 @@ import static org.junit.Assert.fail; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.FileReader; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; @@ -46,45 +46,53 @@ import org.junit.rules.TestName; * */ public class TestH5 { - @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testData.h5"; - private static final String EXPORT_FILE = "testExport.txt"; - private static final String H5_REGION_FILE = "trefer_reg.h5"; + @Rule + public TestName testname = new TestName(); + private static final String H5_FILE = "testData.h5"; + private static final String EXPORT_FILE = "testExport.txt"; + private static final String H5_REGION_FILE = "trefer_reg.h5"; private static final String EXPORT_REGION_FILE = "testExportReg.txt"; - private static final String H5_ATTR_FILE = "trefer_attr.h5"; - private static final String EXPORT_ATTR_FILE = "testExportAttr.txt"; - private static final String H5_DREG_FILE = "tdatareg.h5"; - private static final String EXPORT_DREG_FILE = "testExportDReg.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 = 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) { + private static final String H5_ATTR_FILE = "trefer_attr.h5"; + private static final String EXPORT_ATTR_FILE = "testExportAttr.txt"; + private static final String H5_DREG_FILE = "tdatareg.h5"; + private static final String EXPORT_DREG_FILE = "testExportDReg.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 = 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) + { File file = null; try { file = new File(filename); } - catch (Throwable err) {} + catch (Throwable err) { + } if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32LE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -95,12 +103,13 @@ public class TestH5 { return did; } - private final void _createH5File() { + private final void _createH5File() + { try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -118,62 +127,77 @@ public class TestH5 { } } - private final void _closeH5File() { + private final void _closeH5File() + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = HDF5Constants.H5I_INVALID_HID; + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } + H5fid = HDF5Constants.H5I_INVALID_HID; H5dsid = HDF5Constants.H5I_INVALID_HID; - H5did = 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 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() { + public final void _deleteH5file() + { _closeH5File(); _deleteFile(H5_FILE); } @After - public void closeH5File() throws HDF5LibraryException { + public void closeH5File() throws HDF5LibraryException + { _closeH5File(); - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.println(); } @Before - public void verifyCount() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void verifyCount() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @@ -184,33 +208,30 @@ public class TestH5 { * being retained hdf java does not access the symbol. */ @Test - public void testJ2C() { - int H5F_ACC_RDONLY = 0x0000; - int H5F_ACC_RDWR = 0x0001; - int H5F_ACC_TRUNC = 0x0002; - int H5F_ACC_EXCL = 0x0004; - int H5F_ACC_CREAT = 0x0010; - int H5F_OBJ_FILE = 0x0001; - int H5F_OBJ_DATASET = 0x0002; - int H5F_OBJ_GROUP = 0x0004; + public void testJ2C() + { + int H5F_ACC_RDONLY = 0x0000; + int H5F_ACC_RDWR = 0x0001; + int H5F_ACC_TRUNC = 0x0002; + int H5F_ACC_EXCL = 0x0004; + int H5F_ACC_CREAT = 0x0010; + int H5F_OBJ_FILE = 0x0001; + int H5F_OBJ_DATASET = 0x0002; + int H5F_OBJ_GROUP = 0x0004; int H5F_OBJ_DATATYPE = 0x0008; - int H5F_OBJ_ATTR = 0x0010; - int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP - | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR; + int H5F_OBJ_ATTR = 0x0010; + int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR; int H5F_OBJ_LOCAL = 0x0020; - int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, - H5F_ACC_EXCL, H5F_ACC_CREAT, H5F_OBJ_FILE, - H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, - H5F_OBJ_ALL, H5F_OBJ_LOCAL }; + int definedValues[] = {H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, H5F_ACC_EXCL, + H5F_ACC_CREAT, H5F_OBJ_FILE, H5F_OBJ_DATASET, H5F_OBJ_GROUP, + H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, H5F_OBJ_ALL, H5F_OBJ_LOCAL}; - int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, - HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5F_ACC_EXCL, - HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, - HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, - HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, - HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL }; + int j2cValues[] = { + HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, + HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, + HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL}; for (int i = 0; i < definedValues.length; i++) { assertEquals(definedValues[i], j2cValues[i]); @@ -224,7 +245,8 @@ public class TestH5 { * Test method for {@link hdf.hdf5lib.H5#H5error_off()}. */ @Test - public void testH5error_off() { + public void testH5error_off() + { try { H5.H5error_off(); } @@ -237,7 +259,8 @@ public class TestH5 { * Test method for {@link hdf.hdf5lib.H5#H5open()}. */ @Test - public void testH5open() { + public void testH5open() + { try { H5.H5open(); } @@ -250,7 +273,8 @@ public class TestH5 { * Test method for {@link hdf.hdf5lib.H5#H5garbage_collect()}. */ @Test - public void testH5garbage_collect() { + public void testH5garbage_collect() + { try { H5.H5garbage_collect(); } @@ -265,17 +289,18 @@ public class TestH5 { * . */ @Test - public void testH5set_free_list_limits() { + public void testH5set_free_list_limits() + { int reg_global_lim = 1; - int reg_list_lim = 1; + int reg_list_lim = 1; int arr_global_lim = 1; - int arr_list_lim = 1; + int arr_list_lim = 1; int blk_global_lim = 1; - int blk_list_lim = 1; + int blk_list_lim = 1; try { - H5.H5set_free_list_limits(reg_global_lim, reg_list_lim, - arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); + H5.H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, + blk_global_lim, blk_list_lim); } catch (Throwable err) { fail("H5.H5set_free_list_limits failed: " + err); @@ -286,8 +311,9 @@ public class TestH5 { * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}. */ @Test - public void testH5get_libversion() { - int libversion[] = { 1, 13, 2 }; + public void testH5get_libversion() + { + int libversion[] = {1, 13, 2}; try { H5.H5get_libversion(libversion); @@ -309,7 +335,8 @@ public class TestH5 { * fail. */ @Test - public void testH5get_libversion_null_param() { + public void testH5get_libversion_null_param() + { try { H5.H5get_libversion(null); } @@ -325,7 +352,8 @@ public class TestH5 { * {@link hdf.hdf5lib.H5#H5check_version(int, int, int)}. */ @Test - public void testH5check_version() { + public void testH5check_version() + { int majnum = 1, minnum = 13, relnum = 2; try { @@ -344,8 +372,9 @@ public class TestH5 { } @Test - public void testIsSerializable() { - H5 test = new H5(); + public void testIsSerializable() + { + H5 test = new H5(); ByteArrayOutputStream out = new ByteArrayOutputStream(); ObjectOutputStream oos; try { @@ -358,7 +387,6 @@ public class TestH5 { fail("ObjectOutputStream failed: " + err); } assertTrue(out.toByteArray().length > 0); - } @SuppressWarnings("static-access") @@ -368,7 +396,7 @@ public class TestH5 { try { H5 test = new H5(); - FileOutputStream fos = new FileOutputStream("temph5.ser"); + FileOutputStream fos = new FileOutputStream("temph5.ser"); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(test); oos.close(); @@ -378,14 +406,14 @@ public class TestH5 { } try { - FileInputStream fis = new FileInputStream("temph5.ser"); + FileInputStream fis = new FileInputStream("temph5.ser"); ObjectInputStream ois = new ObjectInputStream(fis); - H5 test = (hdf.hdf5lib.H5) ois.readObject(); + H5 test = (hdf.hdf5lib.H5)ois.readObject(); ois.close(); - assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0]==H5.LIB_VERSION[0]); - assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1]==H5.LIB_VERSION[1]); -// assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]); + assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0] == H5.LIB_VERSION[0]); + assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1] == H5.LIB_VERSION[1]); + // assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]); // Clean up the file new File("temph5.ser").delete(); @@ -396,10 +424,11 @@ public class TestH5 { } @Test - public void testH5export_dataset() { - int[][] dset_data = new int[DIM_X][DIM_Y]; + public void testH5export_dataset() + { + int[][] dset_data = new int[DIM_X][DIM_Y]; int[][] dset_indata = new int[DIM_X][DIM_Y]; - int FILLVAL = 99; + int FILLVAL = 99; _createH5File(); @@ -410,9 +439,8 @@ public class TestH5 { try { if (H5did >= 0) - H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(H5did, HDF5Constants.H5T_STD_I32LE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -433,12 +461,12 @@ public class TestH5 { File file = new File(EXPORT_FILE); try { - Reader reader = new FileReader(EXPORT_FILE); + Reader reader = new FileReader(EXPORT_FILE); StreamTokenizer streamTokenizer = new StreamTokenizer(reader); - int indx = 0; - int jndx = 0; - while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ - if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + int indx = 0; + int jndx = 0; + while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) { + if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { dset_indata[indx][jndx] = (int)streamTokenizer.nval; jndx++; if (jndx >= DIM_Y) { @@ -453,21 +481,23 @@ public class TestH5 { err.printStackTrace(); fail("read file failed: " + err); } - for(int row = 0; row < DIM_X; row++) - for(int col = 0; col < DIM_Y; col++) { - assertTrue("H5export_dataset: <"+row+","+col+">"+dset_indata[row][col]+"=99", dset_indata[row][col]==99); + for (int row = 0; row < DIM_X; row++) + for (int col = 0; col < DIM_Y; col++) { + assertTrue("H5export_dataset: <" + row + "," + col + ">" + dset_indata[row][col] + "=99", + dset_indata[row][col] == 99); } _deleteH5file(); } @Test - public void testH5export_region() { - 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"; + public void testH5export_region() + { + 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_REGION_FILE, objName); @@ -482,11 +512,11 @@ public class TestH5 { File file = new File(EXPORT_REGION_FILE); try { - Reader reader = new FileReader(EXPORT_REGION_FILE); + Reader reader = new FileReader(EXPORT_REGION_FILE); StreamTokenizer streamTokenizer = new StreamTokenizer(reader); - int indx = 0; - while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ - if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + int indx = 0; + while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) { + if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { dset_indata[indx] = (int)streamTokenizer.nval; indx++; } @@ -497,15 +527,17 @@ public class TestH5 { err.printStackTrace(); fail("read file failed: " + err); } - for(int row = 0; row < DIM_X; row++) - assertTrue("testH5export_region: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + for (int row = 0; row < DIM_X; row++) + assertTrue("testH5export_region: <" + row + ">" + dset_indata[row], + dset_indata[row] == dset_data_expect[row]); } @Test - public void testH5export_attribute() { + public void testH5export_attribute() + { int[] dset_data_expect = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; - int[] dset_indata = new int[DIM_ATTR]; - String objName = "/Dataset3"; + int[] dset_indata = new int[DIM_ATTR]; + String objName = "/Dataset3"; _openH5File(H5_ATTR_FILE, objName); @@ -520,12 +552,12 @@ public class TestH5 { File file = new File(EXPORT_ATTR_FILE); try { - Reader reader = new FileReader(EXPORT_ATTR_FILE); + Reader reader = new FileReader(EXPORT_ATTR_FILE); StreamTokenizer streamTokenizer = new StreamTokenizer(reader); - int indx = 0; - int jndx = 0; - while(streamTokenizer.nextToken() != StreamTokenizer.TT_EOF){ - if(streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { + 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++; } @@ -536,18 +568,20 @@ public class TestH5 { err.printStackTrace(); fail("read file failed: " + err); } - for(int row = 0; row < DIM_X; row++) - assertTrue("testH5export_attribute: <"+row+">"+dset_indata[row], dset_indata[row]==dset_data_expect[row]); + for (int row = 0; row < DIM_X; row++) + assertTrue("testH5export_attribute: <" + row + ">" + dset_indata[row], + dset_indata[row] == dset_data_expect[row]); } @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"; + 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); @@ -562,11 +596,11 @@ public class TestH5 { File file = new File(EXPORT_DREG_FILE); try { - Reader reader = new FileReader(EXPORT_DREG_FILE); + 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) { + int indx = 0; + while (streamTokenizer.nextToken() != StreamTokenizer.TT_EOF) { + if (streamTokenizer.ttype == StreamTokenizer.TT_NUMBER) { dset_indata[indx] = (int)streamTokenizer.nval; indx++; } @@ -577,19 +611,21 @@ public class TestH5 { 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]); + 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"; + 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); @@ -604,12 +640,12 @@ public class TestH5 { File file = new File(EXPORT_AREG_FILE); try { - Reader reader = new FileReader(EXPORT_AREG_FILE); + 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) { + 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++; } @@ -620,7 +656,8 @@ public class TestH5 { 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]); + 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 f2134d2..fed13ce 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -18,9 +18,8 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.util.ArrayList; - import java.io.File; +import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; @@ -38,32 +37,39 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5A { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testA.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - 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 = HDF5Constants.H5I_INVALID_HID; - long space_id = HDF5Constants.H5I_INVALID_HID; - long lapl_id = HDF5Constants.H5I_INVALID_HID; - long aapl_id = HDF5Constants.H5I_INVALID_HID; - - private final void _deleteFile(String filename) { + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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 = HDF5Constants.H5I_INVALID_HID; + long space_id = HDF5Constants.H5I_INVALID_HID; + long lapl_id = HDF5Constants.H5I_INVALID_HID; + long aapl_id = HDF5Constants.H5I_INVALID_HID; + + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -75,18 +81,18 @@ public class TestH5A { } @Before - public void createH5file() throws NullPointerException, HDF5Exception { + public void createH5file() throws NullPointerException, HDF5Exception + { assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("TestH5A.createH5file: H5.H5Fcreate: ", H5fid > 0); H5dsid = H5.H5Screate_simple(2, H5dims, null); assertTrue("TestH5A.createH5file: H5.H5Screate_simple: ", H5dsid > 0); - H5did = _createDataset(H5fid, H5dsid, "dset", - HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); space_id = H5.H5Screate(HDF5Constants.H5S_NULL); assertTrue(space_id > 0); @@ -108,32 +114,63 @@ public class TestH5A { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); if (type_id > 0) - try {H5.H5Tclose(type_id);} catch (Exception ex) {} + try { + H5.H5Tclose(type_id); + } + catch (Exception ex) { + } if (space_id > 0) - try {H5.H5Sclose(space_id);} catch (Exception ex) {} + try { + H5.H5Sclose(space_id); + } + catch (Exception ex) { + } if (lapl_id > 0) - try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(lapl_id); + } + catch (Exception ex) { + } if (aapl_id > 0) - try {H5.H5Pclose(aapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(aapl_id); + } + catch (Exception ex) { + } System.out.println(); } @Test - public void testH5Acreate2() { + public void testH5Acreate2() + { long attr_id = HDF5Constants.H5I_INVALID_HID; try { - attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("testH5Acreate2", attr_id >= 0); } catch (Throwable err) { @@ -142,34 +179,40 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test(expected = HDF5LibraryException.class) - public void testH5Acreate2_invalidobject() throws Throwable { + public void testH5Acreate2_invalidobject() throws Throwable + { H5.H5Acreate(H5dsid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test(expected = NullPointerException.class) - public void testH5Acreate2_nullname() throws Throwable { + public void testH5Acreate2_nullname() throws Throwable + { H5.H5Acreate(H5did, null, type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Aopen() { - String attr_name = "dset"; + public void testH5Aopen() + { + String attr_name = "dset"; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; try { - attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); // Opening the existing attribute, attr_name(Created by H5ACreate2) // attached to an object identifier. - attribute_id = H5.H5Aopen(H5did, attr_name, - HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen(H5did, attr_name, HDF5Constants.H5P_DEFAULT); assertTrue("testH5Aopen: H5Aopen", attribute_id >= 0); } catch (Throwable err) { @@ -178,35 +221,45 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test(expected = HDF5LibraryException.class) - public void testH5Aopen_invalidname() throws Throwable { + public void testH5Aopen_invalidname() throws Throwable + { H5.H5Aopen(H5did, "attr_name", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Aopen_by_idx() { - long loc_id = H5did; - String obj_name = "."; - int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; - int order = HDF5Constants.H5_ITER_INC; - long n = 0; - long attr_id = HDF5Constants.H5I_INVALID_HID; + public void testH5Aopen_by_idx() + { + long loc_id = H5did; + String obj_name = "."; + int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; + int order = HDF5Constants.H5_ITER_INC; + long n = 0; + long attr_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; try { - attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); // Opening the existing attribute, obj_name(Created by H5ACreate2) // by index, attached to an object identifier. - attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, - 0, aapl_id, lapl_id); + attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, aapl_id, lapl_id); assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); @@ -215,29 +268,29 @@ public class TestH5A { // with n=5 and we do not have 5 attributes created. try { n = 5; - H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, - aapl_id, lapl_id); + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); fail("Negative Test Failed:- Error not Thrown when n is invalid."); } catch (AssertionError err) { fail("H5.H5Aopen_by_idx: " + err); } - catch (HDF5LibraryException err) {} + catch (HDF5LibraryException err) { + } // Negative test- Error should be thrown when H5Aopen_by_idx is // called // with an invalid object name(which hasn't been created). try { - n = 0; + n = 0; obj_name = "file"; - H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, - aapl_id, lapl_id); + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); fail("Negative Test Failed:- Error not Thrown when attribute name is invalid."); } catch (AssertionError err) { fail("H5.H5Aopen_by_idx: " + err); } - catch (HDF5LibraryException err) {} + catch (HDF5LibraryException err) { + } } catch (Throwable err) { err.printStackTrace(); @@ -245,32 +298,37 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Acreate_by_name() { - String obj_name = "."; - String attr_name = "DATASET"; + public void testH5Acreate_by_name() + { + String obj_name = "."; + String attr_name = "DATASET"; long attribute_id = HDF5Constants.H5I_INVALID_HID; - boolean bool_val = false; + boolean bool_val = false; try { - attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, - aapl_id, lapl_id); - assertTrue("testH5Acreate_by_name: H5Acreate_by_name", - attribute_id >= 0); + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); + assertTrue("testH5Acreate_by_name: H5Acreate_by_name", attribute_id >= 0); // Check if the name of attribute attached to the object specified // by loc_id and obj_name exists.It should be true. - bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name, - lapl_id); - assertTrue("testH5Acreate_by_name: H5Aexists_by_name", - bool_val == true); + bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name, lapl_id); + assertTrue("testH5Acreate_by_name: H5Aexists_by_name", bool_val == true); } catch (Throwable err) { err.printStackTrace(); @@ -278,21 +336,27 @@ public class TestH5A { } finally { if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException { - long loc_id = H5fid; + public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException + { + long loc_id = H5fid; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = HDF5Constants.H5I_INVALID_HID; - int ret_val = -1; - boolean bool_val = false; + 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, aapl_id); + attr_id = + H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id); ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); @@ -315,41 +379,42 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Arename_by_name() { - long loc_id = H5fid; - String obj_name = "."; + public void testH5Arename_by_name() + { + long loc_id = H5fid; + String obj_name = "."; String old_attr_name = "old"; String new_attr_name = "new"; - long attr_id = HDF5Constants.H5I_INVALID_HID; - int ret_val = -1; - boolean bool_val = false; + long attr_id = HDF5Constants.H5I_INVALID_HID; + int ret_val = -1; + boolean bool_val = false; try { - attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); + attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); - ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, - new_attr_name, lapl_id); + ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id); // Check the return value.It should be non negative. assertTrue("testH5Arename_by_name: H5Arename_by_name", ret_val >= 0); // Check if the new name of attribute attached to the object // specified by loc_id and obj_name exists.It should be true. - bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name, - lapl_id); - assertTrue("testH5Arename_by_name: H5Aexists_by_name", - bool_val == true); + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name, lapl_id); + assertTrue("testH5Arename_by_name: H5Aexists_by_name", bool_val == true); // Check if the old name of attribute attached to the object // specified by loc_id and obj_name exists. It should equal false. - bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name, - lapl_id); + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name, lapl_id); assertEquals(bool_val, false); } catch (Throwable err) { @@ -358,21 +423,25 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_name() { - String obj_name = "."; - String attr_name = "DATASET1"; - String ret_name = null; + public void testH5Aget_name() + { + String obj_name = "."; + String attr_name = "DATASET1"; + String ret_name = null; long attribute_id = HDF5Constants.H5I_INVALID_HID; try { - attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, - aapl_id, lapl_id); + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); ret_name = H5.H5Aget_name(attribute_id); assertEquals(ret_name, attr_name); @@ -383,40 +452,40 @@ public class TestH5A { } finally { if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } - @Test - public void testH5Aget_name_by_idx() { - long loc_id = H5fid; - String obj_name = "."; + public void testH5Aget_name_by_idx() + { + long loc_id = H5fid; + String obj_name = "."; String attr_name = "DATASET1", attr2_name = "DATASET2"; String ret_name = null; - int idx_type = HDF5Constants.H5_INDEX_NAME; - int order = HDF5Constants.H5_ITER_INC; - int n = 0; - long attr1_id = HDF5Constants.H5I_INVALID_HID; - long attr2_id = HDF5Constants.H5I_INVALID_HID; + int idx_type = HDF5Constants.H5_INDEX_NAME; + int order = HDF5Constants.H5_ITER_INC; + int n = 0; + 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, - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); // getting the 1st attribute name(n=0). - ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, - n, lapl_id); + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, n, lapl_id); assertFalse("H5Aget_name_by_idx ", ret_name == null); assertEquals(ret_name, attr_name); // getting the second attribute name(n=1) - ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, - 1, lapl_id); + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, 1, lapl_id); assertFalse("H5Aget_name_by_idx ", ret_name == null); assertEquals(ret_name, attr2_name); } @@ -426,20 +495,29 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_storage_size() { - long attr_id = HDF5Constants.H5I_INVALID_HID; + public void testH5Aget_storage_size() + { + 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, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); attr_size = H5.H5Aget_storage_size(attr_id); assertTrue("The size of attribute is :", attr_size == 0); @@ -450,27 +528,31 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_info() { + public void testH5Aget_info() + { H5A_info_t attr_info = null; - long attribute_id = HDF5Constants.H5I_INVALID_HID; - long attr_id = HDF5Constants.H5I_INVALID_HID; + 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, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); attribute_id = H5.H5Aopen(H5did, "dset", HDF5Constants.H5P_DEFAULT); // Calling H5Aget_info with attribute_id returned from H5Aopen. attr_info = H5.H5Aget_info(attribute_id); assertFalse("H5Aget_info ", attr_info == null); - assertTrue("Corder_Valid should be false", - attr_info.corder_valid == false); + assertTrue("Corder_Valid should be false", attr_info.corder_valid == false); assertTrue("Character set used for attribute name", - attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + attr_info.cset == HDF5Constants.H5T_CSET_ASCII); assertTrue("Corder ", attr_info.corder == 0); assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); } @@ -480,34 +562,40 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_info1() { + public void testH5Aget_info1() + { H5A_info_t attr_info = null; - long attribute_id = HDF5Constants.H5I_INVALID_HID; - long attr_id = HDF5Constants.H5I_INVALID_HID; - int order = HDF5Constants.H5_ITER_INC; + long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attr_id = HDF5Constants.H5I_INVALID_HID; + int order = HDF5Constants.H5_ITER_INC; try { - attr_id = H5.H5Acreate(H5did, ".", type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - attribute_id = H5.H5Aopen_by_idx(H5did, ".", - HDF5Constants.H5_INDEX_CRT_ORDER, order, 0, - HDF5Constants.H5P_DEFAULT, lapl_id); + attr_id = H5.H5Acreate(H5did, ".", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, order, 0, + HDF5Constants.H5P_DEFAULT, lapl_id); // Calling H5Aget_info with attribute_id returned from // H5Aopen_by_idx. attr_info = H5.H5Aget_info(attribute_id); assertFalse("H5Aget_info ", attr_info == null); - assertTrue("Corder_Valid should be true", - attr_info.corder_valid == true); - assertTrue("Character set", - attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + assertTrue("Corder_Valid should be true", attr_info.corder_valid == true); + assertTrue("Character set", attr_info.cset == HDF5Constants.H5T_CSET_ASCII); assertTrue("Corder ", attr_info.corder == 0); assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); } @@ -517,55 +605,81 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_info_by_idx() { - long attr_id = HDF5Constants.H5I_INVALID_HID; - long attr2_id = HDF5Constants.H5I_INVALID_HID;; + public void testH5Aget_info_by_idx() + { + long attr_id = HDF5Constants.H5I_INVALID_HID; + long attr2_id = HDF5Constants.H5I_INVALID_HID; + ; H5A_info_t attr_info = null; try { - attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - - //Verify info for 1st attribute, in increasing creation order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, lapl_id); + attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Verify info for 1st attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, lapl_id); assertNotNull(attr_info); - assertTrue("Corder ", attr_info.corder == 0);//should equal 0 as this is the order of 1st attribute created. + assertTrue("Corder ", + attr_info.corder == + 0); // should equal 0 as this is the order of 1st attribute created. assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); - //Verify info for 2nd attribute, in increasing creation order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, lapl_id); + // Verify info for 2nd attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 1, lapl_id); assertNotNull(attr_info); assertTrue("Corder", attr_info.corder == 1); assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr2_id)); - //verify info for 2nd attribute, in decreasing creation order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 0, lapl_id); + // verify info for 2nd attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_DEC, 0, lapl_id); assertNotNull(attr_info); - assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + assertTrue("Corder", + attr_info.corder == + 1); // should equal 1 as this is the order of 2nd attribute created. - //verify info for 1st attribute, in decreasing creation order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + // verify info for 1st attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_DEC, 1, lapl_id); assertNotNull(attr_info); - assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + assertTrue("Corder", + attr_info.corder == + 0); // should equal 0 as this is the order of 1st attribute created. - //verify info for 1st attribute, in increasing name order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1, lapl_id); + // verify info for 1st attribute, in increasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 1, lapl_id); assertNotNull(attr_info); - assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + assertTrue("Corder", + attr_info.corder == + 0); // should equal 0 as this is the order of 1st attribute created. - //verify info for 2nd attribute, in decreasing name order - attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + // verify info for 2nd attribute, in decreasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_DEC, 1, lapl_id); assertNotNull(attr_info); - assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + assertTrue("Corder", + attr_info.corder == + 1); // should equal 1 as this is the order of 2nd attribute created. } catch (Throwable err) { err.printStackTrace(); @@ -573,25 +687,32 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_info_by_name() { - long attr_id = HDF5Constants.H5I_INVALID_HID; + public void testH5Aget_info_by_name() + { + long attr_id = HDF5Constants.H5I_INVALID_HID; H5A_info_t attr_info = null; - String obj_name = "."; - String attr_name = "DATASET"; + String obj_name = "."; + String attr_name = "DATASET"; try { - attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, - space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name, - lapl_id); + attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name, lapl_id); assertNotNull(attr_info); } catch (Throwable err) { @@ -600,41 +721,45 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Adelete_by_name() { - long attr_id = HDF5Constants.H5I_INVALID_HID; - int ret_val = -1; + public void testH5Adelete_by_name() + { + long attr_id = HDF5Constants.H5I_INVALID_HID; + int ret_val = -1; boolean bool_val = false; - boolean exists = false; + boolean exists = false; try { - attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); assertTrue("H5Adelete_by_name", ret_val >= 0); // Check if the Attribute still exists. - bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET", - lapl_id); + bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET", lapl_id); assertFalse("testH5Adelete_by_name: H5Aexists_by_name", bool_val); exists = H5.H5Aexists(H5fid, "DATASET"); - assertFalse("testH5Adelete_by_name: H5Aexists ",exists); + assertFalse("testH5Adelete_by_name: H5Aexists ", exists); // Negative test. Error thrown when we try to delete an attribute // that has already been deleted. - try{ + try { ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); fail("Negative Test Failed: Error Not thrown."); } catch (AssertionError err) { fail("H5.H5Adelete_by_name: " + err); } - catch (HDF5LibraryException err) {} + catch (HDF5LibraryException err) { + } } catch (Throwable err) { err.printStackTrace(); @@ -642,14 +767,19 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aexists() { - boolean exists = false; - long attr_id = HDF5Constants.H5I_INVALID_HID; + public void testH5Aexists() + { + boolean exists = false; + long attr_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; try { @@ -662,14 +792,14 @@ public class TestH5A { assertFalse("H5Aexists ", exists); try { - attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - exists = H5.H5Aexists(H5fid, "dset"); + attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + exists = H5.H5Aexists(H5fid, "dset"); assertTrue("H5Aexists ", exists); - attribute_id = H5.H5Acreate_by_name(H5fid, ".", "attribute", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attribute_id = + H5.H5Acreate_by_name(H5fid, ".", "attribute", type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); exists = H5.H5Aexists(H5fid, "attribute"); assertTrue("H5Aexists ", exists); } @@ -679,35 +809,41 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Adelete_by_idx_order() { + public void testH5Adelete_by_idx_order() + { boolean exists = false; - 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; + 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", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - - H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3, lapl_id); + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3, + lapl_id); exists = H5.H5Aexists(H5fid, "attribute4"); assertFalse("H5Adelete_by_idx: H5Aexists", exists); } @@ -717,34 +853,49 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } if (attr3_id > 0) - try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr3_id); + } + catch (Exception ex) { + } if (attr4_id > 0) - try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr4_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Adelete_by_idx_name1() { + public void testH5Adelete_by_idx_name1() + { boolean exists = false; - long attr1_id = HDF5Constants.H5I_INVALID_HID; - long attr2_id = HDF5Constants.H5I_INVALID_HID; - long attr3_id = HDF5Constants.H5I_INVALID_HID; + 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", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, lapl_id); + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, + lapl_id); exists = H5.H5Aexists(H5fid, "attribute3"); assertFalse("H5Adelete_by_idx: H5Aexists", exists); } @@ -754,37 +905,47 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } if (attr3_id > 0) - try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr3_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Adelete_by_idx_name2() { + public void testH5Adelete_by_idx_name2() + { boolean exists = false; - 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; + 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", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - - H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3, lapl_id); + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3, + lapl_id); exists = H5.H5Aexists(H5fid, "attribute1"); assertFalse("H5Adelete_by_idx: H5Aexists", exists); } @@ -794,47 +955,66 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } if (attr3_id > 0) - try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr3_id); + } + catch (Exception ex) { + } if (attr4_id > 0) - try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr4_id); + } + catch (Exception ex) { + } } } @Test(expected = NullPointerException.class) - public void testH5Adelete_by_idx_null() throws Throwable { - H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER, - HDF5Constants.H5_ITER_INC, 0, lapl_id); + public void testH5Adelete_by_idx_null() throws Throwable + { + H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + lapl_id); } @Test(expected = HDF5LibraryException.class) - public void testH5Adelete_by_idx_invalidobject() throws Throwable { - H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER, - HDF5Constants.H5_ITER_INC, 0, lapl_id); + public void testH5Adelete_by_idx_invalidobject() throws Throwable + { + H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + lapl_id); } @Test - public void testH5Aopen_by_name() { - String obj_name = "."; - String attr_name = "DATASET"; + public void testH5Aopen_by_name() + { + String obj_name = "."; + String attr_name = "DATASET"; long attribute_id = HDF5Constants.H5I_INVALID_HID; - long aid = HDF5Constants.H5I_INVALID_HID; + long aid = HDF5Constants.H5I_INVALID_HID; try { - attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attribute_id = + H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); - //open Attribute by name - if(attribute_id >= 0) { + // open Attribute by name + if (attribute_id >= 0) { try { aid = H5.H5Aopen_by_name(H5fid, obj_name, attr_name, HDF5Constants.H5P_DEFAULT, lapl_id); - assertTrue("testH5Aopen_by_name: ", aid>=0); + assertTrue("testH5Aopen_by_name: ", aid >= 0); } - catch(Throwable err) { + catch (Throwable err) { err.printStackTrace(); fail("H5.H5Aopen_by_name " + err); } @@ -846,21 +1026,30 @@ public class TestH5A { } finally { if (aid > 0) - try {H5.H5Aclose(aid);} catch (Exception ex) {} + try { + H5.H5Aclose(aid); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Awrite_readVL() { - String attr_name = "VLdata"; - 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; + public void testH5Awrite_readVL() + { + String attr_name = "VLdata"; + 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; try { atype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); @@ -870,7 +1059,11 @@ public class TestH5A { } catch (Exception err) { if (atype_id > 0) - try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(atype_id); + } + catch (Exception ex) { + } err.printStackTrace(); fail("H5.testH5Awrite_readVL: " + err); } @@ -878,8 +1071,8 @@ public class TestH5A { try { aspace_id = H5.H5Screate_simple(1, dims, null); assertTrue(aspace_id > 0); - attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("testH5Awrite_readVL: ", attr_id >= 0); H5.H5AwriteVL(attr_id, atype_id, str_data); @@ -889,7 +1082,7 @@ public class TestH5A { for (int j = 0; j < dims.length; j++) { lsize *= dims[j]; } - String[] strs = new String[(int) lsize]; + String[] strs = new String[(int)lsize]; for (int j = 0; j < lsize; j++) { strs[j] = ""; } @@ -910,19 +1103,32 @@ public class TestH5A { } finally { if (attr_id > 0) - try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr_id); + } + catch (Exception ex) { + } if (aspace_id > 0) - try {H5.H5Sclose(aspace_id);} catch (Exception ex) {} + try { + H5.H5Sclose(aspace_id); + } + catch (Exception ex) { + } if (atype_id > 0) - try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(atype_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aget_create_plist() { - String attr_name = "DATASET1"; + public void testH5Aget_create_plist() + { + String attr_name = "DATASET1"; int char_encoding = 0; - long plist_id = HDF5Constants.H5I_INVALID_HID; + long plist_id = HDF5Constants.H5I_INVALID_HID; long attribute_id = HDF5Constants.H5I_INVALID_HID; try { @@ -942,11 +1148,13 @@ public class TestH5A { err.printStackTrace(); fail("H5Pget_char_encoding: " + err); } - assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + assertTrue("testH5Aget_create_plist: get_char_encoding", + char_encoding == HDF5Constants.H5T_CSET_ASCII); // Create an attribute for the dataset using the property list try { - attribute_id = H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT); + attribute_id = + H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT); assertTrue("testH5Aget_create_plist: H5Acreate", attribute_id >= 0); } catch (Throwable err) { @@ -967,7 +1175,8 @@ public class TestH5A { err.printStackTrace(); fail("H5Pget_char_encoding: " + err); } - assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + assertTrue("testH5Aget_create_plist: get_char_encoding", + char_encoding == HDF5Constants.H5T_CSET_ASCII); } catch (Throwable err) { err.printStackTrace(); @@ -975,14 +1184,23 @@ public class TestH5A { } finally { if (plist_id > 0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } if (attribute_id > 0) - try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aiterate() { + public void testH5Aiterate() + { long attr1_id = HDF5Constants.H5I_INVALID_HID; long attr2_id = HDF5Constants.H5I_INVALID_HID; long attr3_id = HDF5Constants.H5I_INVALID_HID; @@ -990,48 +1208,56 @@ public class TestH5A { class idata { public String attr_name = null; - idata(String name) { - this.attr_name = name; - } + idata(String name) { this.attr_name = name; } } class H5A_iter_data implements H5A_iterate_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } H5A_iterate_t iter_data = new H5A_iter_data(); class H5A_iter_callback implements H5A_iterate_cb { - public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) + { idata id = new idata(name); ((H5A_iter_data)op_data).iterdata.add(id); return 0; } } try { - attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); H5A_iterate_cb iter_cb = new H5A_iter_callback(); try { - H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb, + iter_data); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Aiterate: " + err); } - assertFalse("H5Aiterate ",((H5A_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Aiterate "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); - assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1")==0); - assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); - assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3")==0); - assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name.compareToIgnoreCase("attribute4")==0); + assertFalse("H5Aiterate ", ((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate " + ((H5A_iter_data)iter_data).iterdata.size(), + ((H5A_iter_data)iter_data).iterdata.size() == 4); + assertTrue( + "H5Aiterate " + (((H5A_iter_data)iter_data).iterdata.get(0)).attr_name, + (((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1") == + 0); + assertTrue( + "H5Aiterate " + (((H5A_iter_data)iter_data).iterdata.get(1)).attr_name, + (((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2") == + 0); + assertTrue( + "H5Aiterate " + ((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name, + (((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3") == + 0); + assertTrue("H5Aiterate " + ((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name, + ((idata)((H5A_iter_data)iter_data).iterdata.get(3)) + .attr_name.compareToIgnoreCase("attribute4") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -1039,18 +1265,35 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } if (attr3_id > 0) - try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr3_id); + } + catch (Exception ex) { + } if (attr4_id > 0) - try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr4_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Aiterate_by_name() { + public void testH5Aiterate_by_name() + { long attr1_id = HDF5Constants.H5I_INVALID_HID; long attr2_id = HDF5Constants.H5I_INVALID_HID; long attr3_id = HDF5Constants.H5I_INVALID_HID; @@ -1058,45 +1301,44 @@ public class TestH5A { class idata { public String attr_name = null; - idata(String name) { - this.attr_name = name; - } + idata(String name) { this.attr_name = name; } } class H5A_iter_data implements H5A_iterate_t { public ArrayList<idata> iterdata = new ArrayList<idata>(); } H5A_iterate_t iter_data = new H5A_iter_data(); class H5A_iter_callback implements H5A_iterate_cb { - public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) + { idata id = new idata(name); ((H5A_iter_data)op_data).iterdata.add(id); return 0; } } try { - attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); - attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", - type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); H5A_iterate_cb iter_cb = new H5A_iter_callback(); try { - H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, + iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Aiterate_by_name: " + err); } - assertFalse("H5Aiterate_by_name ",((H5A_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Aiterate_by_name "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); - assertTrue("H5Aiterate_by_name "+((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); + assertFalse("H5Aiterate_by_name ", ((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate_by_name " + ((H5A_iter_data)iter_data).iterdata.size(), + ((H5A_iter_data)iter_data).iterdata.size() == 4); + assertTrue("H5Aiterate_by_name " + ((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name, + ((idata)((H5A_iter_data)iter_data).iterdata.get(1)) + .attr_name.compareToIgnoreCase("attribute2") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -1104,17 +1346,29 @@ public class TestH5A { } finally { if (attr1_id > 0) - try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr1_id); + } + catch (Exception ex) { + } if (attr2_id > 0) - try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr2_id); + } + catch (Exception ex) { + } if (attr3_id > 0) - try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr3_id); + } + catch (Exception ex) { + } if (attr4_id > 0) - try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + try { + H5.H5Aclose(attr4_id); + } + catch (Exception ex) { + } } } - } - - - diff --git a/java/test/TestH5Arw.java b/java/test/TestH5Arw.java index 8ce2fee..56ac7f4 100644 --- a/java/test/TestH5Arw.java +++ b/java/test/TestH5Arw.java @@ -33,76 +33,103 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Arw { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_INTS_FILE = "tintsattrs.h5"; private static final String H5_FLTS_FILE = "tfloatsattrs.h5"; - private static final int DIM_X = 8; - private static final int DIM8_Y = 8; - private static final int DIM16_Y = 16; - private static final int DIM32_Y = 32; - private static final int DIM64_Y = 64; - private static final int DIM128_Y = 128; - private static final String DATASETU08 = "DU08BITS"; - private static final String DATASETS08 = "DS08BITS"; - private static final String DATASETU16 = "DU16BITS"; - private static final String DATASETS16 = "DS16BITS"; - private static final String DATASETU32 = "DU32BITS"; - private static final String DATASETS32 = "DS32BITS"; - private static final String DATASETU64 = "DU64BITS"; - private static final String DATASETS64 = "DS64BITS"; - private static final String DATASETF32 = "DS32BITS"; - private static final String DATASETF64 = "DS64BITS"; - private static final String DATASETF128 = "DS128BITS"; - private static final int RANK = 2; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5aid = HDF5Constants.H5I_INVALID_HID; - long H5did = HDF5Constants.H5I_INVALID_HID; - - private final void _closeH5file() throws HDF5LibraryException { + private static final int DIM_X = 8; + private static final int DIM8_Y = 8; + private static final int DIM16_Y = 16; + private static final int DIM32_Y = 32; + private static final int DIM64_Y = 64; + private static final int DIM128_Y = 128; + private static final String DATASETU08 = "DU08BITS"; + private static final String DATASETS08 = "DS08BITS"; + private static final String DATASETU16 = "DU16BITS"; + private static final String DATASETS16 = "DS16BITS"; + private static final String DATASETU32 = "DU32BITS"; + private static final String DATASETS32 = "DS32BITS"; + private static final String DATASETU64 = "DU64BITS"; + private static final String DATASETS64 = "DS64BITS"; + private static final String DATASETF32 = "DS32BITS"; + private static final String DATASETF64 = "DS64BITS"; + private static final String DATASETF128 = "DS128BITS"; + private static final int RANK = 2; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5aid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private final void _closeH5file() throws HDF5LibraryException + { if (H5aid >= 0) - try {H5.H5Aclose(H5aid);} catch (Exception ex) {} + try { + H5.H5Aclose(H5aid); + } + catch (Exception ex) { + } if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } - 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("TestH5Arw._openH5file: " + err); - } - assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0); - try { - H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Arw._openH5file: " + err); - } - assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0); - try { - H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Arw._openH5file: " + err); - } - assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0); + 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("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5aid = H5.H5Aopen(H5did, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Arw._openH5file: " + err); + } + assertTrue("TestH5Arw._openH5file: H5.H5Aopen: ", H5aid >= 0); } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5aid >= 0) - try {H5.H5Aclose(H5aid);} catch (Exception ex) {} + try { + H5.H5Aclose(H5aid); + } + catch (Exception ex) { + } if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; H5did = HDF5Constants.H5I_INVALID_HID; H5aid = HDF5Constants.H5I_INVALID_HID; @@ -110,14 +137,15 @@ public class TestH5Arw { } @Before - public void verifyCount() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void verifyCount() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @Test - public void testH5Aread_8bit_ints() { + public void testH5Aread_8bit_ints() + { byte[][] attr_data = new byte[DIM_X][DIM8_Y]; try { @@ -182,7 +210,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_16bit_ints() { + public void testH5Aread_16bit_ints() + { short[][] attr_data = new short[DIM_X][DIM16_Y]; try { @@ -247,7 +276,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_32bit_ints() { + public void testH5Aread_32bit_ints() + { int[][] attr_data = new int[DIM_X][DIM16_Y]; try { @@ -312,7 +342,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_64bit_ints() { + public void testH5Aread_64bit_ints() + { long[][] attr_data = new long[DIM_X][DIM64_Y]; try { @@ -377,7 +408,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_32bit_floats() { + public void testH5Aread_32bit_floats() + { float[][] attr_data = new float[DIM_X][DIM32_Y]; try { @@ -401,7 +433,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_64bit_floats() { + public void testH5Aread_64bit_floats() + { double[][] attr_data = new double[DIM_X][DIM64_Y]; try { @@ -425,7 +458,8 @@ public class TestH5Arw { } @Test - public void testH5Aread_128bit_floats() { + public void testH5Aread_128bit_floats() + { byte[][][] attr_data = new byte[DIM_X][DIM128_Y][8]; try { @@ -445,5 +479,4 @@ public class TestH5Arw { fail("testH5Aread_128bit_floats: H5Aread: " + err); } } - } diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index dac3a9c..4bab1a9 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -33,46 +33,50 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5D { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testD.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - private static final int RANK = 2; - 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 }; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int RANK = 2; + 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 enum H5D_space_status { - H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED( - 1), H5D_SPACE_STATUS_ALLOCATED(2); + H5D_SPACE_STATUS_ERROR(-1), + H5D_SPACE_STATUS_NOT_ALLOCATED(0), + H5D_SPACE_STATUS_PART_ALLOCATED(1), + H5D_SPACE_STATUS_ALLOCATED(2); private int code; - H5D_space_status(int space_status) { - this.code = space_status; - } + H5D_space_status(int space_status) { this.code = space_status; } - public int getCode() { - return this.code; - } + public int getCode() { return this.code; } } - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} - catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) + { try { H5dcpl_id = H5.H5Pcreate(dcpl_val); @@ -94,9 +98,8 @@ public class TestH5D { } try { - H5did0 = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, H5dcpl_id, HDF5Constants.H5P_DEFAULT); + H5did0 = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + H5dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -105,7 +108,8 @@ public class TestH5D { assertTrue("TestH5D._createPDataset.H5Dcreate: ", H5did0 >= 0); } - private final void _createChunkDataset(long fid, long dsid, String name, long dapl) { + private final void _createChunkDataset(long fid, long dsid, String name, long dapl) + { try { H5dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); @@ -127,9 +131,8 @@ public class TestH5D { } try { - H5did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, H5dcpl_id, dapl); + H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + H5dcpl_id, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -138,11 +141,11 @@ public class TestH5D { assertTrue("TestH5D._createChunkDataset.H5Dcreate: ", H5did >= 0); } - private final void _createDataset(long fid, long dsid, String name, long dapl) { + private final void _createDataset(long fid, long dsid, String name, long dapl) + { try { - H5did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -151,7 +154,8 @@ public class TestH5D { assertTrue("TestH5D._createDataset.H5Dcreate: ", H5did >= 0); } - private final void _createVLDataset(long fid, long dsid, String name, long dapl) { + private final void _createVLDataset(long fid, long dsid, String name, long dapl) + { try { H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); } @@ -169,8 +173,8 @@ public class TestH5D { fail("H5.H5Tset_size: " + err); } try { - H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -179,99 +183,153 @@ public class TestH5D { assertTrue("TestH5D._createVLDataset.H5Dcreate: ", H5did >= 0); } - private final void _closeH5file() throws HDF5LibraryException { + private final void _closeH5file() throws HDF5LibraryException + { if (H5dcpl_id >= 0) - try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(H5dcpl_id); + } + catch (Exception ex) { + } if (H5did0 >= 0) - try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did0); + } + catch (Exception ex) { + } if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5dtid > 0) - try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5dtid); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } - private final void _openH5file(String filename, String dsetname, long dapl) { - try { - H5fid = H5.H5Fopen(filename, - HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5D._openH5file: " + err); - } - assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0); - try { - H5did = H5.H5Dopen(H5fid, dsetname, dapl); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5D._openH5file: " + err); - } - assertTrue("TestH5D._openH5file: H5.H5Dopen: ",H5did >= 0); - try { - H5dsid = H5.H5Dget_space(H5did); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5D._openH5file: " + err); - } - assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + private final void _openH5file(String filename, String dsetname, long dapl) + { + try { + H5fid = H5.H5Fopen(filename, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ", H5dsid > 0); } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); - System.out.print(testname.getMethodName()); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); + System.out.print(testname.getMethodName()); try { H5faplid = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, H5faplid); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, H5faplid); H5dsid = H5.H5Screate_simple(RANK, H5dims, null); } catch (Throwable err) { err.printStackTrace(); fail("TestH5D.createH5file: " + err); } - assertTrue("TestH5D.createH5file: H5.H5Fcreate: ",H5fid >= 0); - assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); + assertTrue("TestH5D.createH5file: H5.H5Fcreate: ", H5fid >= 0); + assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ", H5dsid >= 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dcpl_id >= 0) - try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(H5dcpl_id); + } + catch (Exception ex) { + } if (H5did0 >= 0) - try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did0); + } + catch (Exception ex) { + } if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5dtid > 0) - try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5dtid); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5faplid >= 0) - try {H5.H5Pclose(H5faplid);} catch (Exception ex) {} + try { + H5.H5Pclose(H5faplid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); } @Test - public void testH5Dcreate() { + public void testH5Dcreate() + { long dataset_id = HDF5Constants.H5I_INVALID_HID; try { - dataset_id = H5.H5Dcreate(H5fid, "dset", - HDF5Constants.H5T_STD_I32BE, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception err) { err.printStackTrace(); @@ -290,11 +348,12 @@ public class TestH5D { } @Test - public void testH5Dcreate_anon() { + public void testH5Dcreate_anon() + { 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); + dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Exception err) { err.printStackTrace(); @@ -313,13 +372,14 @@ public class TestH5D { } @Test - public void testH5Dopen() { + public void testH5Dopen() + { long dataset_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { H5.H5Dclose(H5did); - H5did = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Exception err) { @@ -339,7 +399,8 @@ public class TestH5D { } @Test - public void testH5Dget_storage_size_empty() { + public void testH5Dget_storage_size_empty() + { long storage_size = 0; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); @@ -354,10 +415,11 @@ public class TestH5D { } @Test - public void testH5Dget_storage_size() { + public void testH5Dget_storage_size() + { long storage_size = 0; int[][] dset_data = new int[DIM_X][DIM_Y]; - int FILLVAL = 99; + int FILLVAL = 99; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); // Initialize the dataset. @@ -367,9 +429,8 @@ public class TestH5D { try { if (H5did >= 0) - H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data[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(); @@ -382,21 +443,22 @@ public class TestH5D { err.printStackTrace(); fail("testH5Dget_storage_size: " + err); } - assertTrue("testH5Dget_storage_size: "+storage_size, storage_size == DIM_X*DIM_Y*4); + assertTrue("testH5Dget_storage_size: " + storage_size, storage_size == DIM_X * DIM_Y * 4); } @Test - public void testH5Dget_access_plist() { - long dapl_id = HDF5Constants.H5I_INVALID_HID; - long test_dapl_id = HDF5Constants.H5I_INVALID_HID; - int[] mdc_nelmts1 = {0}; - int[] mdc_nelmts2 = {0}; + public void testH5Dget_access_plist() + { + 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}; long[] rdcc_nelmts2 = {0}; long[] rdcc_nbytes1 = {0}; long[] rdcc_nbytes2 = {0}; - double[] rdcc_w01 = {0}; - double[] rdcc_w02 = {0}; + double[] rdcc_w01 = {0}; + double[] rdcc_w02 = {0}; try { test_dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); @@ -442,14 +504,15 @@ public class TestH5D { catch (Exception err) { err.printStackTrace(); } - assertTrue("testH5Dget_access_plist: ", rdcc_nelmts2==rdcc_nelmts2 && rdcc_nbytes2==rdcc_nbytes2); + assertTrue("testH5Dget_access_plist: ", rdcc_nelmts2 == rdcc_nelmts2 && rdcc_nbytes2 == rdcc_nbytes2); } @Test - public void testH5Dget_space_status() { + public void testH5Dget_space_status() + { int[][] write_dset_data = new int[DIM_X][DIM_Y]; - int space_status = -1; - int space_status0 = -1; + int space_status = -1; + int space_status0 = -1; // Initialize the dataset. for (int indx = 0; indx < DIM_X; indx++) @@ -466,7 +529,8 @@ public class TestH5D { catch (Exception e) { e.printStackTrace(); } - assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ", space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ", + space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); // Retrieve and print space status and storage size for dset. try { @@ -475,12 +539,12 @@ public class TestH5D { catch (Exception e) { e.printStackTrace(); } - assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ", + space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); // Write the data to the dataset. try { - H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, write_dset_data); } catch (Exception e) { @@ -494,16 +558,18 @@ public class TestH5D { catch (Exception e) { e.printStackTrace(); } - assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ", + space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_space_closed() throws Throwable { + public void testH5Dget_space_closed() throws Throwable + { long dataset_id = HDF5Constants.H5I_INVALID_HID; try { - dataset_id = H5.H5Dcreate(H5fid, "dset", - HDF5Constants.H5T_STD_I32BE, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -516,7 +582,8 @@ public class TestH5D { } @Test - public void testH5Dget_space() { + public void testH5Dget_space() + { long dataspace_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); @@ -540,12 +607,13 @@ public class TestH5D { } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_type_closed() throws Throwable { + public void testH5Dget_type_closed() throws Throwable + { long dataset_id = HDF5Constants.H5I_INVALID_HID; try { - dataset_id = H5.H5Dcreate(H5fid, "dset", - HDF5Constants.H5T_STD_I32BE, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(H5fid, "dset", HDF5Constants.H5T_STD_I32BE, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -558,7 +626,8 @@ public class TestH5D { } @Test - public void testH5Dget_type() { + public void testH5Dget_type() + { long datatype_id = HDF5Constants.H5I_INVALID_HID; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); @@ -582,9 +651,10 @@ public class TestH5D { } @Test - public void testH5Dget_offset() { + public void testH5Dget_offset() + { int[][] write_dset_data = new int[DIM_X][DIM_Y]; - long dset_address = 0; + long dset_address = 0; _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { @@ -600,8 +670,7 @@ public class TestH5D { } // Write the data to the dataset. try { - H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, write_dset_data); } catch (Exception e) { @@ -621,15 +690,16 @@ public class TestH5D { } @Test - public void testH5Dfill_null() { - int[] buf_data = new int[DIM_X*DIM_Y]; + public void testH5Dfill_null() + { + int[] buf_data = new int[DIM_X * DIM_Y]; // Initialize memory buffer for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) { buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; } - byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data); // Fill selection in memory try { @@ -644,12 +714,13 @@ public class TestH5D { // Verify memory buffer the hard way for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) - assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0); + assertTrue("H5.H5Dfill: [" + indx + "," + jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0); } @Test - public void testH5Dfill() { - int[] buf_data = new int[DIM_X*DIM_Y]; + public void testH5Dfill() + { + int[] buf_data = new int[DIM_X * DIM_Y]; byte[] fill_value = HDFNativeData.intToByte(254); // Initialize memory buffer @@ -657,11 +728,12 @@ public class TestH5D { for (int jndx = 0; jndx < DIM_Y; jndx++) { buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; } - byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data); // Fill selection in memory try { - H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, + H5dsid); } catch (Exception err) { err.printStackTrace(); @@ -672,46 +744,51 @@ public class TestH5D { // Verify memory buffer the hard way for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) - assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 254); + assertTrue("H5.H5Dfill: [" + indx + "," + jndx + "] ", + buf_data[(indx * DIM_Y) + jndx] == 254); } @Test - public void testH5Diterate() { + public void testH5Diterate() + { final int SPACE_RANK = 2; final int SPACE_FILL = 254; class H5D_iter_data implements H5D_iterate_t { - public int fill_value; /* The fill value to check */ - public long fill_curr_coord; /* Current coordinate to examine */ - public long[] fill_coords; /* Pointer to selection's coordinates */ + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ } H5D_iterate_t iter_data = new H5D_iter_data(); class H5D_iter_callback implements H5D_iterate_cb { - public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { - //Check value in current buffer location + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) + { + // Check value in current buffer location int element = HDFNativeData.byteToInt(elem_buf, 0); - if(element != ((H5D_iter_data)op_data).fill_value) + if (element != ((H5D_iter_data)op_data).fill_value) return -1; - //Check number of dimensions - if(ndim != SPACE_RANK) - return(-1); - //Check Coordinates + // Check number of dimensions + if (ndim != SPACE_RANK) + return (-1); + // Check Coordinates long[] fill_coords = new long[2]; - fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; - fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + fill_coords[0] = + ((H5D_iter_data)op_data).fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data) + .fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; ((H5D_iter_data)op_data).fill_curr_coord++; - if(fill_coords[0] != point[0]) - return(-1); - if(fill_coords[1] != point[1]) - return(-1); + if (fill_coords[0] != point[0]) + return (-1); + if (fill_coords[1] != point[1]) + return (-1); - return(0); + return (0); } } - int[] buf_data = new int[DIM_X*DIM_Y]; + int[] buf_data = new int[DIM_X * DIM_Y]; byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); // Initialize memory buffer @@ -719,11 +796,12 @@ public class TestH5D { for (int jndx = 0; jndx < DIM_Y; jndx++) { buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; } - byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data); // Fill selection in memory try { - H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, + H5dsid); } catch (Exception err) { err.printStackTrace(); @@ -731,19 +809,20 @@ public class TestH5D { } // Initialize the iterator structure - ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; ((H5D_iter_data)iter_data).fill_curr_coord = 0; // Set the coordinates of the selection - ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + ((H5D_iter_data)iter_data).fill_coords = + new long[DIM_X * DIM_Y * SPACE_RANK]; /* Coordinates of selection */ for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) { - ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; - ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx) + 1] = jndx; } /* end for */ // Iterate through selection, verifying correct data H5D_iterate_cb iter_cb = new H5D_iter_callback(); - int op_status = -1; + int op_status = -1; try { op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); } @@ -755,47 +834,51 @@ public class TestH5D { } @Test - public void testH5Diterate_write() { + public void testH5Diterate_write() + { final int SPACE_RANK = 2; final int SPACE_FILL = 254; class H5D_iter_data implements H5D_iterate_t { - public int fill_value; /* The fill value to check */ - public long fill_curr_coord; /* Current coordinate to examine */ - public long[] fill_coords; /* Pointer to selection's coordinates */ + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ } H5D_iterate_t iter_data = new H5D_iter_data(); class H5D_iter_callback implements H5D_iterate_cb { - public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { - //Check value in current buffer location + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) + { + // Check value in current buffer location int element = HDFNativeData.byteToInt(elem_buf, 0); - if(element != ((H5D_iter_data)op_data).fill_value) + if (element != ((H5D_iter_data)op_data).fill_value) return -1; - //Check number of dimensions - if(ndim != SPACE_RANK) - return(-1); - //Check Coordinates + // Check number of dimensions + if (ndim != SPACE_RANK) + return (-1); + // Check Coordinates long[] fill_coords = new long[2]; - fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; - fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + fill_coords[0] = + ((H5D_iter_data)op_data).fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data) + .fill_coords[(int)(2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; ((H5D_iter_data)op_data).fill_curr_coord++; - if(fill_coords[0] != point[0]) - return(-1); - if(fill_coords[1] != point[1]) - return(-1); + if (fill_coords[0] != point[0]) + return (-1); + if (fill_coords[1] != point[1]) + return (-1); element -= 128; byte[] new_elembuf = HDFNativeData.intToByte(element); - elem_buf[0] = new_elembuf[0]; - elem_buf[1] = new_elembuf[1]; - elem_buf[2] = new_elembuf[2]; - elem_buf[3] = new_elembuf[3]; - return(0); + elem_buf[0] = new_elembuf[0]; + elem_buf[1] = new_elembuf[1]; + elem_buf[2] = new_elembuf[2]; + elem_buf[3] = new_elembuf[3]; + return (0); } } - int[] buf_data = new int[DIM_X*DIM_Y]; + int[] buf_data = new int[DIM_X * DIM_Y]; byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); // Initialize memory buffer @@ -803,11 +886,12 @@ public class TestH5D { for (int jndx = 0; jndx < DIM_Y; jndx++) { buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; } - byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X * DIM_Y, buf_data); // Fill selection in memory try { - H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, + H5dsid); } catch (Exception err) { err.printStackTrace(); @@ -815,19 +899,20 @@ public class TestH5D { } // Initialize the iterator structure - ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; ((H5D_iter_data)iter_data).fill_curr_coord = 0; // Set the coordinates of the selection - ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + ((H5D_iter_data)iter_data).fill_coords = + new long[DIM_X * DIM_Y * SPACE_RANK]; /* Coordinates of selection */ for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) { - ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; - ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2 * (indx * DIM_Y + jndx) + 1] = jndx; } /* end for */ // Iterate through selection, verifying correct data H5D_iterate_cb iter_cb = new H5D_iter_callback(); - int op_status = -1; + int op_status = -1; try { op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); } @@ -842,29 +927,27 @@ public class TestH5D { // Verify memory buffer the hard way for (int indx = 0; indx < DIM_X; indx++) for (int jndx = 0; jndx < DIM_Y; jndx++) - assertTrue("H5.H5Diterate: [" + indx+","+jndx + "] "+buf_data[(indx * DIM_Y) + jndx], buf_data[(indx * DIM_Y) + jndx] == 126); + assertTrue("H5.H5Diterate: [" + indx + "," + jndx + "] " + buf_data[(indx * DIM_Y) + jndx], + buf_data[(indx * DIM_Y) + jndx] == 126); } @Test - public void testH5Dvlen_get_buf_size() { - String[] str_data = { "Parting", "is such", "sweet", "sorrow.", - "Testing", "one", "two", "three.", - "Dog,", "man's", "best", "friend.", - "Diamonds", "are", "a", "girls!", - "S A", "T U R", "D A Y", "night", - "That's", "all", "folks", "!!!" }; - long vl_size = -1; /* Number of bytes used */ + public void testH5Dvlen_get_buf_size() + { + String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"}; + long vl_size = -1; /* Number of bytes used */ long str_data_bytes = 0; for (int idx = 0; idx < str_data.length; idx++) - str_data_bytes += str_data[idx].length() + 1; //Account for terminating null + str_data_bytes += str_data[idx].length() + 1; // Account for terminating null _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dwrite_VLStrings(H5did, H5dtid, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_data); + H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); } catch (Exception e) { e.printStackTrace(); @@ -879,63 +962,55 @@ public class TestH5D { } @Test(expected = IllegalArgumentException.class) - public void testH5Dvlen_read_invalid_buffer() throws Throwable { - String[] str_data = { "Parting", "is such", "sweet", "sorrow.", - "Testing", "one", "two", "three.", - "Dog,", "man's", "best", "friend.", - "Diamonds", "are", "a", "girls!", - "S A", "T U R", "D A Y", "night", - "That's", "all", "folks", "!!!" }; - byte[] read_data = new byte[512]; + public void testH5Dvlen_read_invalid_buffer() throws Throwable + { + String[] str_data = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"}; + byte[] read_data = new byte[512]; _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { - H5.H5Dwrite_VLStrings(H5did, H5dtid, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_data); + H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); } catch (Exception e) { e.printStackTrace(); } - H5.H5Dread(H5did, H5dtid, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, read_data); + H5.H5Dread(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, + read_data); } @Test - public void testH5Dvlen_write_read() { - String[] str_wdata = { "Parting", "is such", "sweet", "sorrow.", - "Testing", "one", "two", "three.", - "Dog,", "man's", "best", "friend.", - "Diamonds", "are", "a", "girls!", - "S A", "T U R", "D A Y", "night", - "That's", "all", "folks", "!!!" }; + public void testH5Dvlen_write_read() + { + String[] str_wdata = {"Parting", "is such", "sweet", "sorrow.", "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", "That's", "all", "folks", "!!!"}; String[] str_rdata = new String[DIM_X * DIM_Y]; _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dwrite_VLStrings(H5did, H5dtid, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_wdata); + H5.H5Dwrite_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_wdata); } catch (Exception e) { e.printStackTrace(); } try { if ((H5did >= 0) && (H5dtid >= 0)) - H5.H5Dread_VLStrings(H5did, H5dtid, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, str_rdata); + H5.H5Dread_VLStrings(H5did, H5dtid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_rdata); } catch (Exception e) { e.printStackTrace(); } for (int v = 0; v < DIM_X * DIM_Y; v++) - assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v], str_wdata[v] == str_wdata[v]); + assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v], + str_wdata[v] == str_wdata[v]); } - } diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java index 3661139..e42e10b 100644 --- a/java/test/TestH5Dparams.java +++ b/java/test/TestH5Dparams.java @@ -13,6 +13,7 @@ package test; import static org.junit.Assert.assertTrue; + import hdf.hdf5lib.H5; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -23,108 +24,128 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Dparams { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } - @Test//(expected = HDF5LibraryException.class) - public void testH5Dclose_invalid() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Dclose_invalid() throws Throwable + { long did = H5.H5Dclose(-1); assertTrue(did == 0); } @Test(expected = NullPointerException.class) - public void testH5Dcreate_null() throws Throwable { + public void testH5Dcreate_null() throws Throwable + { H5.H5Dcreate(-1, null, 0, 0, 0, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Dcreate_invalid() throws Throwable { + public void testH5Dcreate_invalid() throws Throwable + { H5.H5Dcreate(-1, "Bogus", -1, -1, -1, -1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dcreate_anon_invalid() throws Throwable { + public void testH5Dcreate_anon_invalid() throws Throwable + { H5.H5Dcreate_anon(-1, -1, -1, -1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_access_plist_invalid() throws Throwable { + public void testH5Dget_access_plist_invalid() throws Throwable + { H5.H5Dget_access_plist(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_create_plist_invalid() throws Throwable { + public void testH5Dget_create_plist_invalid() throws Throwable + { H5.H5Dget_create_plist(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_offset_invalid() throws Throwable { + public void testH5Dget_offset_invalid() throws Throwable + { H5.H5Dget_offset(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_space_invalid() throws Throwable { + public void testH5Dget_space_invalid() throws Throwable + { H5.H5Dget_space(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_type_invalid() throws Throwable { + public void testH5Dget_type_invalid() throws Throwable + { H5.H5Dget_type(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dget_space_status_invalid() throws Throwable { + public void testH5Dget_space_status_invalid() throws Throwable + { int status = H5.H5Dget_space_status(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dset_extent_status_invalid() throws Throwable { + public void testH5Dset_extent_status_invalid() throws Throwable + { long[] size = new long[2]; H5.H5Dset_extent(-1, size); } @Test(expected = NullPointerException.class) - public void testH5Dset_extent_status_null() throws Throwable { + public void testH5Dset_extent_status_null() throws Throwable + { H5.H5Dset_extent(-1, null); } @Test(expected = NullPointerException.class) - public void testH5Dopen_null() throws Throwable { + public void testH5Dopen_null() throws Throwable + { H5.H5Dopen(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Dopen_invalid() throws Throwable { + public void testH5Dopen_invalid() throws Throwable + { H5.H5Dopen(-1, "Bogus", 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Dvlen_get_buf_size_invalid() throws Throwable { + public void testH5Dvlen_get_buf_size_invalid() throws Throwable + { H5.H5Dvlen_get_buf_size(-1, -1, -1); } @Test(expected = IllegalArgumentException.class) - public void testH5Dget_storage_size_invalid() throws Throwable { + public void testH5Dget_storage_size_invalid() throws Throwable + { H5.H5Dget_storage_size(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Dflush_invalid() throws Throwable { + public void testH5Dflush_invalid() throws Throwable + { H5.H5Dflush(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Drefresh_invalid() throws Throwable { + public void testH5Drefresh_invalid() throws Throwable + { H5.H5Drefresh(-1); } - } diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java index 774b9dd..b9e97f4 100644 --- a/java/test/TestH5Dplist.java +++ b/java/test/TestH5Dplist.java @@ -30,35 +30,42 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Dplist { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testDp.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 7; - private static final int EDIM_X = 6; - private static final int EDIM_Y = 10; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int NDIMS = 2; - private static final int FILLVAL = 99; - private static final int RANK = 2; - long H5fid = 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 }; - long[] H5maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; - - private final void _deleteFile(String filename) { + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + private static final int RANK = 2; + long H5fid = 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}; + long[] H5maxdims = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED}; + + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) + { try { H5dcpl_id = H5.H5Pcreate(dcpl_val); } @@ -78,7 +85,7 @@ public class TestH5Dplist { // Set the fill value for the dataset try { - int[] fill_value = { FILLVAL }; + int[] fill_value = {FILLVAL}; H5.H5Pset_fill_value(H5dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); } catch (Exception e) { @@ -98,136 +105,151 @@ public class TestH5Dplist { _createDataset(H5fid, H5dsid, "dset", H5dcpl_id, HDF5Constants.H5P_DEFAULT); } - private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { + private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl) + { try { - H5did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, dcpl, dapl); + H5did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + dcpl, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5Dplist._createDataset: ",H5did > 0); + assertTrue("TestH5Dplist._createDataset: ", H5did > 0); } @Before - public void createH5file() throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5dsid = H5.H5Screate_simple(RANK, H5dims, H5maxdims); } catch (Throwable err) { err.printStackTrace(); fail("TestH5Dplist.createH5file: " + err); } - assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ",H5fid > 0); - assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ", H5dsid > 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dcpl_id >= 0) - try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(H5dcpl_id); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); } - @Test - public void testH5Dset_extent() { - int[][] write_dset_data = new int[DIM_X][DIM_Y]; - int[][] read_dset_data = new int[DIM_X][DIM_Y]; - int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; - - // Initialize the dataset. - for (int indx = 0; indx < DIM_X; indx++) - for (int jndx = 0; jndx < DIM_Y; jndx++) - write_dset_data[indx][jndx] = indx * jndx - jndx; - - _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); - - // Read values from the dataset, which has not been written to yet. - try { - H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, read_dset_data); - } - catch (Exception e) { - e.printStackTrace(); - } - assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99); - - // Write the data to the dataset. - try { - H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, write_dset_data); - } - catch (Exception e) { - e.printStackTrace(); - } - - // Read the data back. - try { - H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, read_dset_data); - } - catch (Exception e) { - e.printStackTrace(); - } - assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12); - - // Extend the dataset. - try { - H5.H5Dset_extent(H5did, H5extdims); - } - catch (Exception e) { - e.printStackTrace(); - } - - // Read from the extended dataset. - try { - H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, extend_dset_data); - } - catch (Exception e) { - e.printStackTrace(); - } - assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12); - assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99); - } - - @Test - public void testH5P_dset_no_attrs_hint() { - boolean ret_val_id = true; - - _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); - - try { - ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); - assertFalse("H5P_dset_no_attrs_hint", ret_val_id); - H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true); - ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); - assertTrue("H5P_dset_no_attrs_hint", ret_val_id); - } - catch (Throwable err) { - err.printStackTrace(); - fail("H5P_dset_no_attrs_hint: " + err); - } - } + @Test + public void testH5Dset_extent() + { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); + + // Read values from the dataset, which has not been written to yet. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99); + + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data back. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12); + + // Extend the dataset. + try { + H5.H5Dset_extent(H5did, H5extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read from the extended dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12); + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99); + } + + @Test + public void testH5P_dset_no_attrs_hint() + { + boolean ret_val_id = true; + + _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); + + try { + ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); + assertFalse("H5P_dset_no_attrs_hint", ret_val_id); + H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true); + ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id); + assertTrue("H5P_dset_no_attrs_hint", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_dset_no_attrs_hint: " + err); + } + } } diff --git a/java/test/TestH5Drw.java b/java/test/TestH5Drw.java index 69fb9d7..b18bed7 100644 --- a/java/test/TestH5Drw.java +++ b/java/test/TestH5Drw.java @@ -33,77 +33,97 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Drw { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_INTS_FILE = "tintsattrs.h5"; private static final String H5_FLTS_FILE = "tfloatsattrs.h5"; - private static final int DIM_X = 8; - private static final int DIM8_Y = 8; - private static final int DIM16_Y = 16; - private static final int DIM32_Y = 32; - private static final int DIM64_Y = 64; - private static final int DIM128_Y = 128; - private static final String DATASETU08 = "DU08BITS"; - private static final String DATASETS08 = "DS08BITS"; - private static final String DATASETU16 = "DU16BITS"; - private static final String DATASETS16 = "DS16BITS"; - private static final String DATASETU32 = "DU32BITS"; - private static final String DATASETS32 = "DS32BITS"; - private static final String DATASETU64 = "DU64BITS"; - private static final String DATASETS64 = "DS64BITS"; - private static final String DATASETF32 = "DS32BITS"; - private static final String DATASETF64 = "DS64BITS"; - private static final String DATASETF128 = "DS128BITS"; - private static final int RANK = 2; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5did = HDF5Constants.H5I_INVALID_HID; - - private final void _closeH5file() throws HDF5LibraryException { + private static final int DIM_X = 8; + private static final int DIM8_Y = 8; + private static final int DIM16_Y = 16; + private static final int DIM32_Y = 32; + private static final int DIM64_Y = 64; + private static final int DIM128_Y = 128; + private static final String DATASETU08 = "DU08BITS"; + private static final String DATASETS08 = "DS08BITS"; + private static final String DATASETU16 = "DU16BITS"; + private static final String DATASETS16 = "DS16BITS"; + private static final String DATASETU32 = "DU32BITS"; + private static final String DATASETS32 = "DS32BITS"; + private static final String DATASETU64 = "DU64BITS"; + private static final String DATASETS64 = "DS64BITS"; + private static final String DATASETF32 = "DS32BITS"; + private static final String DATASETF64 = "DS64BITS"; + private static final String DATASETF128 = "DS128BITS"; + private static final int RANK = 2; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; + + private final void _closeH5file() throws HDF5LibraryException + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } - 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("TestH5Drw._openH5file: " + err); - } - assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0); - try { - H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5Drw._openH5file: " + err); - } - assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0); + 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("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Drw._openH5file: " + err); + } + assertTrue("TestH5Drw._openH5file: H5.H5Dopen: ", H5did >= 0); } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; H5did = HDF5Constants.H5I_INVALID_HID; System.out.println(); } @Before - public void verifyCount() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void verifyCount() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @Test - public void testH5Dread_8bit_ints() { + public void testH5Dread_8bit_ints() + { byte[][] dset_data = new byte[DIM_X][DIM8_Y]; try { @@ -117,7 +137,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -144,7 +164,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -153,7 +173,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_16bit_ints() { + public void testH5Dread_16bit_ints() + { short[][] dset_data = new short[DIM_X][DIM16_Y]; try { @@ -167,7 +188,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -194,7 +215,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT16, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -203,7 +224,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_32bit_ints() { + public void testH5Dread_32bit_ints() + { int[][] dset_data = new int[DIM_X][DIM16_Y]; try { @@ -217,7 +239,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -244,7 +266,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT32, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -253,7 +275,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_64bit_ints() { + public void testH5Dread_64bit_ints() + { long[][] dset_data = new long[DIM_X][DIM64_Y]; try { @@ -267,7 +290,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_UINT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -294,7 +317,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT64, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -303,7 +326,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_32bit_floats() { + public void testH5Dread_32bit_floats() + { float[][] dset_data = new float[DIM_X][DIM32_Y]; try { @@ -317,7 +341,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_FLOAT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -328,7 +352,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_64bit_floats() { + public void testH5Dread_64bit_floats() + { double[][] dset_data = new double[DIM_X][DIM64_Y]; try { @@ -342,7 +367,7 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); @@ -353,7 +378,8 @@ public class TestH5Drw { } @Test - public void testH5Dread_128bit_floats() { + public void testH5Dread_128bit_floats() + { byte[][][] dset_data = new byte[DIM_X][DIM128_Y][8]; try { @@ -367,12 +393,11 @@ public class TestH5Drw { // Read data. try { H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_LDOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + HDF5Constants.H5P_DEFAULT, dset_data); } catch (Exception err) { err.printStackTrace(); fail("testH5Dread_128bit_floats: H5Dread: " + err); } } - } diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java index cad0a06..bdd6802 100644 --- a/java/test/TestH5E.java +++ b/java/test/TestH5E.java @@ -22,9 +22,9 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.callbacks.H5E_walk_cb; import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5E_error2_t; import org.junit.After; @@ -35,20 +35,22 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5E { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); long hdf_java_classid = -1; - long current_stackid = -1; + long current_stackid = -1; @Before - public void H5Eget_stack_class() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void H5Eget_stack_class() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); hdf_java_classid = -1; try { hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5"); - current_stackid = H5.H5Eget_current_stack(); + current_stackid = H5.H5Eget_current_stack(); } catch (Throwable err) { err.printStackTrace(); @@ -57,7 +59,8 @@ public class TestH5E { } @After - public void H5Erestore_stack_class() { + public void H5Erestore_stack_class() + { try { H5.H5Eunregister_class(hdf_java_classid); hdf_java_classid = -1; @@ -72,14 +75,15 @@ public class TestH5E { } @Test - public void testH5Eget_msg_major() { + public void testH5Eget_msg_major() + { try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { - long errnum = hdferr.getMajorErrorNumber(); - int[] error_msg_type = { HDF5Constants.H5E_MAJOR }; - String msg = null; + long errnum = hdferr.getMajorErrorNumber(); + int[] error_msg_type = {HDF5Constants.H5E_MAJOR}; + String msg = null; try { msg = H5.H5Eget_msg(errnum, error_msg_type); @@ -92,11 +96,11 @@ public class TestH5E { assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, error_msg_type[0]); /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error string might be different. - * Only check for the specific error message if the native - * connector is being used. - */ + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ String connector = System.getenv("HDF5_VOL_CONNECTOR"); if (connector == null) assertTrue("H5.H5Eget_msg: ", msg.contains("File accessibility")); @@ -108,14 +112,15 @@ public class TestH5E { } @Test - public void testH5Eget_msg_minor() { + public void testH5Eget_msg_minor() + { try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException hdferr) { - long errnum = hdferr.getMinorErrorNumber(); - int[] error_msg_type = { HDF5Constants.H5E_MINOR }; - String msg = null; + long errnum = hdferr.getMinorErrorNumber(); + int[] error_msg_type = {HDF5Constants.H5E_MINOR}; + String msg = null; try { msg = H5.H5Eget_msg(errnum, error_msg_type); @@ -128,11 +133,11 @@ public class TestH5E { assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, error_msg_type[0]); /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error string might be different. - * Only check for the specific error message if the native - * connector is being used. - */ + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error string might be different. + * Only check for the specific error message if the native + * connector is being used. + */ String connector = System.getenv("HDF5_VOL_CONNECTOR"); if (connector == null) assertTrue("H5.H5Eget_msg: ", msg.contains("Unable to open file")); @@ -144,9 +149,10 @@ public class TestH5E { } @Test - public void testH5Epop() { + public void testH5Epop() + { - long num_msg = -1; + long num_msg = -1; long saved_num_msg = -1; try { @@ -213,13 +219,14 @@ public class TestH5E { } @Test - public void testH5Epush() { - String err_func = "testH5Epush"; - String err_msg = "Error message"; - long estack_id = -1; - long maj_err_id = -1; - long min_err_id = -1; - long num_msg = -1; + public void testH5Epush() + { + String err_func = "testH5Epush"; + String err_msg = "Error message"; + long estack_id = -1; + long maj_err_id = -1; + long min_err_id = -1; + long num_msg = -1; try { try { @@ -231,7 +238,8 @@ public class TestH5E { fail("testH5Epush: H5.H5Ecreate_msg_major: " + err); } try { - min_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); + min_err_id = + H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); assertFalse("H5.H5Ecreate_msg_minor: " + min_err_id, min_err_id < 0); } catch (Throwable err) { @@ -257,7 +265,8 @@ public class TestH5E { fail("testH5Epush: H5.H5Eget_num: " + err); } - H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id, err_msg); + H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id, + err_msg); try { num_msg = H5.H5Eget_num(estack_id); @@ -274,24 +283,38 @@ public class TestH5E { } finally { if (estack_id >= 0) - try {H5.H5Eclose_stack(estack_id);} catch (Exception ex) {} + try { + H5.H5Eclose_stack(estack_id); + } + catch (Exception ex) { + } if (maj_err_id >= 0) - try {H5.H5Eclose_msg(maj_err_id);} catch (Exception ex) {} + try { + H5.H5Eclose_msg(maj_err_id); + } + catch (Exception ex) { + } if (min_err_id >= 0) - try {H5.H5Eclose_msg(min_err_id);} catch (Exception ex) {} + try { + H5.H5Eclose_msg(min_err_id); + } + catch (Exception ex) { + } } } /* end test_create() */ @Test - public void testH5Ewalk() { + public void testH5Ewalk() + { class wdata { - public String err_desc = null; + public String err_desc = null; public String func_name = null; - public int line = -1; - wdata(String desc, String func, int lineno) { - this.err_desc = new String(desc); + public int line = -1; + wdata(String desc, String func, int lineno) + { + this.err_desc = new String(desc); this.func_name = new String(func); - this.line = lineno; + this.line = lineno; } } class H5E_walk_data implements H5E_walk_t { @@ -299,14 +322,15 @@ public class TestH5E { } H5E_walk_t walk_data = new H5E_walk_data(); class H5E_walk_callback implements H5E_walk_cb { - public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data) { + public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data) + { wdata wd = new wdata(info.desc, info.func_name, info.line); ((H5E_walk_data)op_data).walkdata.add(wd); return 0; } } H5E_walk_cb walk_cb = new H5E_walk_callback(); - long num_msg = -1; + long num_msg = -1; try { H5.H5Eset_current_stack(current_stackid); @@ -346,9 +370,8 @@ public class TestH5E { err.printStackTrace(); fail("testH5Ewalk:H5Ewalk2 " + err); } - assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); - assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size() > 0); + assertFalse("testH5Ewalk:H5Ewalk2 ", ((H5E_walk_data)walk_data).walkdata.isEmpty()); + assertTrue("testH5Ewalk:H5Ewalk2 " + ((H5E_walk_data)walk_data).walkdata.size(), + ((H5E_walk_data)walk_data).walkdata.size() > 0); } - } - diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java index 9e93cea..c412cf2 100644 --- a/java/test/TestH5Edefault.java +++ b/java/test/TestH5Edefault.java @@ -15,25 +15,28 @@ package test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; +import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; -import org.junit.Ignore; import org.junit.rules.TestName; public class TestH5Edefault { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); public static final int ERRSTACK_CNT = 6; @Before - public void H5Eset_default_stack() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void H5Eset_default_stack() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -46,23 +49,26 @@ public class TestH5Edefault { } } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test(expected = IllegalArgumentException.class) - public void testH5Eprint2_invalid_classid() throws Throwable { + public void testH5Eprint2_invalid_classid() throws Throwable + { H5.H5Eprint2(-1, null); } @Ignore - public void testH5Eprint() { + public void testH5Eprint() + { /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error stack might be different. - * Only check for the specific error stack if the native - * connector is being used. - */ + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ String connector = System.getenv("HDF5_VOL_CONNECTOR"); if (connector == null) { try { @@ -81,19 +87,20 @@ public class TestH5Edefault { } @Test - public void testH5Eget_current_stack() { - long num_msg = -1; - long num_msg_default = -1; - long saved_num_msg = -1; - long stack_id = -1; + public void testH5Eget_current_stack() + { + long num_msg = -1; + long num_msg_default = -1; + long saved_num_msg = -1; + long stack_id = -1; long stack_id_default = HDF5Constants.H5E_DEFAULT; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - //default stack id will be different after exception + // default stack id will be different after exception stack_id_default = HDF5Constants.H5E_DEFAULT; - //err.printStackTrace(); //This will clear the error stack + // err.printStackTrace(); //This will clear the error stack } // Verify we have messages on the error stack try { @@ -147,16 +154,17 @@ public class TestH5Edefault { } @Test - public void testH5Eget_current_stack_pop() { - long num_msg = -1; + public void testH5Eget_current_stack_pop() + { + long num_msg = -1; long num_msg_default = -1; - long saved_num_msg = -1; - long stack_id = -1; + long saved_num_msg = -1; + long stack_id = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - //err.printStackTrace(); //This will clear the error stack + // err.printStackTrace(); //This will clear the error stack } // Verify there are error messages on the stack and save it @@ -179,7 +187,8 @@ public class TestH5Edefault { fail("H5.H5Eget_current_stack: " + err); } assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id < 0); - assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + stack_id, + stack_id == HDF5Constants.H5E_DEFAULT); // Verify the stack is empty try { @@ -206,7 +215,7 @@ public class TestH5Edefault { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - //err.printStackTrace(); //This will clear the error stack + // err.printStackTrace(); //This will clear the error stack } // Verify we have a nonzero number of messages and save it @@ -243,37 +252,44 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Eclose_stack_invalid_stackid() throws Throwable { + public void testH5Eclose_stack_invalid_stackid() throws Throwable + { H5.H5Eclose_stack(-1); } @Test(expected = IllegalArgumentException.class) - public void testH5Eget_class_name_invalid_classid() throws Throwable { + public void testH5Eget_class_name_invalid_classid() throws Throwable + { H5.H5Eget_class_name(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Eget_class_name_invalid_classname() throws Throwable { + public void testH5Eget_class_name_invalid_classname() throws Throwable + { H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT); } @Test(expected = IllegalArgumentException.class) - public void testH5Eclose_msg_invalid_errid() throws Throwable { + public void testH5Eclose_msg_invalid_errid() throws Throwable + { H5.H5Eclose_msg(-1); } @Test(expected = IllegalArgumentException.class) - public void testH5Ecreate_msg_invalid_errid() throws Throwable { + public void testH5Ecreate_msg_invalid_errid() throws Throwable + { H5.H5Ecreate_msg(-1, HDF5Constants.H5E_MAJOR, "null"); } @Test(expected = IllegalArgumentException.class) - public void testH5Eget_msg_invalid_msgid() throws Throwable { + public void testH5Eget_msg_invalid_msgid() throws Throwable + { H5.H5Eget_msg(-1, null); } @Test - public void testH5Ecreate_stack() { + public void testH5Ecreate_stack() + { try { long stack_id = H5.H5Ecreate_stack(); assertTrue("H5.H5Ecreate_stack", stack_id > 0); @@ -286,14 +302,16 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Eset_current_stack_invalid_stkid() throws Throwable { + public void testH5Eset_current_stack_invalid_stkid() throws Throwable + { H5.H5Eset_current_stack(-1); } @Test - public void testH5Eset_current_stack() { - long num_msg = -1; - long stack_id = -1; + public void testH5Eset_current_stack() + { + long num_msg = -1; + long stack_id = -1; long saved_num_msg = -1; // Generate errors on the default stack @@ -301,7 +319,7 @@ public class TestH5Edefault { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - //err.printStackTrace(); //This will clear the error stack + // err.printStackTrace(); //This will clear the error stack } // Verify we have a nonzero number of messages and save it @@ -324,7 +342,8 @@ public class TestH5Edefault { fail("H5.H5Eset_current_stack: " + err); } assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id < 0); - assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + assertFalse("H5.H5Eset_current_stack: get_current_stack - " + stack_id, + stack_id == HDF5Constants.H5E_DEFAULT); // Verify the copy has the same number of messages as the original stack try { @@ -341,7 +360,7 @@ public class TestH5Edefault { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - //err.printStackTrace(); //This will clear the error stack + // err.printStackTrace(); //This will clear the error stack } // Verify we have the same number of messages as before @@ -388,13 +407,15 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Epop_invalid_stkid() throws Throwable { + public void testH5Epop_invalid_stkid() throws Throwable + { H5.H5Epop(-1, 0); } @Test - public void testH5Epop() throws Throwable { - long num_msg = -1; + public void testH5Epop() throws Throwable + { + long num_msg = -1; long saved_num_msg = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); @@ -422,28 +443,33 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Epush_invalid_stkid() throws Throwable { + public void testH5Epush_invalid_stkid() throws Throwable + { H5.H5Epush(-1, "Invalid", "Invalid", 0, -1, -1, -1, "Invalid message"); } @Test(expected = NullPointerException.class) - public void testH5Epush_null_name() throws Throwable { - H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message"); + public void testH5Epush_null_name() throws Throwable + { + H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, + HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message"); } @Test(expected = IllegalArgumentException.class) - public void testH5EprintInt_invalid_classid() throws Throwable { + public void testH5EprintInt_invalid_classid() throws Throwable + { H5.H5Eprint2(-1, null); } @Ignore - public void testH5EprintInt() { + public void testH5EprintInt() + { /* - * If HDF5_VOL_CONNECTOR is set, this might not be the - * native connector and the error stack might be different. - * Only check for the specific error stack if the native - * connector is being used. - */ + * If HDF5_VOL_CONNECTOR is set, this might not be the + * native connector and the error stack might be different. + * Only check for the specific error stack if the native + * connector is being used. + */ String connector = System.getenv("HDF5_VOL_CONNECTOR"); if (connector == null) { try { @@ -462,7 +488,8 @@ public class TestH5Edefault { } @Test - public void testH5EclearInt() { + public void testH5EclearInt() + { try { H5.H5Eclear(HDF5Constants.H5E_DEFAULT); } @@ -473,12 +500,14 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Eclear2_invalid_stkid() throws Throwable { + public void testH5Eclear2_invalid_stkid() throws Throwable + { H5.H5Eclear2(-1); } @Test - public void testH5Eclear() { + public void testH5Eclear() + { try { H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); } @@ -489,7 +518,8 @@ public class TestH5Edefault { } @Test - public void testH5Eclear2_with_msg() { + public void testH5Eclear2_with_msg() + { long num_msg = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); @@ -516,12 +546,14 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Eauto_is_v2_invalid_stkid() throws Throwable { + public void testH5Eauto_is_v2_invalid_stkid() throws Throwable + { H5.H5Eauto_is_v2(-1); } @Test - public void testH5Eauto_is_v2() { + public void testH5Eauto_is_v2() + { boolean is_v2 = false; try { is_v2 = H5.H5Eauto_is_v2(HDF5Constants.H5E_DEFAULT); @@ -534,12 +566,14 @@ public class TestH5Edefault { } @Test(expected = IllegalArgumentException.class) - public void testH5Eget_num_invalid_stkid() throws Throwable { + public void testH5Eget_num_invalid_stkid() throws Throwable + { H5.H5Eget_num(-1); } @Test - public void testH5Eget_num() { + public void testH5Eget_num() + { long num_msg = -1; try { num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); @@ -552,7 +586,8 @@ public class TestH5Edefault { } @Test - public void testH5Eget_num_with_msg() { + public void testH5Eget_num_with_msg() + { long num_msg = -1; try { H5.H5Fopen("test", HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); @@ -568,6 +603,4 @@ public class TestH5Edefault { } assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); } - } - diff --git a/java/test/TestH5Eparams.java b/java/test/TestH5Eparams.java index e55f1fc..4300ae6 100644 --- a/java/test/TestH5Eparams.java +++ b/java/test/TestH5Eparams.java @@ -22,9 +22,9 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.callbacks.H5E_walk_cb; import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5E_error2_t; import org.junit.After; @@ -35,19 +35,21 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Eparams { - @Rule public TestName testname = new TestName(); - long hdf_java_classid = -1; - long current_stackid = -1; + @Rule + public TestName testname = new TestName(); + long hdf_java_classid = -1; + long current_stackid = -1; @Before - public void H5Eget_stack_class() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void H5Eget_stack_class() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); hdf_java_classid = -1; try { hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5"); - current_stackid = H5.H5Eget_current_stack(); + current_stackid = H5.H5Eget_current_stack(); } catch (Throwable err) { err.printStackTrace(); @@ -56,7 +58,8 @@ public class TestH5Eparams { } @After - public void H5Erestore_stack_class() { + public void H5Erestore_stack_class() + { try { H5.H5Eunregister_class(hdf_java_classid); hdf_java_classid = -1; @@ -71,7 +74,8 @@ public class TestH5Eparams { } @Test - public void testH5Eget_class_name() { + public void testH5Eget_class_name() + { try { String class_name = H5.H5Eget_class_name(hdf_java_classid); assertNotNull("H5.H5Eget_class_name: " + class_name, class_name); @@ -84,7 +88,8 @@ public class TestH5Eparams { } @Test - public void testH5Eprint2() { + public void testH5Eprint2() + { try { assertFalse(current_stackid < 0); H5.H5Eprint2(current_stackid, null); @@ -96,17 +101,20 @@ public class TestH5Eparams { } @Ignore("Tested with create_msg_major[minor]") - public void testH5Eclose_msg() { + public void testH5Eclose_msg() + { fail("Not yet implemented"); } @Test(expected = NullPointerException.class) - public void testH5Ecreate_msg_name_null() throws Throwable { + public void testH5Ecreate_msg_name_null() throws Throwable + { H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null); } @Test - public void testH5Ecreate_msg_major() { + public void testH5Ecreate_msg_major() + { try { long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test"); assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0); @@ -119,9 +127,11 @@ public class TestH5Eparams { } @Test - public void testH5Ecreate_msg_minor() { + public void testH5Ecreate_msg_minor() + { try { - long err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); + long err_id = + H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0); H5.H5Eclose_msg(err_id); } @@ -132,10 +142,11 @@ public class TestH5Eparams { } @Test - public void testH5Eget_msg() { - int[] error_msg_type = { HDF5Constants.H5E_MINOR }; - long err_id = -1; - String msg = null; + public void testH5Eget_msg() + { + int[] error_msg_type = {HDF5Constants.H5E_MINOR}; + long err_id = -1; + String msg = null; try { err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test"); } @@ -164,7 +175,8 @@ public class TestH5Eparams { } @Test - public void testH5Ecreate_stack() { + public void testH5Ecreate_stack() + { long stk_id = -1; try { stk_id = H5.H5Ecreate_stack(); @@ -184,7 +196,8 @@ public class TestH5Eparams { } @Test - public void testH5EprintInt() { + public void testH5EprintInt() + { assertFalse(current_stackid < 0); try { H5.H5Eprint2(current_stackid, null); @@ -196,7 +209,8 @@ public class TestH5Eparams { } @Test - public void testH5EclearInt() { + public void testH5EclearInt() + { try { H5.H5Eclear(current_stackid); } @@ -207,7 +221,8 @@ public class TestH5Eparams { } @Test - public void testH5Eclear2() { + public void testH5Eclear2() + { try { H5.H5Eclear2(current_stackid); } @@ -218,7 +233,8 @@ public class TestH5Eparams { } @Test - public void testH5Eauto_is_v2() { + public void testH5Eauto_is_v2() + { boolean is_v2 = false; try { is_v2 = H5.H5Eauto_is_v2(current_stackid); @@ -231,7 +247,8 @@ public class TestH5Eparams { } @Test - public void testH5Eget_num() { + public void testH5Eget_num() + { long num_msg = -1; try { num_msg = H5.H5Eget_num(current_stackid); @@ -244,7 +261,8 @@ public class TestH5Eparams { } @Test - public void testH5Eget_num_with_msg() { + public void testH5Eget_num_with_msg() + { try { H5.H5Eset_current_stack(current_stackid); } @@ -277,5 +295,4 @@ public class TestH5Eparams { } assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); } - } diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java index 99e8e5f..b4c63e0 100644 --- a/java/test/TestH5Eregister.java +++ b/java/test/TestH5Eregister.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import org.junit.After; @@ -23,40 +24,48 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Eregister { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test(expected = NullPointerException.class) - public void testH5Eregister_class_cls_name_null() throws Throwable { + public void testH5Eregister_class_cls_name_null() throws Throwable + { H5.H5Eregister_class(null, "libname", "version"); } @Test(expected = NullPointerException.class) - public void testH5Eregister_class_lib_name_null() throws Throwable { + public void testH5Eregister_class_lib_name_null() throws Throwable + { H5.H5Eregister_class("clsname", null, "version"); } @Test(expected = NullPointerException.class) - public void testH5Eregister_class_version_null() throws Throwable { + public void testH5Eregister_class_version_null() throws Throwable + { H5.H5Eregister_class("clsname", "libname", null); } @Test(expected = IllegalArgumentException.class) - public void testH5Eunregister_class_invalid_classid() throws Throwable { + public void testH5Eunregister_class_invalid_classid() throws Throwable + { H5.H5Eunregister_class(-1); } @Test - public void testH5Eregister_class() { + public void testH5Eregister_class() + { long hdf_java_classid = -1; try { hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", "hdf-java", "2.5"); diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java index 16786b9..fde2739 100644 --- a/java/test/TestH5F.java +++ b/java/test/TestH5F.java @@ -30,49 +30,58 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5F { - @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testF.h5"; + @Rule + public TestName testname = new TestName(); + private static final String H5_FILE = "testF.h5"; private static final String H5_FILE2 = "testF2.h5"; - private static final int COUNT_OBJ_FILE = 1; - private static final int COUNT_OBJ_DATASET = 0; - private static final int COUNT_OBJ_GROUP = 0; + private static final int COUNT_OBJ_FILE = 1; + private static final int COUNT_OBJ_DATASET = 0; + private static final int COUNT_OBJ_GROUP = 0; private static final int COUNT_OBJ_DATATYPE = 0; - private static final int COUNT_OBJ_ATTR = 0; - private static final int COUNT_OBJ_ALL = (COUNT_OBJ_FILE - + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR); - private static final int[] OBJ_COUNTS = { COUNT_OBJ_FILE, - COUNT_OBJ_DATASET, COUNT_OBJ_GROUP, COUNT_OBJ_DATATYPE, - COUNT_OBJ_ATTR, COUNT_OBJ_ALL }; - private static final int[] OBJ_TYPES = { HDF5Constants.H5F_OBJ_FILE, - HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, - HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, - HDF5Constants.H5F_OBJ_ALL }; - long H5fid = HDF5Constants.H5I_INVALID_HID; - - private final void _deleteFile(String filename) { + private static final int COUNT_OBJ_ATTR = 0; + private static final int COUNT_OBJ_ALL = + (COUNT_OBJ_FILE + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR); + private static final int[] OBJ_COUNTS = {COUNT_OBJ_FILE, COUNT_OBJ_DATASET, COUNT_OBJ_GROUP, + COUNT_OBJ_DATATYPE, COUNT_OBJ_ATTR, COUNT_OBJ_ALL}; + private static final int[] OBJ_TYPES = {HDF5Constants.H5F_OBJ_FILE, HDF5Constants.H5F_OBJ_DATASET, + HDF5Constants.H5F_OBJ_GROUP, HDF5Constants.H5F_OBJ_DATATYPE, + HDF5Constants.H5F_OBJ_ATTR, HDF5Constants.H5F_OBJ_ALL}; + long H5fid = HDF5Constants.H5I_INVALID_HID; + + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); @@ -80,7 +89,8 @@ public class TestH5F { } @Test - public void testH5Fget_create_plist() { + public void testH5Fget_create_plist() + { long plist = HDF5Constants.H5I_INVALID_HID; try { @@ -90,13 +100,23 @@ public class TestH5F { fail("H5.H5Fget_create_plist: " + err); } assertTrue(plist > 0); - try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + try { + H5.H5Pclose(plist); + } + catch (HDF5LibraryException e) { + e.printStackTrace(); + } } @Test(expected = HDF5LibraryException.class) - public void testH5Fget_create_plist_closed() throws Throwable { + public void testH5Fget_create_plist_closed() throws Throwable + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } // it should fail because the file was closed. @@ -104,7 +124,8 @@ public class TestH5F { } @Test - public void testH5Fget_access_plist() { + public void testH5Fget_access_plist() + { long plist = HDF5Constants.H5I_INVALID_HID; try { @@ -114,13 +135,23 @@ public class TestH5F { fail("H5.H5Fget_access_plist: " + err); } assertTrue(plist > 0); - try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + try { + H5.H5Pclose(plist); + } + catch (HDF5LibraryException e) { + e.printStackTrace(); + } } @Test(expected = HDF5LibraryException.class) - public void testH5Fget_access_plist_closed() throws Throwable { + public void testH5Fget_access_plist_closed() throws Throwable + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } // it should fail because the file was closed. @@ -128,17 +159,21 @@ public class TestH5F { } @Test - public void testH5Fget_intent_rdwr() { + public void testH5Fget_intent_rdwr() + { int intent = 0; if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; } try { - H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -153,17 +188,21 @@ public class TestH5F { } @Test - public void testH5Fget_intent_rdonly() { + public void testH5Fget_intent_rdonly() + { int intent = 0; if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; } try { - H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, - HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -178,26 +217,26 @@ public class TestH5F { } @Test - public void testH5Fget_fileno_same() { + public void testH5Fget_fileno_same() + { long fileno1 = 0; long fileno2 = 0; - long fid1 = HDF5Constants.H5I_INVALID_HID; - long fid2 = HDF5Constants.H5I_INVALID_HID; + long fid1 = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { - fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid1 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(fid1, HDF5Constants.H5F_SCOPE_LOCAL); assertTrue("H5Fcreate failed", fid1 > 0); - fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid2 = H5.H5Fopen(H5_FILE2, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); assertTrue("H5Fopen failed", fid2 > 0); fileno1 = H5.H5Fget_fileno(fid1); - assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0); + assertTrue("H5Fget_fileno1=" + fileno1, fileno1 > 0); fileno2 = H5.H5Fget_fileno(fid2); - assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0); + assertTrue("H5Fget_fileno2=" + fileno2, fileno2 > 0); - assertEquals("fileno1["+fileno1+"]!=fileno2["+fileno2+"]", fileno1, fileno2); + assertEquals("fileno1[" + fileno1 + "]!=fileno2[" + fileno2 + "]", fileno1, fileno2); } catch (Throwable err) { fail("testH5Fget_fileno_same: " + err); @@ -209,23 +248,24 @@ public class TestH5F { } @Test - public void testH5Fget_fileno_diff() { + public void testH5Fget_fileno_diff() + { long fileno1 = 0; long fileno2 = 0; - long fid2 = HDF5Constants.H5I_INVALID_HID; + long fid2 = HDF5Constants.H5I_INVALID_HID; try { - fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(fid2, HDF5Constants.H5F_SCOPE_LOCAL); assertTrue("H5Fcreate failed", fid2 > 0); fileno1 = H5.H5Fget_fileno(H5fid); - assertTrue("H5Fget_fileno1="+fileno1, fileno1 > 0); + assertTrue("H5Fget_fileno1=" + fileno1, fileno1 > 0); fileno2 = H5.H5Fget_fileno(fid2); - assertTrue("H5Fget_fileno2="+fileno2, fileno2 > 0); + assertTrue("H5Fget_fileno2=" + fileno2, fileno2 > 0); - assertNotEquals("fileno1["+fileno1+"]==fileno2["+fileno2+"]", fileno1, fileno2); + assertNotEquals("fileno1[" + fileno1 + "]==fileno2[" + fileno2 + "]", fileno1, fileno2); } catch (Throwable err) { fail("testH5Fget_fileno_diff: " + err); @@ -236,7 +276,8 @@ public class TestH5F { } @Test - public void testH5Fget_obj_count() { + public void testH5Fget_obj_count() + { long count = -1; for (int i = 0; i < OBJ_TYPES.length; i++) { @@ -252,10 +293,11 @@ public class TestH5F { } @Test - public void testH5Fget_obj_ids() { - long count = 0; - long max_objs = 100; - long[] obj_id_list = new long[(int)max_objs]; + public void testH5Fget_obj_ids() + { + long count = 0; + long max_objs = 100; + long[] obj_id_list = new long[(int)max_objs]; int[] open_obj_counts = new int[OBJ_TYPES.length]; for (int i = 0; i < OBJ_TYPES.length; i++) @@ -267,8 +309,7 @@ public class TestH5F { for (int i = 0; i < OBJ_TYPES.length; i++) { try { - count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs, - obj_id_list); + count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs, obj_id_list); } catch (Throwable err) { fail("H5.H5Fget_obj_ids: " + err); diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java index 4f3d928..37be943 100644 --- a/java/test/TestH5Fbasic.java +++ b/java/test/TestH5Fbasic.java @@ -31,45 +31,59 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Fbasic { - @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testFb.h5"; + @Rule + public TestName testname = new TestName(); + private static final String H5_FILE = "testFb.h5"; private static final String TXT_FILE = "testFb.txt"; - long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } _deleteFile(H5_FILE); System.out.println(); } @Test - public void testH5Fcreate() { + public void testH5Fcreate() + { assertTrue(H5fid > 0); } @Test - public void testH5Fis_accessible() { + public void testH5Fis_accessible() + { boolean isH5 = false; try { @@ -82,18 +96,19 @@ public class TestH5Fbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Fcreate_EXCL() throws Throwable { - H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Fcreate_EXCL() throws Throwable + { + H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Fopen_read_only() throws Throwable { + public void testH5Fopen_read_only() throws Throwable + { long fid = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -108,8 +123,7 @@ public class TestH5Fbasic { File file = new File(H5_FILE); if (file.setWritable(false)) { // this should fail. - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); try { H5.H5Fclose(fid); @@ -123,13 +137,13 @@ public class TestH5Fbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Freopen_closed() throws Throwable { - long fid = HDF5Constants.H5I_INVALID_HID; + public void testH5Freopen_closed() throws Throwable + { + long fid = HDF5Constants.H5I_INVALID_HID; long fid2 = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -146,13 +160,13 @@ public class TestH5Fbasic { } @Test - public void testH5Freopen() { - long fid = HDF5Constants.H5I_INVALID_HID; + public void testH5Freopen() + { + long fid = HDF5Constants.H5I_INVALID_HID; long fid2 = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -180,12 +194,12 @@ public class TestH5Fbasic { } @Test - public void testH5Fclose() { + public void testH5Fclose() + { long fid = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -200,12 +214,12 @@ public class TestH5Fbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Fclose_twice() throws Throwable { + public void testH5Fclose_twice() throws Throwable + { long fid = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, - HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -223,7 +237,8 @@ public class TestH5Fbasic { } @Test - public void testH5Fget_freespace() { + public void testH5Fget_freespace() + { long freeSpace = 0; try { @@ -238,7 +253,8 @@ public class TestH5Fbasic { // TODO add/and delete objects and test freespace @Test - public void testH5Fget_filesize() { + public void testH5Fget_filesize() + { long fileSize = 0; try { @@ -253,7 +269,8 @@ public class TestH5Fbasic { // TODO add/and delete objects and test freespace @Test - public void testH5Fget_mdc_hit_rate() { + public void testH5Fget_mdc_hit_rate() + { double rate; try { @@ -265,8 +282,9 @@ public class TestH5Fbasic { } @Test - public void testH5Fget_mdc_size() { - int nentries = -1; + public void testH5Fget_mdc_size() + { + int nentries = -1; long cache_sizes[] = new long[3]; try { @@ -281,7 +299,8 @@ public class TestH5Fbasic { // TODO: test more cases of different cache sizes. @Test - public void testH5Freset_mdc_hit_rate_stats() { + public void testH5Freset_mdc_hit_rate_stats() + { try { H5.H5Freset_mdc_hit_rate_stats(H5fid); @@ -292,7 +311,8 @@ public class TestH5Fbasic { } @Test - public void testH5Fget_name() { + public void testH5Fget_name() + { String fname = null; try { @@ -306,7 +326,8 @@ public class TestH5Fbasic { } @Test - public void testH5Fclear_elink_file_cache() { + public void testH5Fclear_elink_file_cache() + { try { H5.H5Fclear_elink_file_cache(H5fid); @@ -317,7 +338,8 @@ public class TestH5Fbasic { } @Test - public void testH5F_dset_no_attrs_hint() { + public void testH5F_dset_no_attrs_hint() + { boolean ret_val_id = true; try { ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid); diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java index 0376485..6accc3b 100644 --- a/java/test/TestH5Fparams.java +++ b/java/test/TestH5Fparams.java @@ -32,46 +32,54 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Fparams { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test(expected = NullPointerException.class) - public void testH5Fcreate_null() throws Throwable { - H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Fcreate_null() throws Throwable + { + H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test(expected = NullPointerException.class) - public void testH5Fopen_null() throws Throwable { + public void testH5Fopen_null() throws Throwable + { H5.H5Fopen(null, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); } @Test(expected = NullPointerException.class) - public void testH5Fis_accessible_null() throws Throwable { + public void testH5Fis_accessible_null() throws Throwable + { H5.H5Fis_accessible(null, -1); } @Test(expected = NullPointerException.class) - public void testH5Fmount_null() throws Throwable { + public void testH5Fmount_null() throws Throwable + { H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT); } @Test(expected = NullPointerException.class) - public void testH5Funmount_null() throws Throwable { + public void testH5Funmount_null() throws Throwable + { H5.H5Funmount(-1, null); } @Ignore - public void testH5Fis_hdf5_text() { + public void testH5Fis_hdf5_text() + { File txtFile = null; boolean isH5 = false; @@ -91,25 +99,27 @@ public class TestH5Fparams { txtFile.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - @Test//(expected = HDF5LibraryException.class) - public void testH5Fclose_negative() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Fclose_negative() throws Throwable + { // cannot close a file with negative id. int fid = H5.H5Fclose(-1); assertTrue(fid == 0); } @Test - public void testH5Fcreate() { - long fid = HDF5Constants.H5I_INVALID_HID; + public void testH5Fcreate() + { + long fid = HDF5Constants.H5I_INVALID_HID; File file = null; try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); if (fid > 0) { H5.H5Fclose(fid); } @@ -124,18 +134,19 @@ public class TestH5Fparams { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } } @Test - public void testH5Fflush_global() { + public void testH5Fflush_global() + { long fid = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -156,12 +167,13 @@ public class TestH5Fparams { } @Test - public void testH5Fflush_local() { + public void testH5Fflush_local() + { long fid = HDF5Constants.H5I_INVALID_HID; try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fopen: " + err); @@ -182,13 +194,14 @@ public class TestH5Fparams { } @Test - public void testH5Fget_info() { + public void testH5Fget_info() + { long fid = HDF5Constants.H5I_INVALID_HID; try { try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fcreate: " + err); @@ -205,21 +218,26 @@ public class TestH5Fparams { } } catch (Exception e) { - e.printStackTrace(); + e.printStackTrace(); } finally { - try {H5.H5Fclose(fid);} catch (Exception ex) {} + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } } } - @Ignore//(expected = HDF5FunctionArgumentException.class) - public void testH5Fset_libver_bounds_invalidlow() throws Throwable { + @Ignore //(expected = HDF5FunctionArgumentException.class) + public void testH5Fset_libver_bounds_invalidlow() throws Throwable + { long fid = HDF5Constants.H5I_INVALID_HID; try { try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fcreate: " + err); @@ -227,26 +245,36 @@ public class TestH5Fparams { H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST); } finally { - try {H5.H5Fclose(fid);} catch (Exception ex) {} + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } } } - @Ignore//(expected = HDF5FunctionArgumentException.class) - public void testH5Fset_libver_bounds_invalidhigh() throws Throwable { + @Ignore //(expected = HDF5FunctionArgumentException.class) + public void testH5Fset_libver_bounds_invalidhigh() throws Throwable + { long fid = HDF5Constants.H5I_INVALID_HID; try { try { - fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { fail("H5.H5Fcreate: " + err); } - H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); + H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_LATEST, + HDF5Constants.H5F_LIBVER_LATEST + 1); } finally { - try {H5.H5Fclose(fid);} catch (Exception ex) {} + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } } } } diff --git a/java/test/TestH5Fswmr.java b/java/test/TestH5Fswmr.java index 1ec78fe..823640d 100644 --- a/java/test/TestH5Fswmr.java +++ b/java/test/TestH5Fswmr.java @@ -29,25 +29,31 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Fswmr { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testswmr.h5"; - long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; long H5fapl = HDF5Constants.H5I_INVALID_HID; long H5fcpl = HDF5Constants.H5I_INVALID_HID; - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); H5fapl = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); @@ -59,17 +65,30 @@ public class TestH5Fswmr { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fapl > 0) { - try {H5.H5Pclose(H5fapl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5fapl); + } + catch (Exception ex) { + } H5fapl = HDF5Constants.H5I_INVALID_HID; } if (H5fcpl > 0) { - try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5fcpl); + } + catch (Exception ex) { + } H5fcpl = HDF5Constants.H5I_INVALID_HID; } - if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5fid > 0) { + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } H5fid = HDF5Constants.H5I_INVALID_HID; } _deleteFile(H5_FILE); @@ -77,7 +96,8 @@ public class TestH5Fswmr { } @Test - public void testH5Fstart_swmr_write() { + public void testH5Fstart_swmr_write() + { try { H5.H5Fstart_swmr_write(H5fid); } @@ -87,7 +107,8 @@ public class TestH5Fswmr { } @Test - public void testH5Fswmr_read_attempts() { + public void testH5Fswmr_read_attempts() + { long read_attempts = 0; try { diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java index edf2cbe..1f6da31 100644 --- a/java/test/TestH5G.java +++ b/java/test/TestH5G.java @@ -32,20 +32,22 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5G { - @Rule public TestName testname = new TestName(); - private static final String H5_FILE = "testG.h5"; - private static final String H5_FILE2 = "testG2.h5"; - private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12", - "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" }; - private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5fid2 = HDF5Constants.H5I_INVALID_HID; - - private final long _createGroup(long fid, String name) { + @Rule + public TestName testname = new TestName(); + private static final String H5_FILE = "testG.h5"; + private static final String H5_FILE2 = "testG2.h5"; + private static final String[] GROUPS = {"/G1", "/G1/G11", "/G1/G12", "/G1/G11/G111", + "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114"}; + private static final String[] GROUPS2 = {"/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; + + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -56,41 +58,51 @@ public class TestH5G { return gid; } - private final long _createGroup2(long fid, String name) { - long gid = HDF5Constants.H5I_INVALID_HID; + private final long _createGroup2(long fid, String name) + { + long gid = HDF5Constants.H5I_INVALID_HID; long gcpl = HDF5Constants.H5I_INVALID_HID; try { - gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl + gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); // create gcpl } catch (final Exception ex) { fail("H5.H5Pcreate(): " + ex); } assertTrue("TestH5G._createGroup2: ", gcpl >= 0); try { - H5.H5Pset_link_creation_order(gcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED - + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order + H5.H5Pset_link_creation_order(gcpl, + HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order } catch (final Exception ex) { - try {H5.H5Pclose(gcpl);} catch (final Exception exx) {} + try { + H5.H5Pclose(gcpl); + } + catch (final Exception exx) { + } fail("H5.H5Pset_link_creation_order: " + ex); } try { - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - gcpl, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, gcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } finally { - try {H5.H5Pclose(gcpl);} catch (final Exception ex) {} + try { + H5.H5Pclose(gcpl); + } + catch (final Exception ex) { + } } assertTrue("TestH5G._createGroup2: ", gid > 0); return gid; } - private final long _openGroup(long fid, String name) { + private final long _openGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); @@ -105,26 +117,31 @@ public class TestH5G { return gid; } - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); H5fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -137,12 +154,20 @@ public class TestH5G { for (int i = 0; i < GROUPS.length; i++) { gid = _createGroup(H5fid, GROUPS[i]); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } for (int i = 0; i < GROUPS2.length; i++) { gid = _createGroup2(H5fid2, GROUPS2[i]); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -150,20 +175,30 @@ public class TestH5G { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } if (H5fid2 > 0) { - try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid2); + } + catch (Exception ex) { + } } - _deleteFile(H5_FILE); - _deleteFile(H5_FILE2); - System.out.println(); + _deleteFile(H5_FILE); + _deleteFile(H5_FILE2); + System.out.println(); } @Test - public void testH5Gopen() { + public void testH5Gopen() + { long gid = HDF5Constants.H5I_INVALID_HID; for (int i = 0; i < GROUPS.length; i++) { try { @@ -183,7 +218,8 @@ public class TestH5G { } @Test - public void testH5Gget_create_plist() { + public void testH5Gget_create_plist() + { long gid = HDF5Constants.H5I_INVALID_HID; long pid = HDF5Constants.H5I_INVALID_HID; @@ -215,7 +251,8 @@ public class TestH5G { } @Test - public void testH5Gget_info() { + public void testH5Gget_info() + { H5G_info_t info = null; for (int i = 0; i < GROUPS.length; i++) { @@ -232,13 +269,13 @@ public class TestH5G { } @Test - public void testH5Gget_info_by_name() { + public void testH5Gget_info_by_name() + { H5G_info_t info = null; for (int i = 0; i < GROUPS.length; i++) { try { - info = H5.H5Gget_info_by_name(H5fid, GROUPS[i], - HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_name(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -249,13 +286,13 @@ public class TestH5G { } @Test - public void testH5Gget_info_by_idx() { + public void testH5Gget_info_by_idx() + { H5G_info_t info = null; for (int i = 0; i < 2; i++) { try { - info = H5.H5Gget_info_by_idx(H5fid, "/G1", - HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, - i, HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_idx(H5fid, "/G1", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -266,7 +303,8 @@ public class TestH5G { } @Test - public void testH5Gget_obj_info_all() { + public void testH5Gget_obj_info_all() + { H5G_info_t info = null; long gid = _openGroup(H5fid, GROUPS[0]); @@ -279,27 +317,31 @@ public class TestH5G { fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_info: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } assertNotNull("TestH5G.testH5Gget_obj_info_all: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all: number of links is empty", info.nlinks > 0); - String objNames[] = new String[(int) info.nlinks]; - int objTypes[] = new int[(int) info.nlinks]; - int lnkTypes[] = new int[(int) info.nlinks]; - H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; + String objNames[] = new String[(int)info.nlinks]; + int objTypes[] = new int[(int)info.nlinks]; + int lnkTypes[] = new int[(int)info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, - objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); + names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_obj_info_all: " + err); } - assertTrue("number found[" + names_found + "] different than expected[" - + objNames.length + "]", names_found == objNames.length); + assertTrue("number found[" + names_found + "] different than expected[" + objNames.length + "]", + names_found == objNames.length); for (int i = 0; i < objNames.length; i++) { assertNotNull("name #" + i + " does not exist", objNames[i]); assertTrue("TestH5G.testH5Gget_obj_info_all: ", objNames[i].length() > 0); @@ -307,7 +349,8 @@ public class TestH5G { } @Test - public void testH5Gget_obj_info_all_gid() { + public void testH5Gget_obj_info_all_gid() + { H5G_info_t info = null; long gid = _openGroup(H5fid, GROUPS[0]); @@ -316,25 +359,27 @@ public class TestH5G { info = H5.H5Gget_info(gid); assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0); - String objNames[] = new String[(int) info.nlinks]; - H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; - int lnkTypes[] = new int[(int) info.nlinks]; - int objTypes[] = new int[(int) info.nlinks]; + String objNames[] = new String[(int)info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks]; + int lnkTypes[] = new int[(int)info.nlinks]; + int objTypes[] = new int[(int)info.nlinks]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objTokens, HDF5Constants.H5_INDEX_NAME); + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_obj_info_all: " + err); } - assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found + "] different than expected[" - + objNames.length + "]", names_found == objNames.length); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found + + "] different than expected[" + objNames.length + "]", + names_found == objNames.length); for (int i = 0; i < objNames.length; i++) { - assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist", objNames[i]); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist", + objNames[i]); assertTrue("TestH5G.testH5Gget_obj_info_all_gid: ", objNames[i].length() > 0); } } @@ -343,12 +388,17 @@ public class TestH5G { fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_info: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } } @Test - public void testH5Gget_obj_info_all_gid2() { + public void testH5Gget_obj_info_all_gid2() + { H5G_info_t info = null; long gid = _openGroup(H5fid, GROUPS[1]); @@ -357,25 +407,27 @@ public class TestH5G { info = H5.H5Gget_info(gid); assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0); - String objNames[] = new String[(int) info.nlinks]; - H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; - int lnkTypes[] = new int[(int) info.nlinks]; - int objTypes[] = new int[(int) info.nlinks]; + String objNames[] = new String[(int)info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks]; + int lnkTypes[] = new int[(int)info.nlinks]; + int objTypes[] = new int[(int)info.nlinks]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, - objTokens, HDF5Constants.H5_INDEX_NAME); + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_obj_info_all: " + err); } - assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found + "] different than expected[" - + objNames.length + "]", names_found == objNames.length); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found + + "] different than expected[" + objNames.length + "]", + names_found == objNames.length); for (int i = 0; i < objNames.length; i++) { - assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist", objNames[i]); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist", + objNames[i]); assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: ", objNames[i].length() > 0); } } @@ -384,73 +436,91 @@ public class TestH5G { fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_info: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } } @Test - public void testH5Gget_obj_info_max() { - long gid = _openGroup(H5fid, GROUPS[0]); - long groups_max_size = GROUPS.length + 1; - String objNames[] = new String[(int)groups_max_size]; - int objTypes[] = new int[(int)groups_max_size]; - int lnkTypes[] = new int[(int)groups_max_size]; + public void testH5Gget_obj_info_max() + { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length + 1; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objTokens, groups_max_size); + names_found = + H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_max: H5.H5Gget_obj_info_max: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } // expected number does not include root group - assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found + "] different than expected[" - + (GROUPS.length - 1) + "]", names_found == (GROUPS.length - 1)); - for (int i = 0; i < GROUPS.length-1; i++) { - assertNotNull("TestH5G.testH5Gget_obj_info_max: name #"+i+" does not exist",objNames[i]); - assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length()>0); + assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found + + "] different than expected[" + (GROUPS.length - 1) + "]", + names_found == (GROUPS.length - 1)); + for (int i = 0; i < GROUPS.length - 1; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_max: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length() > 0); } } @Test - public void testH5Gget_obj_info_max_limit() { - long gid = _openGroup(H5fid, GROUPS[0]); - long groups_max_size = GROUPS.length - 3; - String objNames[] = new String[(int)groups_max_size]; - int objTypes[] = new int[(int)groups_max_size]; - int lnkTypes[] = new int[(int)groups_max_size]; + public void testH5Gget_obj_info_max_limit() + { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length - 3; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; H5O_token_t objTokens[] = new H5O_token_t[(int)groups_max_size]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, - objTokens, groups_max_size); + names_found = + H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, objTokens, groups_max_size); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_max_limit: H5.H5Gget_obj_info_max: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } - assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found + "] different than expected[" - + groups_max_size + "]", names_found == groups_max_size); + assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found + + "] different than expected[" + groups_max_size + "]", + names_found == groups_max_size); for (int i = 0; i < objNames.length; i++) { - assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist", objNames[i]); + assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist", + objNames[i]); assertTrue("TestH5G.testH5Gget_obj_info_max_limit: ", objNames[i].length() > 0); } } @Test - public void testH5Gget_obj_info_all_byIndexType() { + public void testH5Gget_obj_info_all_byIndexType() + { H5G_info_t info = null; long gid = _openGroup(H5fid2, GROUPS2[0]); @@ -463,41 +533,44 @@ public class TestH5G { fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_info: " + err); } finally { - try {H5.H5Gclose(gid);} catch (Exception ex) { } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } assertNotNull("TestH5G.testH5Gget_obj_info_all_byIndexType: ", info); assertTrue("TestH5G.testH5Gget_obj_info_all_byIndexType: number of links is empty", info.nlinks > 0); - String objNames[] = new String[(int) info.nlinks]; - int objTypes[] = new int[(int) info.nlinks]; - int lnkTypes[] = new int[(int) info.nlinks]; - H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; + String objNames[] = new String[(int)info.nlinks]; + int objTypes[] = new int[(int)info.nlinks]; + int lnkTypes[] = new int[(int)info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks]; try { - H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_CRT_ORDER); + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_CRT_ORDER); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); } - assertEquals("G12",objNames[1]); - assertEquals("G13", objNames[2] ); - assertEquals("G11", objNames[3] ); + assertEquals("G12", objNames[1]); + assertEquals("G13", objNames[2]); + assertEquals("G11", objNames[3]); try { - H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, - objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); } - assertEquals("G12",objNames[1]); - assertEquals("G13", objNames[2] ); - assertEquals("G14", objNames[3] ); + assertEquals("G12", objNames[1]); + assertEquals("G13", objNames[2]); + assertEquals("G14", objNames[3]); } - } diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java index 6e2e450..8ec04dd 100644 --- a/java/test/TestH5Gbasic.java +++ b/java/test/TestH5Gbasic.java @@ -30,15 +30,17 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Gbasic { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testGb.h5"; - long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -48,64 +50,81 @@ public class TestH5Gbasic { return gid; } - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } _deleteFile(H5_FILE); System.out.println(); } - @Test//(expected = HDF5LibraryException.class) - public void testH5Gclose_invalid() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Gclose_invalid() throws Throwable + { long gid = H5.H5Gclose(-1); assertTrue(gid == 0); } @Test(expected = NullPointerException.class) - public void testH5Gcreate_null() throws Throwable { + public void testH5Gcreate_null() throws Throwable + { long gid = HDF5Constants.H5I_INVALID_HID; // it should fail because the group name is null - gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Gcreate_invalid() throws Throwable { - H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Gcreate_invalid() throws Throwable + { + H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Gcreate() { + public void testH5Gcreate() + { long gid = HDF5Constants.H5I_INVALID_HID; try { - gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -113,11 +132,16 @@ public class TestH5Gbasic { } assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test - public void testH5Gclose() { + public void testH5Gclose() + { long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); @@ -130,24 +154,28 @@ public class TestH5Gbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Gcreate_exists() throws Throwable { + public void testH5Gcreate_exists() throws Throwable + { long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } // it should failed now because the group already exists in file - gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Gcreate_anon() { + public void testH5Gcreate_anon() + { long gid = HDF5Constants.H5I_INVALID_HID; try { - gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -155,42 +183,61 @@ public class TestH5Gbasic { } assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = NullPointerException.class) - public void testH5Gopen_null() throws Throwable { + public void testH5Gopen_null() throws Throwable + { long gid = HDF5Constants.H5I_INVALID_HID; gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Gopen_invalid() throws Throwable { + public void testH5Gopen_invalid() throws Throwable + { H5.H5Gopen(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Gopen_not_exists() throws Throwable { + public void testH5Gopen_not_exists() throws Throwable + { long gid = HDF5Constants.H5I_INVALID_HID; - gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test - public void testH5Gopen() { + public void testH5Gopen() + { long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } try { - gid = H5.H5Gopen(H5fid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gopen(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -198,16 +245,22 @@ public class TestH5Gbasic { } assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_create_plist_invalid() throws Throwable { + public void testH5Gget_create_plist_invalid() throws Throwable + { H5.H5Gget_create_plist(-1); } @Test - public void testH5Gget_create_plist() { + public void testH5Gget_create_plist() + { long pid = HDF5Constants.H5I_INVALID_HID; long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); @@ -216,126 +269,173 @@ public class TestH5Gbasic { pid = H5.H5Gget_create_plist(gid); } catch (Throwable err) { - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } err.printStackTrace(); fail("H5.H5Gget_create_plist: " + err); } assertTrue(pid > 0); - try {H5.H5Pclose(pid);} catch (Exception ex) {} + try { + H5.H5Pclose(pid); + } + catch (Exception ex) { + } - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_info_invalid() throws Throwable { + public void testH5Gget_info_invalid() throws Throwable + { H5.H5Gget_info(-1); } @Test - public void testH5Gget_info() { + public void testH5Gget_info() + { H5G_info_t info = null; - long gid = _createGroup(H5fid, "/testH5Gcreate"); + long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); try { info = H5.H5Gget_info(gid); } catch (Throwable err) { - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } err.printStackTrace(); fail("H5.H5Gget_info: " + err); } assertNotNull(info); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = NullPointerException.class) - public void testH5Gget_info_by_name_null() throws Throwable { + public void testH5Gget_info_by_name_null() throws Throwable + { H5.H5Gget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_info_by_name_invalid() throws Throwable { + public void testH5Gget_info_by_name_invalid() throws Throwable + { H5.H5Gget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_info_by_name_not_exists() throws Throwable { - H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT); + public void testH5Gget_info_by_name_not_exists() throws Throwable + { + H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Gget_info_by_name() { + public void testH5Gget_info_by_name() + { H5G_info_t info = null; - long gid = _createGroup(H5fid, "/testH5Gcreate"); + long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); try { - info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } err.printStackTrace(); fail("H5.H5Gget_info_by_name: " + err); } assertNotNull(info); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test - public void testH5Gget_info_by_name_fileid() { + public void testH5Gget_info_by_name_fileid() + { H5G_info_t info = null; - long gid = _createGroup(H5fid, "/testH5Gcreate"); + long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } try { - info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", - HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } err.printStackTrace(); fail("H5.H5Gget_info_by_name: " + err); } assertNotNull(info); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test(expected = NullPointerException.class) - public void testH5Gget_info_by_idx_null() throws Throwable { - H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME, - HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + public void testH5Gget_info_by_idx_null() throws Throwable + { + H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_info_by_idx_invalid() throws Throwable { - H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, - HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + public void testH5Gget_info_by_idx_invalid() throws Throwable + { + H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + 1L, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Gget_info_by_idx_not_exists() throws Throwable { - H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate", - HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L, - HDF5Constants.H5P_DEFAULT); + public void testH5Gget_info_by_idx_not_exists() throws Throwable + { + H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + 1L, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Gget_info_by_idx() { + public void testH5Gget_info_by_idx() + { H5G_info_t info = null; - long gid = _createGroup(H5fid, "/testH5Gcreate"); + long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); try { - info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME, - HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -343,20 +443,28 @@ public class TestH5Gbasic { } assertNotNull(info); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } } @Test - public void testH5Gget_info_by_idx_fileid() { + public void testH5Gget_info_by_idx_fileid() + { H5G_info_t info = null; - long gid = _createGroup(H5fid, "/testH5Gcreate"); + long gid = _createGroup(H5fid, "/testH5Gcreate"); assertTrue(gid > 0); - try {H5.H5Gclose(gid);} catch (Exception ex) {} + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } try { - info = H5.H5Gget_info_by_idx(H5fid, "/", - HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, - HDF5Constants.H5P_DEFAULT); + info = H5.H5Gget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -366,13 +474,14 @@ public class TestH5Gbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Gflush_invalid() throws Throwable { + public void testH5Gflush_invalid() throws Throwable + { H5.H5Gflush(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Grefresh_invalid() throws Throwable { + public void testH5Grefresh_invalid() throws Throwable + { H5.H5Grefresh(-1); } - } diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java index 388d2ac..eb4b5bf 100644 --- a/java/test/TestH5Giterate.java +++ b/java/test/TestH5Giterate.java @@ -15,6 +15,7 @@ package test; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -28,11 +29,13 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Giterate { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterate.hdf"; - long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; - private final long _openGroup(long fid, String name) { + private final long _openGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); @@ -47,14 +50,13 @@ public class TestH5Giterate { } @Before - public void openH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void openH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, - HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -63,15 +65,21 @@ public class TestH5Giterate { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } System.out.println(); } @Test - public void testH5Gget_obj_info_all() { + public void testH5Gget_obj_info_all() + { H5G_info_t info = null; long gid = _openGroup(H5fid, "/"); @@ -90,45 +98,46 @@ public class TestH5Giterate { } assertNotNull(info); assertTrue("number of links is empty", info.nlinks > 0); - String objNames[] = new String[(int) info.nlinks]; - int objTypes[] = new int[(int) info.nlinks]; - int lnkTypes[] = new int[(int) info.nlinks]; - H5O_token_t objTokens[] = new H5O_token_t[(int) info.nlinks]; + String objNames[] = new String[(int)info.nlinks]; + int objTypes[] = new int[(int)info.nlinks]; + int lnkTypes[] = new int[(int)info.nlinks]; + H5O_token_t objTokens[] = new H5O_token_t[(int)info.nlinks]; int names_found = 0; try { - names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, - objTypes, lnkTypes, objTokens, HDF5Constants.H5_INDEX_NAME); + names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, objTypes, lnkTypes, objTokens, + HDF5Constants.H5_INDEX_NAME); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gget_obj_info_all: " + err); } - assertTrue("number found[" + names_found + "] different than expected[" - + objNames.length + "]", names_found == objNames.length); + assertTrue("number found[" + names_found + "] different than expected[" + objNames.length + "]", + names_found == objNames.length); for (int i = 0; i < objNames.length; i++) { assertNotNull("name #" + i + " does not exist", objNames[i]); assertTrue(objNames[i].length() > 0); - if (objTypes[i]==HDF5Constants.H5O_TYPE_GROUP) { - assertTrue("Group is index: "+i + " ",i==2); - assertTrue("Group is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("G1")==0); + if (objTypes[i] == HDF5Constants.H5O_TYPE_GROUP) { + assertTrue("Group is index: " + i + " ", i == 2); + assertTrue("Group is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("G1") == 0); } - else if (objTypes[i]==HDF5Constants.H5O_TYPE_DATASET) { - assertTrue("Dataset is index: "+i + " ",(i==0)||(i==3)); - if(i==0) - assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DS1")==0); + else if (objTypes[i] == HDF5Constants.H5O_TYPE_DATASET) { + assertTrue("Dataset is index: " + i + " ", (i == 0) || (i == 3)); + if (i == 0) + assertTrue("Dataset is : " + objNames[i] + " ", + objNames[i].compareToIgnoreCase("DS1") == 0); else - assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("L1")==0); + assertTrue("Dataset is : " + objNames[i] + " ", + objNames[i].compareToIgnoreCase("L1") == 0); } - else if (objTypes[i]==HDF5Constants.H5O_TYPE_NAMED_DATATYPE) { - assertTrue("Datatype is index: "+i + " ",i==1); - assertTrue("Datatype is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DT1")==0); + else if (objTypes[i] == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) { + assertTrue("Datatype is index: " + i + " ", i == 1); + assertTrue("Datatype is : " + objNames[i] + " ", objNames[i].compareToIgnoreCase("DT1") == 0); } else { fail(" Unknown at index: " + i + " " + objNames[i]); } } } - } diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java index a28fc3d..c81545b 100644 --- a/java/test/TestH5Lbasic.java +++ b/java/test/TestH5Lbasic.java @@ -20,8 +20,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -32,19 +32,19 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Lbasic { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateL1.hdf"; - long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before - public void openH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void openH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, - HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -53,15 +53,21 @@ public class TestH5Lbasic { } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } System.out.println(); } @Test - public void testH5Lexists() { + public void testH5Lexists() + { boolean link_exists = false; try { link_exists = H5.H5Lexists(H5fid, "None", HDF5Constants.H5P_DEFAULT); @@ -70,7 +76,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lexists: " + err); } - assertFalse("H5Lexists ",link_exists); + assertFalse("H5Lexists ", link_exists); try { link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); } @@ -78,7 +84,7 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lexists: " + err); } - assertTrue("H5Lexists ",link_exists); + assertTrue("H5Lexists ", link_exists); try { link_exists = H5.H5Lexists(H5fid, "G1/DS2", HDF5Constants.H5P_DEFAULT); } @@ -86,16 +92,18 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lexists: " + err); } - assertTrue("H5Lexists ",link_exists); + assertTrue("H5Lexists ", link_exists); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_not_exist() throws Throwable { + public void testH5Lget_info_not_exist() throws Throwable + { H5.H5Lget_info(H5fid, "None", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lget_info_dataset() { + public void testH5Lget_info_dataset() + { H5L_info_t link_info = null; try { link_info = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -104,12 +112,13 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info ",link_info==null); - assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info ", link_info == null); + assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); } @Test - public void testH5Lget_info_hardlink() { + public void testH5Lget_info_hardlink() + { H5L_info_t link_info = null; try { link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -118,43 +127,53 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info",link_info==null); - assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info", link_info == null); + assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable { - H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable + { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable { - H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable + { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_by_idx_not_exist_name() throws Throwable { - H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_info_by_idx_not_exist_name() throws Throwable + { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_by_idx_not_exist_create() throws Throwable { - H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_info_by_idx_not_exist_create() throws Throwable + { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lget_info_by_idx_n0() { - H5L_info_t link_info = null; + public void testH5Lget_info_by_idx_n0() + { + H5L_info_t link_info = null; H5L_info_t link_info2 = null; try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx",link_info==null); - assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info_by_idx", link_info == null); + assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); } @@ -166,18 +185,20 @@ public class TestH5Lbasic { } @Test - public void testH5Lget_info_by_idx_n3() { - H5L_info_t link_info = null; + public void testH5Lget_info_by_idx_n3() + { + H5L_info_t link_info = null; H5L_info_t link_info2 = null; try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx",link_info==null); - assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info_by_idx", link_info == null); + assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); try { link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); } @@ -189,44 +210,52 @@ public class TestH5Lbasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_name_by_idx_not_exist() throws Throwable { - H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_name_by_idx_not_exist() throws Throwable + { + H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lget_name_by_idx_n0() { + public void testH5Lget_name_by_idx_n0() + { String link_name = null; try { - link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_name_by_idx: " + err); } - assertFalse("H5Lget_name_by_idx ",link_name==null); - assertTrue("Link Name ",link_name.compareTo("DS1")==0); + assertFalse("H5Lget_name_by_idx ", link_name == null); + assertTrue("Link Name ", link_name.compareTo("DS1") == 0); } @Test - public void testH5Lget_name_by_idx_n3() { + public void testH5Lget_name_by_idx_n3() + { String link_name = null; try { - link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_name_by_idx: " + err); } - assertFalse("H5Lget_name_by_idx ",link_name==null); - assertTrue("Link Name ",link_name.compareTo("L1")==0); + assertFalse("H5Lget_name_by_idx ", link_name == null); + assertTrue("Link Name ", link_name.compareTo("L1") == 0); } @Test - public void testH5Lvisit() { + public void testH5Lvisit() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -236,7 +265,8 @@ public class TestH5Lbasic { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -250,21 +280,29 @@ public class TestH5Lbasic { err.printStackTrace(); fail("H5.H5Lvisit: " + err); } - assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); - assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); - assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(3)).link_name,(((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); - assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(4)).link_name,(((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1")==0); + assertFalse("H5Lvisit ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 5); + assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == 0); + assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1") == 0); + assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(2)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") == 0); + assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(3)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2") == 0); + assertTrue("H5Lvisit " + (((H5L_iter_data)iter_data).iterdata.get(4)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1") == 0); } @Test - public void testH5Lvisit_by_name() { + public void testH5Lvisit_by_name() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -274,7 +312,8 @@ public class TestH5Lbasic { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -282,23 +321,28 @@ public class TestH5Lbasic { } H5L_iterate_t iter_cb = new H5L_iter_callback(); try { - H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, + iter_data, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lvisit_by_name: " + err); } - assertFalse("H5Lvisit_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Lvisit_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); - assertTrue("H5Lvisit_by_name "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + assertFalse("H5Lvisit_by_name ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit_by_name " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 1); + assertTrue("H5Lvisit_by_name " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2") == 0); } @Test - public void testH5Literate() { + public void testH5Literate() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -308,7 +352,8 @@ public class TestH5Lbasic { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -316,26 +361,35 @@ public class TestH5Lbasic { } H5L_iterate_t iter_cb = new H5L_iter_callback(); try { - H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, + iter_data); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Literate: " + err); } - assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==4); - assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1")==0); + assertFalse("H5Literate ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 4); + assertTrue("H5Literate " + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == 0); + assertTrue("H5Literate " + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1") == 0); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name, + (((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") == 0); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1") == + 0); } @Test - public void testH5Literate_by_name() { + public void testH5Literate_by_name() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -345,7 +399,8 @@ public class TestH5Lbasic { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -353,15 +408,18 @@ public class TestH5Lbasic { } H5L_iterate_t iter_cb = new H5L_iter_callback(); try { - H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, + iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Literate_by_name: " + err); } - assertFalse("H5Literate_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Literate_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); - assertTrue("H5Literate_by_name "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + assertFalse("H5Literate_by_name ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate_by_name " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 1); + assertTrue("H5Literate_by_name " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2") == + 0); } - } diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java index 44af2e5..822323e 100644 --- a/java/test/TestH5Lcreate.java +++ b/java/test/TestH5Lcreate.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.callbacks.H5L_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5L_iterate_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5L_info_t; @@ -35,21 +35,23 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Lcreate { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_EXTFILE = "h5ex_g_iterateL2.hdf"; - private static final String H5_FILE = "testL.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - 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) { + private static final String H5_FILE = "testL.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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) + { File file = new File(filename); if (file.exists()) { @@ -62,39 +64,41 @@ public class TestH5Lcreate { } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5L._createDataset: ",did > 0); + assertTrue("TestH5L._createDataset: ", did > 0); return did; } - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - H5gcpl, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } - assertTrue("TestH5L._createGroup: ",gid > 0); + assertTrue("TestH5L._createGroup: ", gid > 0); return gid; } - private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, + long lcpl, long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); @@ -108,7 +112,9 @@ public class TestH5Lcreate { assertTrue("TestH5L._createHardLink ", link_exists); } - private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, + long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); @@ -122,7 +128,9 @@ public class TestH5Lcreate { assertTrue("TestH5L._createSoftLink ", link_exists); } - private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, + String dstname, long lcpl, long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); @@ -137,111 +145,149 @@ public class TestH5Lcreate { } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); - H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - H5fcpl, HDF5Constants.H5P_DEFAULT); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, H5fcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("TestH5L.createH5file: " + err); } - assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5L.createH5file: H5.H5Fcreate: ", H5fid > 0); try { H5dsid = H5.H5Screate_simple(2, H5dims, null); H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); - H5gid = _createGroup(H5fid, "/G1"); + H5gid = _createGroup(H5fid, "/G1"); H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("TestH5L.createH5objs: " + err); } - assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ",H5dsid > 0); - assertTrue("TestH5L.createH5file: H5.H5Gcreate: ",H5gid > 0); + assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5L.createH5file: H5.H5Gcreate: ", H5gid > 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5gid > 0) - try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + try { + H5.H5Gclose(H5gid); + } + catch (Exception ex) { + } if (H5gcpl > 0) - try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5gcpl); + } + catch (Exception ex) { + } if (H5did2 > 0) - try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did2); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did1 > 0) - try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did1); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } if (H5fcpl > 0) - try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5fcpl); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); } @Test - public void testH5Lget_info_by_idx_n0_create() { + public void testH5Lget_info_by_idx_n0_create() + { H5L_info_t link_info = null; try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx_n0_create:H5Pget_link_creation_order " + err); } try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ", link_info==null); - assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info_by_idx ", link_info == null); + assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); } @Test - public void testH5Lget_info_by_idx_n1_create() { + public void testH5Lget_info_by_idx_n1_create() + { H5L_info_t link_info = null; try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx_n1_create:H5Pget_link_creation_order " + err); } try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("H5Lget_info_by_idx ", link_info==null); - assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertFalse("H5Lget_info_by_idx ", link_info == null); + assertTrue("H5Lget_info_by_idx link type", link_info.type == HDF5Constants.H5L_TYPE_HARD); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_hard_cur_not_exists() throws Throwable { + public void testH5Lcreate_hard_cur_not_exists() throws Throwable + { H5.H5Lcreate_hard(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lcreate_hard() { + public void testH5Lcreate_hard() + { try { - H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); assertTrue("testH5Lcreate_hard:H5Lexists ", link_exists); @@ -253,14 +299,19 @@ public class TestH5Lcreate { } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_hard_dst_link_exists() throws Throwable { - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Lcreate_hard_dst_link_exists() throws Throwable + { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Ldelete_hard_link() { - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Ldelete_hard_link() + { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -274,7 +325,8 @@ public class TestH5Lcreate { } @Test - public void testH5Lcreate_soft() { + public void testH5Lcreate_soft() + { try { H5.H5Lcreate_soft("DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -288,13 +340,15 @@ public class TestH5Lcreate { } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_soft_dst_link_exists() throws Throwable { + public void testH5Lcreate_soft_dst_link_exists() throws Throwable + { _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Lcreate_soft("L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Ldelete_soft_link() { + public void testH5Ldelete_soft_link() + { _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -309,7 +363,8 @@ public class TestH5Lcreate { } @Test - public void testH5Lget_info_softlink() { + public void testH5Lget_info_softlink() + { H5L_info_t link_info = null; _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { @@ -319,15 +374,16 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info", link_info==null); - assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_info", link_info == null); + assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); assertTrue("Link Value Size", link_info.val_size > 0); } @Test - public void testH5Lget_value_soft() { + public void testH5Lget_value_soft() + { String[] link_value = {null, null}; - int link_type = -1; + int link_type = -1; _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { @@ -338,12 +394,13 @@ public class TestH5Lcreate { fail("H5.H5Lget_value: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); - assertFalse("H5Lget_value ", link_value[0]==null); - assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2")==0); + assertFalse("H5Lget_value ", link_value[0] == null); + assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2") == 0); } @Test - public void testH5Lcreate_soft_dangle() { + public void testH5Lcreate_soft_dangle() + { try { H5.H5Lcreate_soft("DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -357,7 +414,8 @@ public class TestH5Lcreate { } @Test - public void testH5Ldelete_soft_link_dangle() { + public void testH5Ldelete_soft_link_dangle() + { _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { H5.H5Ldelete(H5fid, "L2", HDF5Constants.H5P_DEFAULT); @@ -372,7 +430,8 @@ public class TestH5Lcreate { } @Test - public void testH5Lget_info_softlink_dangle() { + public void testH5Lget_info_softlink_dangle() + { H5L_info_t link_info = null; _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { @@ -382,15 +441,16 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info", link_info==null); - assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_info", link_info == null); + assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); assertTrue("Link Value Size", link_info.val_size > 0); } @Test - public void testH5Lget_value_dangle() { - String[] link_value = {null,null}; - int link_type = -1; + public void testH5Lget_value_dangle() + { + String[] link_value = {null, null}; + int link_type = -1; _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { @@ -401,14 +461,16 @@ public class TestH5Lcreate { fail("H5.H5Lget_value: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); - assertFalse("H5Lget_value ", link_value[0]==null); - assertTrue("Link Value ", link_value[0].compareTo("DS3")==0); + assertFalse("H5Lget_value ", link_value[0] == null); + assertTrue("Link Value ", link_value[0].compareTo("DS3") == 0); } @Test - public void testH5Lcreate_external() { + public void testH5Lcreate_external() + { try { - H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); assertTrue("testH5Lcreate_external:H5Lexists ", link_exists); @@ -420,9 +482,11 @@ public class TestH5Lcreate { } @Test - public void testH5Lget_info_externallink() { + public void testH5Lget_info_externallink() + { H5L_info_t link_info = null; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); } @@ -430,17 +494,19 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Lget_info: " + err); } - assertFalse("H5Lget_info", link_info==null); - assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("H5Lget_info", link_info == null); + assertTrue("H5Lget_info link type", link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL); assertTrue("Link Value Size", link_info.val_size > 0); } @Test - public void testH5Lget_value_external(){ - String[] link_value = {null,null}; - int link_type = -1; + public void testH5Lget_value_external() + { + String[] link_value = {null, null}; + int link_type = -1; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT); } @@ -449,18 +515,20 @@ public class TestH5Lcreate { fail("H5.H5Lget_value: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); - assertFalse("H5Lget_value ", link_value[0]==null); - assertFalse("H5Lget_value ", link_value[1]==null); - assertTrue("Link Value ", link_value[0].compareTo("DT1")==0); + assertFalse("H5Lget_value ", link_value[0] == null); + assertFalse("H5Lget_value ", link_value[1] == null); + assertTrue("Link Value ", link_value[0].compareTo("DT1") == 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcopy_cur_not_exists() throws Throwable { + public void testH5Lcopy_cur_not_exists() throws Throwable + { H5.H5Lcopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lcopy() { + public void testH5Lcopy() + { try { H5.H5Lcopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -474,18 +542,22 @@ public class TestH5Lcreate { } @Test(expected = HDF5LibraryException.class) - public void testH5Lcopy_dst_link_exists() throws Throwable { - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Lcopy_dst_link_exists() throws Throwable + { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Lcopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lmove_cur_not_exists() throws Throwable { + public void testH5Lmove_cur_not_exists() throws Throwable + { H5.H5Lmove(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lmove() { + public void testH5Lmove() + { try { H5.H5Lmove(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -501,60 +573,72 @@ public class TestH5Lcreate { } @Test(expected = HDF5LibraryException.class) - public void testH5Lmove_dst_link_exists() throws Throwable { - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Lmove_dst_link_exists() throws Throwable + { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Lmove(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_value_by_idx_not_exist_name() throws Throwable { - String[] link_value = {null,null}; - H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_value_by_idx_not_exist_name() throws Throwable + { + String[] link_value = {null, null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + link_value, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_value_by_idx_not_exist_create() throws Throwable { - String[] link_value = {null,null}; - H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + public void testH5Lget_value_by_idx_not_exist_create() throws Throwable + { + String[] link_value = {null, null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + link_value, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Lget_value_by_idx_n2_name() { + public void testH5Lget_value_by_idx_n2_name() + { H5L_info_t link_info = null; - String[] link_value = {null,null}; - int link_type = -1; + String[] link_value = {null, null}; + int link_type = -1; _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Lget_value_by_idx_n2 ",link_info==null); - assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_info == null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); try { - link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + link_type = + H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, + link_value, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_value_by_idx: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); - assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); - assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0] == null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2") == 0); } @Test - public void testH5Lget_value_by_idx_n2_create() { + public void testH5Lget_value_by_idx_n2_create() + { H5L_info_t link_info = null; - String[] link_value = {null,null}; - int link_type = -1; + String[] link_value = {null, null}; + int link_type = -1; try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); @@ -562,116 +646,139 @@ public class TestH5Lcreate { } _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Lget_value_by_idx_n2 ", link_info==null); - assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_info == null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); try { - link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + link_type = + H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_value_by_idx: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); - assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); - assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0] == null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2") == 0); } @Test - public void testH5Lget_value_by_idx_external_name() { + public void testH5Lget_value_by_idx_external_name() + { H5L_info_t link_info = null; - String[] link_value = {null,null}; - int link_type = -1; + String[] link_value = {null, null}; + int link_type = -1; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); - assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_info == null); + assertTrue("testH5Lget_value_by_idx_ext link type " + link_info.type, + link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL); try { - link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + link_type = + H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, + link_value, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_value_by_idx: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); - assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); - assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); - assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0] == null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1] == null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1") == 0); } @Test - public void testH5Lget_value_by_idx_external_create() { + public void testH5Lget_value_by_idx_external_create() + { H5L_info_t link_info = null; - String[] link_value = {null,null}; - int link_type = -1; + String[] link_value = {null, null}; + int link_type = -1; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); - assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_info == null); + assertTrue("testH5Lget_value_by_idx_ext link type " + link_info.type, + link_info.type == HDF5Constants.H5L_TYPE_EXTERNAL); try { - link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + link_type = + H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_value_by_idx: " + err); } assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); - assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); - assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); - assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0] == null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1] == null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1") == 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Ldelete_by_idx_not_exist_name() throws Throwable { - H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Ldelete_by_idx_not_exist_name() throws Throwable + { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Ldelete_by_idx_not_exist_create() throws Throwable { - H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Ldelete_by_idx_not_exist_create() throws Throwable + { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Ldelete_by_idx_n2_name() { + public void testH5Ldelete_by_idx_n2_name() + { H5L_info_t link_info = null; _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); - assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Ldelete_by_idx_n2 ", link_info == null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); try { - H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Ldelete_by_idx: " + err); } try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException err) { link_info = null; @@ -680,31 +787,35 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Ldelete_by_idx: " + err); } - assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 ", link_info == null); } @Test - public void testH5Ldelete_by_idx_n2_create() { + public void testH5Ldelete_by_idx_n2_create() + { H5L_info_t link_info = null; _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lget_info_by_idx: " + err); } - assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); - assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Ldelete_by_idx_n2 ", link_info == null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type == HDF5Constants.H5L_TYPE_SOFT); try { - H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Ldelete_by_idx: " + err); } try { - link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); } catch (HDF5LibraryException err) { link_info = null; @@ -713,28 +824,33 @@ public class TestH5Lcreate { err.printStackTrace(); fail("H5.H5Ldelete_by_idx: " + err); } - assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 ", link_info == null); } @Test - public void testH5Lvisit_create() { + public void testH5Lvisit_create() + { try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lvisit_create: H5Pget_link_creation_order " + err); } - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -744,7 +860,8 @@ public class TestH5Lcreate { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -752,41 +869,60 @@ public class TestH5Lcreate { } H5L_iterate_t iter_cb = new H5L_iter_callback(); try { - H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, + iter_data); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Lvisit: " + err); } - assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==6); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2")==0); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1")==0); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE")==0); - assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS")==0); + assertFalse("H5Lvisit ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 6); + assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == + 0); + assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1") == + 0); + assertTrue( + "H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2") == 0); + assertTrue( + "H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1") == 0); + assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE") == + 0); + assertTrue("H5Lvisit " + ((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS") == + 0); } @Test - public void testH5Literate_create() { + public void testH5Literate_create() + { try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Literate_create: H5Pget_link_creation_order " + err); } - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -796,7 +932,8 @@ public class TestH5Lcreate { } H5L_iterate_opdata_t iter_data = new H5L_iter_data(); class H5L_iter_callback implements H5L_iterate_t { - public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5L_iter_data)op_data).iterdata.add(id); return 0; @@ -804,19 +941,30 @@ public class TestH5Lcreate { } H5L_iterate_t iter_cb = new H5L_iter_callback(); try { - H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data); + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, + iter_data); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Literate: " + err); } - assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE")==0); - assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS")==0); + assertFalse("H5Literate ", ((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate " + ((H5L_iter_data)iter_data).iterdata.size(), + ((H5L_iter_data)iter_data).iterdata.size() == 5); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1") == + 0); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1") == + 0); + assertTrue( + "H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1") == 0); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE") == + 0); + assertTrue("H5Literate " + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name, + ((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS") == + 0); } - } diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java index 30ee242..78de663 100644 --- a/java/test/TestH5Lparams.java +++ b/java/test/TestH5Lparams.java @@ -13,6 +13,7 @@ package test; import static org.junit.Assert.assertTrue; + import hdf.hdf5lib.H5; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -23,206 +24,246 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Lparams { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_value_invalid() throws Throwable { + public void testH5Lget_value_invalid() throws Throwable + { H5.H5Lget_value(-1, "Bogus", null, -1); } @Test(expected = NullPointerException.class) - public void testH5Lget_value_null() throws Throwable { + public void testH5Lget_value_null() throws Throwable + { H5.H5Lget_value(-1, null, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lexists_invalid() throws Throwable { + public void testH5Lexists_invalid() throws Throwable + { H5.H5Lexists(-1, "Bogus", -1); } @Test(expected = NullPointerException.class) - public void testH5Lexists_null() throws Throwable { + public void testH5Lexists_null() throws Throwable + { H5.H5Lexists(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_invalid() throws Throwable { + public void testH5Lget_info_invalid() throws Throwable + { H5.H5Lget_info(-1, "Bogus", -1); } @Test(expected = NullPointerException.class) - public void testH5Lget_info_null() throws Throwable { + public void testH5Lget_info_null() throws Throwable + { H5.H5Lget_info(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_info_by_idx_invalid() throws Throwable { + public void testH5Lget_info_by_idx_invalid() throws Throwable + { H5.H5Lget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); } @Test(expected = NullPointerException.class) - public void testH5Lget_info_by_idx_null() throws Throwable { + public void testH5Lget_info_by_idx_null() throws Throwable + { H5.H5Lget_info_by_idx(-1, null, 0, 0, 0L, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_name_by_idx_invalid() throws Throwable { + public void testH5Lget_name_by_idx_invalid() throws Throwable + { H5.H5Lget_name_by_idx(-1, "Bogus", -1, -1, -1L, -1); } @Test(expected = NullPointerException.class) - public void testH5Lget_name_by_idx_null() throws Throwable { + public void testH5Lget_name_by_idx_null() throws Throwable + { H5.H5Lget_name_by_idx(-1, null, 0, 0, 0L, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_hard_invalid() throws Throwable { + public void testH5Lcreate_hard_invalid() throws Throwable + { H5.H5Lcreate_hard(-1, "Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_hard_null_current() throws Throwable { + public void testH5Lcreate_hard_null_current() throws Throwable + { H5.H5Lcreate_hard(-1, null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_hard_null_dest() throws Throwable { + public void testH5Lcreate_hard_null_dest() throws Throwable + { H5.H5Lcreate_hard(-1, "Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Ldelete_invalid() throws Throwable { + public void testH5Ldelete_invalid() throws Throwable + { H5.H5Ldelete(-1, "Bogus", -1); } @Test(expected = NullPointerException.class) - public void testH5Ldelete_null() throws Throwable { + public void testH5Ldelete_null() throws Throwable + { H5.H5Ldelete(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_soft_invalid() throws Throwable { - H5.H5Lcreate_soft( "Bogus", -1, "Bogus", -1, -1); + public void testH5Lcreate_soft_invalid() throws Throwable + { + H5.H5Lcreate_soft("Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_soft_null_current() throws Throwable { + public void testH5Lcreate_soft_null_current() throws Throwable + { H5.H5Lcreate_soft(null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_soft_null_dest() throws Throwable { + public void testH5Lcreate_soft_null_dest() throws Throwable + { H5.H5Lcreate_soft("Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcreate_external_invalid() throws Throwable { + public void testH5Lcreate_external_invalid() throws Throwable + { H5.H5Lcreate_external("PathToFile", "Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_external_null_file() throws Throwable { + public void testH5Lcreate_external_null_file() throws Throwable + { H5.H5Lcreate_external(null, "Bogus", 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_external_null_current() throws Throwable { + public void testH5Lcreate_external_null_current() throws Throwable + { H5.H5Lcreate_external("PathToFile", null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lcreate_external_null_dest() throws Throwable { + public void testH5Lcreate_external_null_dest() throws Throwable + { H5.H5Lcreate_external("PathToFile", "Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lcopy_invalid() throws Throwable { + public void testH5Lcopy_invalid() throws Throwable + { H5.H5Lcopy(-1, "Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Lcopy_null_current() throws Throwable { + public void testH5Lcopy_null_current() throws Throwable + { H5.H5Lcopy(-1, null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lcopy_null_dest() throws Throwable { + public void testH5Lcopy_null_dest() throws Throwable + { H5.H5Lcopy(-1, "Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lmove_invalid() throws Throwable { + public void testH5Lmove_invalid() throws Throwable + { H5.H5Lmove(-1, "Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Lmove_null_current() throws Throwable { + public void testH5Lmove_null_current() throws Throwable + { H5.H5Lmove(-1, null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Lmove_null_dest() throws Throwable { + public void testH5Lmove_null_dest() throws Throwable + { H5.H5Lmove(-1, "Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Lget_value_by_idx_invalid() throws Throwable { + public void testH5Lget_value_by_idx_invalid() throws Throwable + { H5.H5Lget_value_by_idx(-1, "Bogus", -1, -1, -1L, null, -1); } @Test(expected = NullPointerException.class) - public void testH5Lget_value_by_idx_null() throws Throwable { + public void testH5Lget_value_by_idx_null() throws Throwable + { H5.H5Lget_value_by_idx(-1, null, 0, 0, 0L, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Ldelete_by_idx_invalid() throws Throwable { + public void testH5Ldelete_by_idx_invalid() throws Throwable + { H5.H5Ldelete_by_idx(-1, "Bogus", -1, -1, -1L, -1); } @Test(expected = NullPointerException.class) - public void testH5Ldelete_by_idx_null() throws Throwable { + public void testH5Ldelete_by_idx_null() throws Throwable + { H5.H5Ldelete_by_idx(-1, null, 0, 0, 0L, 0); } @Test(expected = NullPointerException.class) - public void testH5Lvisit_null() throws Throwable { + public void testH5Lvisit_null() throws Throwable + { H5.H5Lvisit(-1, -1, -1, null, null); } @Test(expected = NullPointerException.class) - public void testH5Lvisit_by_name_nullname() throws Throwable { + public void testH5Lvisit_by_name_nullname() throws Throwable + { H5.H5Lvisit_by_name(-1, null, -1, -1, null, null, -1); } @Test(expected = NullPointerException.class) - public void testH5Lvisit_by_name_null() throws Throwable { + public void testH5Lvisit_by_name_null() throws Throwable + { H5.H5Lvisit_by_name(-1, "Bogus", -1, -1, null, null, -1); } @Test(expected = NullPointerException.class) - public void testH5Literate_null() throws Throwable { + public void testH5Literate_null() throws Throwable + { H5.H5Literate(-1, -1, -1, -1, null, null); } @Test(expected = NullPointerException.class) - public void testH5Literate_by_name_nullname() throws Throwable { + public void testH5Literate_by_name_nullname() throws Throwable + { H5.H5Literate_by_name(-1, null, -1, -1, -1, null, null, -1); } @Test(expected = NullPointerException.class) - public void testH5Literate_by_name_null() throws Throwable { + public void testH5Literate_by_name_null() throws Throwable + { H5.H5Literate_by_name(-1, "Bogus", -1, -1, -1, null, null, -1); } - } diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java index 350b7aa..cac2e6a 100644 --- a/java/test/TestH5Obasic.java +++ b/java/test/TestH5Obasic.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5O_hdr_info_t; import hdf.hdf5lib.structs.H5O_info_t; import hdf.hdf5lib.structs.H5O_native_info_t; import hdf.hdf5lib.structs.H5O_token_t; -import hdf.hdf5lib.structs.H5O_hdr_info_t; import hdf.hdf5lib.structs.H5_ih_info_t; import org.junit.After; @@ -36,21 +36,21 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Obasic { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "h5ex_g_iterateO1.hdf"; private static H5O_token_t H5la_ds1 = null; - private static H5O_token_t H5la_l1 = null; - long H5fid = HDF5Constants.H5I_INVALID_HID; + private static H5O_token_t H5la_l1 = null; + long H5fid = HDF5Constants.H5I_INVALID_HID; @Before - public void openH5file() - throws HDF5LibraryException, NullPointerException { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void openH5file() throws HDF5LibraryException, NullPointerException + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, - HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -59,103 +59,136 @@ public class TestH5Obasic { } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } System.out.println(); } @Test(expected = HDF5LibraryException.class) - public void testH5Oopen_not_exists() throws Throwable { + public void testH5Oopen_not_exists() throws Throwable + { long oid = HDF5Constants.H5I_INVALID_HID; oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_info_dataset() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_dataset() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_info_hardlink() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_hardlink() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_info_group() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_group() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_info_datatype() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_datatype() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_name_not_exist_name() throws Throwable { + public void testH5Oget_info_by_name_not_exist_name() throws Throwable + { H5.H5Oget_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_name_not_exists() throws Throwable { + public void testH5Oget_info_by_name_not_exists() throws Throwable + { H5.H5Oget_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_info_by_name_dataset() { + public void testH5Oget_info_by_name_dataset() + { H5O_info_t obj_info = null; try { @@ -165,12 +198,13 @@ public class TestH5Obasic { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); } @Test - public void testH5Oget_info_by_name_hardlink() { + public void testH5Oget_info_by_name_hardlink() + { H5O_info_t obj_info = null; try { obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); @@ -179,12 +213,13 @@ public class TestH5Obasic { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); } @Test - public void testH5Oget_info_by_name_group() { + public void testH5Oget_info_by_name_group() + { H5O_info_t obj_info = null; try { obj_info = H5.H5Oget_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); @@ -193,12 +228,13 @@ public class TestH5Obasic { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP); } @Test - public void testH5Oget_info_by_name_datatype() { + public void testH5Oget_info_by_name_datatype() + { H5O_info_t obj_info = null; try { obj_info = H5.H5Oget_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); @@ -207,36 +243,45 @@ public class TestH5Obasic { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info ",obj_info==null); - assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable { - H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable + { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable { - H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable + { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_idx_not_exist_name() throws Throwable { - H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_info_by_idx_not_exist_name() throws Throwable + { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_idx_not_exist_create() throws Throwable { - H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_info_by_idx_not_exist_create() throws Throwable + { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, + HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_info_by_idx_n0() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_by_idx_n0() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -244,25 +289,32 @@ public class TestH5Obasic { fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err); } H5la_ds1 = obj_info.token; - try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info_by_idx: " + err); } - assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null); - assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ", obj_info == null); + assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type", + obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("testH5Oget_info_by_idx_n0:Link Object token", obj_info.token.equals(H5la_ds1)); } @Test - public void testH5Oget_info_by_idx_n3() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_info_by_idx_n3() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { - oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -270,26 +322,33 @@ public class TestH5Obasic { fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err); } H5la_l1 = obj_info.token; - try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info_by_idx: " + err); } - assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); - assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ", obj_info == null); + assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type", + obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("testH5Oget_info_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); } @Test - public void testH5Oget_native_info_dataset() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_dataset() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -300,16 +359,21 @@ public class TestH5Obasic { assertFalse("H5Oget_native_info ", native_info.hdr_info == null); assertFalse("H5Oget_native_info ", native_info.obj_info == null); assertFalse("H5Oget_native_info ", native_info.attr_info == null); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_native_info_hardlink() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_hardlink() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { - oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -320,16 +384,21 @@ public class TestH5Obasic { assertFalse("H5Oget_native_info ", native_info.hdr_info == null); assertFalse("H5Oget_native_info ", native_info.obj_info == null); assertFalse("H5Oget_native_info ", native_info.attr_info == null); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_native_info_group() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_group() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { - oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -340,16 +409,21 @@ public class TestH5Obasic { assertFalse("H5Oget_native_info ", native_info.hdr_info == null); assertFalse("H5Oget_native_info ", native_info.obj_info == null); assertFalse("H5Oget_native_info ", native_info.attr_info == null); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test - public void testH5Oget_native_info_datatype() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_datatype() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; try { - oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -360,21 +434,28 @@ public class TestH5Obasic { assertFalse("H5Oget_native_info ", native_info.hdr_info == null); assertFalse("H5Oget_native_info ", native_info.obj_info == null); assertFalse("H5Oget_native_info ", native_info.attr_info == null); - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable { + public void testH5Oget_native_info_by_name_not_exist_name() throws Throwable + { H5.H5Oget_native_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_name_not_exists() throws Throwable { + public void testH5Oget_native_info_by_name_not_exists() throws Throwable + { H5.H5Oget_native_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_native_info_by_name_dataset() { + public void testH5Oget_native_info_by_name_dataset() + { H5O_native_info_t native_info = null; try { @@ -391,7 +472,8 @@ public class TestH5Obasic { } @Test - public void testH5Oget_native_info_by_name_hardlink() { + public void testH5Oget_native_info_by_name_hardlink() + { H5O_native_info_t native_info = null; try { @@ -408,7 +490,8 @@ public class TestH5Obasic { } @Test - public void testH5Oget_native_info_by_name_group() { + public void testH5Oget_native_info_by_name_group() + { H5O_native_info_t native_info = null; try { @@ -425,7 +508,8 @@ public class TestH5Obasic { } @Test - public void testH5Oget_native_info_by_name_datatype() { + public void testH5Oget_native_info_by_name_datatype() + { H5O_native_info_t native_info = null; try { @@ -442,35 +526,44 @@ public class TestH5Obasic { } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable { - H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_native_info_by_idx_name_not_exist_name() throws Throwable + { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable { - H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_native_info_by_idx_name_not_exist_create() throws Throwable + { + H5.H5Oget_native_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable { - H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_native_info_by_idx_not_exist_name() throws Throwable + { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, + HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable { - H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + public void testH5Oget_native_info_by_idx_not_exist_create() throws Throwable + { + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, + 5, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_native_info_by_idx_n0() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_by_idx_n0() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; H5_ih_info_t ainfo; try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -478,14 +571,20 @@ public class TestH5Obasic { fail("testH5Oget_native_info_by_idx_n0:H5.H5Oget_native_info: " + err); } - ohdr = native_info.hdr_info; + ohdr = native_info.hdr_info; oinfo = native_info.obj_info; ainfo = native_info.attr_info; - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } try { - native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + native_info = + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -501,15 +600,16 @@ public class TestH5Obasic { } @Test - public void testH5Oget_native_info_by_idx_n3() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oget_native_info_by_idx_n3() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_native_info_t native_info = null; H5O_hdr_info_t ohdr; H5_ih_info_t oinfo; H5_ih_info_t ainfo; try { - oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); native_info = H5.H5Oget_native_info(oid); } catch (Throwable err) { @@ -517,14 +617,20 @@ public class TestH5Obasic { fail("testH5Oget_native_info_by_idx_n3:H5.H5Oget_native_info: " + err); } - ohdr = native_info.hdr_info; + ohdr = native_info.hdr_info; oinfo = native_info.obj_info; ainfo = native_info.attr_info; - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } try { - native_info = H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + native_info = + H5.H5Oget_native_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -540,11 +646,13 @@ public class TestH5Obasic { } @Test - public void testH5Ovisit() { + public void testH5Ovisit() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -554,7 +662,8 @@ public class TestH5Obasic { } H5O_iterate_opdata_t iter_data = new H5O_iter_data(); class H5O_iter_callback implements H5O_iterate_t { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; @@ -568,22 +677,31 @@ public class TestH5Obasic { err.printStackTrace(); fail("H5.H5Ovisit: " + err); } - assertFalse("H5Ovisit ",((H5O_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==5); - assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); - assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(2)).link_name,(((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1")==0); - assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(3)).link_name,(((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(4)).link_name,(((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2")==0); -// assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0); + assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit " + ((H5O_iter_data)iter_data).iterdata.size(), + ((H5O_iter_data)iter_data).iterdata.size() == 5); + assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") == 0); + assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1") == 0); + assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(2)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1") == 0); + assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(3)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1") == 0); + assertTrue("H5Ovisit " + (((H5O_iter_data)iter_data).iterdata.get(4)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2") == 0); + // assertTrue("H5Ovisit + // "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0); } @Test - public void testH5Ovisit_by_name() { + public void testH5Ovisit_by_name() + { class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -593,7 +711,8 @@ public class TestH5Obasic { } H5O_iterate_opdata_t iter_data = new H5O_iter_data(); class H5O_iter_callback implements H5O_iterate_t { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; @@ -601,20 +720,25 @@ public class TestH5Obasic { } H5O_iterate_t iter_cb = new H5O_iter_callback(); try { - H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, + iter_data, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Ovisit_by_name: " + err); } - assertFalse("H5Ovisit_by_name ",((H5O_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Ovisit_by_name "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==2); - assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); - assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2")==0); + assertFalse("H5Ovisit_by_name ", ((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit_by_name " + ((H5O_iter_data)iter_data).iterdata.size(), + ((H5O_iter_data)iter_data).iterdata.size() == 2); + assertTrue("H5Ovisit_by_name " + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") == 0); + assertTrue("H5Ovisit_by_name " + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name, + (((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2") == 0); } @Test - public void testH5Oexists_by_name() { + public void testH5Oexists_by_name() + { boolean name_exists = false; try { name_exists = H5.H5Oexists_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); @@ -624,16 +748,17 @@ public class TestH5Obasic { fail("H5.H5Oexists_by_name: " + err); } assertTrue("H5Oexists_by_name ", name_exists); - //TODO get dangling link result + // TODO get dangling link result } @Test - public void testH5Oopen_by_token() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oopen_by_token() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -641,7 +766,11 @@ public class TestH5Obasic { fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } H5la_ds1 = obj_info.token; - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } try { oid = H5.H5Oopen_by_token(H5fid, H5la_ds1); } @@ -656,22 +785,28 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_token: H5.H5Oget_info: " + err); } - assertFalse("testH5Oopen_by_token: H5Oget_info ",obj_info==null); - assertTrue("testH5Oopen_by_token: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("testH5Oopen_by_token: H5Oget_info ", obj_info == null); + assertTrue("testH5Oopen_by_token: H5Oget_info link type", + obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("testH5Oopen_by_token: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { - try{H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } } @Test - public void testH5Oopen_by_idx_n0() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oopen_by_idx_n0() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -679,9 +814,14 @@ public class TestH5Obasic { fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err); } H5la_ds1 = obj_info.token; - try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -694,22 +834,28 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n0: H5.H5Oget_info_by_idx: " + err); } - assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null); - assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ", obj_info == null); + assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type", + obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("testH5Oopen_by_idx_n0: Link Object Token", obj_info.token.equals(H5la_ds1)); } finally { - try{H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } } @Test - public void testH5Oopen_by_idx_n3() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oopen_by_idx_n3() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { - oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -717,9 +863,14 @@ public class TestH5Obasic { fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err); } H5la_l1 = obj_info.token; - try {H5.H5Oclose(oid);} catch (Exception ex) {} try { - oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -732,12 +883,17 @@ public class TestH5Obasic { err.printStackTrace(); fail("testH5Oopen_by_idx_n3:H5.H5Oget_info_by_idx: " + err); } - assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); - assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ", obj_info == null); + assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type", + obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("testH5Oopen_by_idx_n3:Link Object Token", obj_info.token.equals(H5la_l1)); } finally { - try{H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } } } diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java index 821cad3..e429fef 100644 --- a/java/test/TestH5Ocopy.java +++ b/java/test/TestH5Ocopy.java @@ -31,20 +31,22 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Ocopy { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String FILENAME = "testRefsattribute.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - long H5fid = 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) { + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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) + { File file = new File(filename); if (file.exists()) { @@ -57,87 +59,113 @@ public class TestH5Ocopy { } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5O._createDataset: ",did >= 0); + assertTrue("TestH5O._createDataset: ", did >= 0); return did; } - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - H5gcpl, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } - assertTrue("TestH5O._createGroup: ",gid >= 0); + assertTrue("TestH5O._createGroup: ", gid >= 0); return gid; } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); - H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); - H5dsid = H5.H5Screate_simple(1, dims, null); - H5gid = _createGroup(H5fid, "/G1"); - H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); + H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(1, dims, null); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("TestH5O.createH5file: " + err); } - assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0); - assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); - assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid >= 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5gid > 0) - try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + try { + H5.H5Gclose(H5gid); + } + catch (Exception ex) { + } if (H5did2 > 0) - try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did2); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5dsid2 > 0) - try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid2); + } + catch (Exception ex) { + } if (H5did1 > 0) - try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did1); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(FILENAME); System.out.println(); } @Test - public void testH5OcopyRefsAttr() { - long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + public void testH5OcopyRefsAttr() + { + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE]; - long attribute_id = HDF5Constants.H5I_INVALID_HID; + long attribute_id = HDF5Constants.H5I_INVALID_HID; try { try { @@ -147,7 +175,7 @@ public class TestH5Ocopy { err.printStackTrace(); fail("testH5OcopyRefsAttr: H5Rcreate_object " + err); } - + try { dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT); } @@ -155,27 +183,40 @@ public class TestH5Ocopy { err.printStackTrace(); fail("testH5OcopyRefsAttr: H5Rcreate_object " + err); } - + try { - attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0); H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF, dset_data); - + H5.H5Aclose(attribute_id); } catch (Exception ex) { fail("testH5OcopyRefsAttr: H5Awrite failed"); } finally { - try {H5.H5Aclose(attribute_id);} catch (Exception exx) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception exx) { + } } } catch (Exception ex) { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {} - try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(dset_data[1]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(dset_data[0]); + } + catch (Exception ex) { + } } try { @@ -185,19 +226,24 @@ public class TestH5Ocopy { H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } catch (Exception ex) { - fail("testH5OcopyRefsAttr: H5Ocopy failed"); + fail("testH5OcopyRefsAttr: H5Ocopy failed"); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } } } @Test - public void testH5OcopyRefsDatasettodiffFile() { + public void testH5OcopyRefsDatasettodiffFile() + { byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE]; - long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long H5fid2 = HDF5Constants.H5I_INVALID_HID; + long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long H5fid2 = HDF5Constants.H5I_INVALID_HID; try { try { @@ -214,72 +260,96 @@ public class TestH5Ocopy { err.printStackTrace(); fail("testH5OcopyRefsDatasettodiffFile: H5Rcreate_object " + err); } - + try { - dataset_id = H5.H5Dcreate(H5fid, "DSREF", - HDF5Constants.H5T_STD_REF, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0); - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); H5.H5Dclose(dataset_id); } catch (Exception ex) { fail("testH5OcopyRefsDatasettodiffFile: create dataset failed"); } finally { - try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception exx) { + } } } catch (Exception ex) { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {} - try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(dset_data[0]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(dset_data[1]); + } + catch (Exception ex) { + } } try { - //create new file - H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // create new file + H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0); H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); } catch (Exception ex) { - try {H5.H5Fclose(H5fid2);} catch (Exception exx) {} + try { + H5.H5Fclose(H5fid2); + } + catch (Exception exx) { + } fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed"); } try { - //create object copy property list id and set the flags. + // create object copy property list id and set the flags. ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0); H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); - //Perform copy function. + // Perform copy function. H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } - catch (Exception ex){ + catch (Exception ex) { ex.printStackTrace(); fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed"); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} - try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } + try { + H5.H5Fclose(H5fid2); + } + catch (Exception ex) { + } } _deleteFile("copy.h5"); } @Test - public void testH5OcopyRefsDatasettosameFile() { + public void testH5OcopyRefsDatasettosameFile() + { byte[][] dset_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE]; byte[][] read_data = new byte[2][HDF5Constants.H5R_REF_BUF_SIZE]; - 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; + 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; try { try { @@ -289,7 +359,7 @@ public class TestH5Ocopy { err.printStackTrace(); fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err); } - + try { dset_data[1] = H5.H5Rcreate_object(H5fid, "DS2", HDF5Constants.H5P_DEFAULT); } @@ -297,43 +367,54 @@ public class TestH5Ocopy { err.printStackTrace(); fail("testH5OcopyRefsDatasettosameFile: H5Rcreate_object " + err); } - + try { - //Create a dataset and write object references to it. - dataset_id = H5.H5Dcreate(H5fid, "DSREF", - HDF5Constants.H5T_STD_REF, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Create a dataset and write object references to it. + dataset_id = + H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0); - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); - //Close the dataset. + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Close the dataset. H5.H5Dclose(dataset_id); } catch (Exception ex) { fail("testH5OcopyRefsDatasettosameFile: create dataset failed"); } finally { - try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception exx) { + } } } catch (Exception ex) { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(dset_data[1]);} catch (Exception ex) {} - try {H5.H5Rdestroy(dset_data[0]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(dset_data[1]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(dset_data[0]); + } + catch (Exception ex) { + } } try { ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0); H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); - //Perform copy function. + // Perform copy function. try { H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } - catch(Exception ex) { + catch (Exception ex) { fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed"); } } @@ -341,11 +422,15 @@ public class TestH5Ocopy { fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed"); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception exx) { + } } try { - //Open the dataset that has been copied + // Open the dataset that has been copied try { did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0); @@ -355,9 +440,10 @@ public class TestH5Ocopy { fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed"); } - //Read the dataset object references in the read_data buffer. + // Read the dataset object references in the read_data buffer. try { - H5.H5Dread(did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data); + H5.H5Dread(did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_data); } catch (Exception e) { e.printStackTrace(); @@ -369,14 +455,18 @@ public class TestH5Ocopy { fail("testH5OcopyRefsDatasettosameFile: open and read dataset failed"); } finally { - try {H5.H5Dclose(did);} catch (Exception ex) {} + try { + H5.H5Dclose(did); + } + catch (Exception ex) { + } } try { - //Get the type of object the reference points to. + // Get the type of object the reference points to. obj_type = H5.H5Rget_obj_type3(read_data[1], HDF5Constants.H5R_OBJECT); assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); - + obj_type = H5.H5Rget_obj_type3(read_data[0], HDF5Constants.H5R_OBJECT); assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP); } @@ -384,22 +474,32 @@ public class TestH5Ocopy { ex.printStackTrace(); } finally { - try {H5.H5Rdestroy(read_data[1]);} catch (Exception ex) {} - try {H5.H5Rdestroy(read_data[0]);} catch (Exception ex) {} + try { + H5.H5Rdestroy(read_data[1]); + } + catch (Exception ex) { + } + try { + H5.H5Rdestroy(read_data[0]); + } + catch (Exception ex) { + } } } - + @Test - public void testH5OcopyNullRef() throws Throwable { + public void testH5OcopyNullRef() throws Throwable + { final long _pid_ = HDF5Constants.H5P_DEFAULT; - long sid = HDF5Constants.H5I_INVALID_HID; - long did = HDF5Constants.H5I_INVALID_HID; - long aid = HDF5Constants.H5I_INVALID_HID; + 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); assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0); - did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_); + did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, + _pid_, _pid_); assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0); aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF, sid, _pid_, _pid_); assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0); @@ -408,20 +508,36 @@ public class TestH5Ocopy { ex.printStackTrace(); } finally { - try {H5.H5Dclose(did);} catch (Exception exx) {} - try {H5.H5Aclose(aid);} catch (Exception exx) {} - try {H5.H5Sclose(sid);} catch (Exception exx) {} + try { + H5.H5Dclose(did); + } + catch (Exception exx) { + } + try { + H5.H5Aclose(aid); + } + catch (Exception exx) { + } + try { + H5.H5Sclose(sid); + } + catch (Exception exx) { + } } long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0); H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); try { - H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_); + H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, + _pid_); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception exx) { + } } } - } diff --git a/java/test/TestH5OcopyOld.java b/java/test/TestH5OcopyOld.java index e547051..2cfccc7 100644 --- a/java/test/TestH5OcopyOld.java +++ b/java/test/TestH5OcopyOld.java @@ -31,20 +31,22 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5OcopyOld { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String FILENAME = "testRefsattributeO.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - 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) { + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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) + { File file = new File(filename); if (file.exists()) { @@ -57,93 +59,119 @@ public class TestH5OcopyOld { } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5O._createDataset: ",did >= 0); + assertTrue("TestH5O._createDataset: ", did >= 0); return did; } - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - H5gcpl, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } - assertTrue("TestH5O._createGroup: ",gid >= 0); + assertTrue("TestH5O._createGroup: ", gid >= 0); return gid; } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); - H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); - H5dsid = H5.H5Screate_simple(1, dims, null); - H5gid = _createGroup(H5fid, "/G1"); - H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); + H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(1, dims, null); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("TestH5O.createH5file: " + err); } - assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0); - assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); - assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid >= 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5gid > 0) - try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + try { + H5.H5Gclose(H5gid); + } + catch (Exception ex) { + } if (H5did2 > 0) - try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did2); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5dsid2 > 0) - try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid2); + } + catch (Exception ex) { + } if (H5did1 > 0) - try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did1); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(FILENAME); System.out.println(); } @Test - public void testH5OcopyRefsAttr() { + public void testH5OcopyRefsAttr() + { long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; - byte rbuf0[]=null , rbuf1[] = null; - byte[] dset_data = new byte[16]; + byte rbuf0[] = null, rbuf1[] = null; + byte[] dset_data = new byte[16]; long attribute_id = HDF5Constants.H5I_INVALID_HID; try { rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); - //System.arraycopy(rbuf0, 0, dset_data, 0, 8); + // System.arraycopy(rbuf0, 0, dset_data, 0, 8); System.arraycopy(rbuf1, 0, dset_data, 8, 8); } catch (Exception ex) { @@ -151,7 +179,8 @@ public class TestH5OcopyOld { } try { - attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0); H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); @@ -161,7 +190,11 @@ public class TestH5OcopyOld { fail("testH5OcopyRefsAttr: H5Awrite failed"); } finally { - try {H5.H5Aclose(attribute_id);} catch (Exception exx) {} + try { + H5.H5Aclose(attribute_id); + } + catch (Exception exx) { + } } try { @@ -171,82 +204,103 @@ public class TestH5OcopyOld { H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } catch (Exception ex) { - fail("testH5OcopyRefsAttr: H5Ocopy failed"); + fail("testH5OcopyRefsAttr: H5Ocopy failed"); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } } } @Test - public void testH5OcopyRefsDatasettodiffFile() { - byte rbuf1[] = null; - byte[] dset_data = new byte[16]; + public void testH5OcopyRefsDatasettodiffFile() + { + byte rbuf1[] = null; + byte[] dset_data = new byte[16]; long ocp_plist_id = HDF5Constants.H5I_INVALID_HID; - long dataset_id = HDF5Constants.H5I_INVALID_HID; - long H5fid2 = 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); System.arraycopy(rbuf1, 0, dset_data, 8, 8); - dataset_id = H5.H5Dcreate(H5fid, "DSREF", - HDF5Constants.H5T_STD_REF_OBJ, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0); - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); H5.H5Dclose(dataset_id); } catch (Exception ex) { fail("testH5OcopyRefsDatasettodiffFile: create dataset failed"); } finally { - try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception exx) { + } } try { - //create new file - H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // create new file + H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0); H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); } catch (Exception ex) { - try {H5.H5Fclose(H5fid2);} catch (Exception exx) {} + try { + H5.H5Fclose(H5fid2); + } + catch (Exception exx) { + } fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed"); } try { - //create object copy property list id and set the flags. + // create object copy property list id and set the flags. ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0); H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); - //Perform copy function. + // Perform copy function. H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } - catch (Exception ex){ + catch (Exception ex) { ex.printStackTrace(); fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed"); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} - try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } + try { + H5.H5Fclose(H5fid2); + } + catch (Exception ex) { + } } _deleteFile("copy.h5"); } @Test - public void testH5OcopyRefsDatasettosameFile() { - byte rbuf0[]=null , rbuf1[] = null; - byte[] dset_data = new byte[16]; + public void testH5OcopyRefsDatasettosameFile() + { + byte rbuf0[] = null, rbuf1[] = null; + byte[] dset_data = new byte[16]; 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]; + long dataset_id = HDF5Constants.H5I_INVALID_HID; + long did = HDF5Constants.H5I_INVALID_HID; + int obj_type = -1; + byte[] read_data = new byte[16]; try { rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); @@ -254,19 +308,22 @@ public class TestH5OcopyOld { System.arraycopy(rbuf0, 0, dset_data, 0, 8); System.arraycopy(rbuf1, 0, dset_data, 8, 8); - //Create a dataset and write object references to it. - dataset_id = H5.H5Dcreate(H5fid, "DSREF", - HDF5Constants.H5T_STD_REF_OBJ, H5dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Create a dataset and write object references to it. + dataset_id = + H5.H5Dcreate(H5fid, "DSREF", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0); - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data); - //Close the dataset. + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Close the dataset. H5.H5Dclose(dataset_id); } catch (Exception ex) { - try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Exception exx) { + } fail("testH5OcopyRefsDatasettosameFile: create dataset failed"); } @@ -276,37 +333,50 @@ public class TestH5OcopyOld { H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); } catch (Exception ex) { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception exx) { + } fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed"); } - //Perform copy function. + // Perform copy function. try { H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); } - catch(Exception ex) { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + catch (Exception ex) { + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception exx) { + } fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed"); } - //Open the dataset that has been copied + // Open the dataset that has been copied try { did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT); assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0); } catch (Exception e) { - try {H5.H5Dclose(did);} catch (Exception exx) {} + try { + H5.H5Dclose(did); + } + catch (Exception exx) { + } e.printStackTrace(); fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed"); } try { - //Read the dataset object references in the read_data buffer. - H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data); + // Read the dataset object references in the read_data buffer. + H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_data); System.arraycopy(read_data, 0, rbuf0, 0, 8); System.arraycopy(read_data, 8, rbuf1, 0, 8); - //Get the type of object the reference points to. + // Get the type of object the reference points to. obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1); assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); @@ -317,22 +387,32 @@ public class TestH5OcopyOld { ex.printStackTrace(); } finally { - try {H5.H5Dclose(did);} catch (Exception ex) {} - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + try { + H5.H5Dclose(did); + } + catch (Exception ex) { + } + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } } - } - + } + @Test - public void testH5OcopyNullRef() throws Throwable { + public void testH5OcopyNullRef() throws Throwable + { final long _pid_ = HDF5Constants.H5P_DEFAULT; - long sid = HDF5Constants.H5I_INVALID_HID; - long did = HDF5Constants.H5I_INVALID_HID; - long aid = HDF5Constants.H5I_INVALID_HID; + 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); assertTrue("testH5OcopyNullRef.H5Screate_simple: ", sid >= 0); - did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_); + did = H5.H5Dcreate(H5fid, "Dataset_with_null_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, + _pid_, _pid_); assertTrue("testH5OcopyNullRef.H5Dcreate: ", did > 0); aid = H5.H5Acreate(did, "Null_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_); assertTrue("testH5OcopyNullRef.H5Acreate: ", aid > 0); @@ -341,57 +421,74 @@ public class TestH5OcopyOld { ex.printStackTrace(); } finally { - try {H5.H5Dclose(did);} catch (Exception exx) {} - try {H5.H5Aclose(aid);} catch (Exception exx) {} - try {H5.H5Sclose(sid);} catch (Exception exx) {} + try { + H5.H5Dclose(did); + } + catch (Exception exx) { + } + try { + H5.H5Aclose(aid); + } + catch (Exception exx) { + } + try { + H5.H5Sclose(sid); + } + catch (Exception exx) { + } } long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); assertTrue("testH5OcopyNullRef.H5Pcreate: ", ocp_plist_id >= 0); H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); try { - H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, _pid_); + H5.H5Ocopy(H5fid, "/Dataset_with_null_Ref", H5fid, "/Dataset_with_null_Ref_cp", ocp_plist_id, + _pid_); } finally { - try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception exx) { + } } } -// @Ignore because of JIRA HDF5-9547 -// @Test(expected = HDF5LibraryException.class) -// public void testH5OcopyInvalidRef() throws Throwable { -// final long _pid_ = HDF5Constants.H5P_DEFAULT; -// 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); -// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0); -// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_); -// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0); -// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_); -// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0); -// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1}); -// } -// catch (Exception ex) { -// ex.printStackTrace(); -// } -// finally { -// try {H5.H5Dclose(did);} catch (Exception exx) {} -// try {H5.H5Aclose(aid);} catch (Exception exx) {} -// try {H5.H5Sclose(sid);} catch (Exception exx) {} -// } -// -// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); -// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0); -// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); -// try { -// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_); -// } -// finally { -// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} -// } -// } - + // @Ignore because of JIRA HDF5-9547 + // @Test(expected = HDF5LibraryException.class) + // public void testH5OcopyInvalidRef() throws Throwable { + // final long _pid_ = HDF5Constants.H5P_DEFAULT; + // 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); + // assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0); + // did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, + // _pid_, _pid_, _pid_); assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0); aid = + // H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_); + // assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0); + // H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1}); + // } + // catch (Exception ex) { + // ex.printStackTrace(); + // } + // finally { + // try {H5.H5Dclose(did);} catch (Exception exx) {} + // try {H5.H5Aclose(aid);} catch (Exception exx) {} + // try {H5.H5Sclose(sid);} catch (Exception exx) {} + // } + // + // long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + // assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0); + // H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + // try { + // H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", + // ocp_plist_id, _pid_); + // } + // finally { + // try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + // } + // } } diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java index 78ea744..096abcd 100644 --- a/java/test/TestH5Ocreate.java +++ b/java/test/TestH5Ocreate.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; -import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.callbacks.H5O_iterate_opdata_t; +import hdf.hdf5lib.callbacks.H5O_iterate_t; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5O_info_t; @@ -35,21 +35,23 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Ocreate { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_EXTFILE = "h5ex_g_iterateO2.hdf"; - private static final String H5_FILE = "testO.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - 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) { + private static final String H5_FILE = "testO.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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) + { File file = new File(filename); if (file.exists()) { @@ -62,39 +64,41 @@ public class TestH5Ocreate { } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Dcreate: " + err); } - assertTrue("TestH5O._createDataset: ",did > 0); + assertTrue("TestH5O._createDataset: ", did > 0); return did; } - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { H5gcpl = HDF5Constants.H5P_DEFAULT; - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - H5gcpl, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, H5gcpl, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } - assertTrue("TestH5O._createGroup: ",gid > 0); + assertTrue("TestH5O._createGroup: ", gid > 0); return gid; } - private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, + long lcpl, long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); @@ -108,7 +112,9 @@ public class TestH5Ocreate { assertTrue("TestH5O._createHardLink ", link_exists); } - private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, + long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); @@ -122,7 +128,9 @@ public class TestH5Ocreate { assertTrue("TestH5O._createSoftLink ", link_exists); } - private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, + String dstname, long lcpl, long lapl) + { boolean link_exists = false; try { H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); @@ -137,64 +145,95 @@ public class TestH5Ocreate { } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); - H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - H5fcpl, HDF5Constants.H5P_DEFAULT); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, H5fcpl, HDF5Constants.H5P_DEFAULT); H5dsid = H5.H5Screate_simple(2, H5dims, null); H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); - H5gid = _createGroup(H5fid, "/G1"); + H5gid = _createGroup(H5fid, "/G1"); H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("TestH5O.createH5file: " + err); } - assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid > 0); - assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid > 0); - assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid > 0); + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ", H5gid > 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5gid > 0) - try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + try { + H5.H5Gclose(H5gid); + } + catch (Exception ex) { + } if (H5gcpl > 0) - try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5gcpl); + } + catch (Exception ex) { + } if (H5did2 > 0) - try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did2); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did1 > 0) - try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did1); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } if (H5fcpl > 0) - try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + try { + H5.H5Pclose(H5fcpl); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); } @Test(expected = HDF5LibraryException.class) - public void testH5Ocopy_cur_not_exists() throws Throwable { + public void testH5Ocopy_cur_not_exists() throws Throwable + { H5.H5Ocopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Ocopy() { + public void testH5Ocopy() + { try { H5.H5Ocopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); - assertTrue("testH5Ocopy:H5Lexists ",link_exists); + assertTrue("testH5Ocopy:H5Lexists ", link_exists); } catch (Throwable err) { err.printStackTrace(); @@ -203,57 +242,66 @@ public class TestH5Ocreate { } @Test(expected = HDF5LibraryException.class) - public void testH5Ocopy_dst_link_exists() throws Throwable { - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + public void testH5Ocopy_dst_link_exists() throws Throwable + { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Ocopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_info_by_idx_n0_create() { + public void testH5Oget_info_by_idx_n0_create() + { H5O_info_t obj_info = null; try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info_by_idx_n0:H5Pget_link_creation_order " + err); } try { - obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info_by_idx: " + err); } - assertFalse("H5Oget_info_by_idx ", obj_info==null); - assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info_by_idx ", obj_info == null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); } @Test - public void testH5Oget_info_by_idx_n1_create() { + public void testH5Oget_info_by_idx_n1_create() + { H5O_info_t obj_info = null; try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info_by_idx_n1:H5Pget_link_creation_order " + err); } try { - obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Oget_info_by_idx: " + err); } - assertFalse("H5Oget_info_by_idx ", obj_info==null); - assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + assertFalse("H5Oget_info_by_idx ", obj_info == null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type == HDF5Constants.H5O_TYPE_GROUP); } @Test - public void testH5Oget_info_softlink() { + public void testH5Oget_info_softlink() + { H5O_info_t obj_info = null; _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); try { @@ -263,21 +311,24 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info", obj_info==null); - assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info", obj_info == null); + assertTrue("H5Oget_info link type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); assertTrue("Link Object Token", obj_info.token != null); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_softlink_dangle() throws Throwable { + public void testH5Oget_info_softlink_dangle() throws Throwable + { _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5.H5Oget_info_by_name(H5fid, "L2", HDF5Constants.H5P_DEFAULT); } @Test - public void testH5Oget_info_externallink() { + public void testH5Oget_info_externallink() + { H5O_info_t obj_info = null; - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); } @@ -285,18 +336,19 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info: " + err); } - assertFalse("H5Oget_info", obj_info==null); - assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + assertFalse("H5Oget_info", obj_info == null); + assertTrue("H5Oget_info link type", obj_info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE); assertTrue("Link Object Token", obj_info.token != null); } @Test - public void testH5Olink() { - long oid = HDF5Constants.H5I_INVALID_HID; - H5O_info_t obj_info = null; + public void testH5Olink() + { + long oid = HDF5Constants.H5I_INVALID_HID; + H5O_info_t obj_info = null; H5O_info_t dst_obj_info = null; try { - oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); } catch (Throwable err) { @@ -311,10 +363,14 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Olink: " + err); } - try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } - assertFalse("H5Oget_info ", obj_info==null); - assertTrue("H5Oget_info object type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info ", obj_info == null); + assertTrue("H5Oget_info object type", obj_info.type == HDF5Constants.H5O_TYPE_DATASET); try { dst_obj_info = H5.H5Oget_info_by_name(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); @@ -323,29 +379,34 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_info_by_name: " + err); } - assertFalse("H5Oget_info ", dst_obj_info==null); - assertTrue("H5Oget_info object type", dst_obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertFalse("H5Oget_info ", dst_obj_info == null); + assertTrue("H5Oget_info object type", dst_obj_info.type == HDF5Constants.H5O_TYPE_DATASET); } @Test - public void testH5Ovisit_create() { + public void testH5Ovisit_create() + { try { int order = H5.H5Pget_link_creation_order(H5fcpl); - assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + assertTrue("creation order :" + order, + order == HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Ovisit_create:H5Pget_link_creation_order " + err); } - _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); class idata { public String link_name = null; - public int link_type = -1; - idata(String name, int type) { + public int link_type = -1; + idata(String name, int type) + { this.link_name = name; this.link_type = type; } @@ -355,7 +416,8 @@ public class TestH5Ocreate { } H5O_iterate_opdata_t iter_data = new H5O_iter_data(); class H5O_iter_callback implements H5O_iterate_t { - public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_opdata_t op_data) + { idata id = new idata(name, info.type); ((H5O_iter_data)op_data).iterdata.add(id); return 0; @@ -363,23 +425,34 @@ public class TestH5Ocreate { } H5O_iterate_t iter_cb = new H5O_iter_callback(); try { - H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, + iter_data); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Ovisit: " + err); } assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(), ((H5O_iter_data)iter_data).iterdata.size()==4); - assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); - assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); - assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); - assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); + assertTrue("H5Ovisit " + ((H5O_iter_data)iter_data).iterdata.size(), + ((H5O_iter_data)iter_data).iterdata.size() == 4); + assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name, + ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".") == + 0); + assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name, + ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1") == + 0); + assertTrue("H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name, + ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1") == + 0); + assertTrue( + "H5Ovisit " + ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name, + ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2") == 0); } @Test - public void testH5Ocomment() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Ocomment() + { + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -397,14 +470,19 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment: " + err); } - try {H5.H5Oclose(oid);} catch (Exception ex) {} - assertFalse("H5Oget_comment: ", obj_comment==null); - assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + assertFalse("H5Oget_comment: ", obj_comment == null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment") == 0); } @Test - public void testH5Ocomment_clear() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Ocomment_clear() + { + long oid = HDF5Constants.H5I_INVALID_HID; String obj_comment = null; try { oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); @@ -422,8 +500,8 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment: " + err); } - assertFalse("H5Oget_comment: ", obj_comment==null); - assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + assertFalse("H5Oget_comment: ", obj_comment == null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment") == 0); try { H5.H5Oset_comment(oid, null); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -439,12 +517,17 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment: " + err); } - try {H5.H5Oclose(oid);} catch (Exception ex) {} - assertTrue("H5Oget_comment: ", obj_comment==null); + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } + assertTrue("H5Oget_comment: ", obj_comment == null); } @Test - public void testH5Ocomment_by_name() { + public void testH5Ocomment_by_name() + { String obj_comment = null; try { H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); @@ -461,12 +544,13 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment_by_name: " + err); } - assertFalse("H5Oget_comment_by_name: ", obj_comment==null); - assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + assertFalse("H5Oget_comment_by_name: ", obj_comment == null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment") == 0); } @Test - public void testH5Ocomment_by_name_clear() { + public void testH5Ocomment_by_name_clear() + { String obj_comment = null; try { H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); @@ -483,8 +567,8 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment_by_name: " + err); } - assertFalse("H5Oget_comment_by_name: ", obj_comment==null); - assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + assertFalse("H5Oget_comment_by_name: ", obj_comment == null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment") == 0); try { H5.H5Oset_comment_by_name(H5fid, "DS1", null, HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); @@ -500,19 +584,20 @@ public class TestH5Ocreate { err.printStackTrace(); fail("H5.H5Oget_comment_by_name: " + err); } - assertTrue("H5Oget_comment_by_name: ", obj_comment==null); + assertTrue("H5Oget_comment_by_name: ", obj_comment == null); } @Test - public void testH5Oinc_dec_count() { - long oid = HDF5Constants.H5I_INVALID_HID; + public void testH5Oinc_dec_count() + { + long oid = HDF5Constants.H5I_INVALID_HID; H5O_info_t obj_info = null; try { try { - oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); obj_info = H5.H5Oget_info(oid); - assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); - assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 1); } catch (Throwable err) { err.printStackTrace(); @@ -527,8 +612,8 @@ public class TestH5Ocreate { } try { obj_info = H5.H5Oget_info(oid); - assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); - assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==2); + assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 2); } catch (Throwable err) { err.printStackTrace(); @@ -543,8 +628,8 @@ public class TestH5Ocreate { } try { obj_info = H5.H5Oget_info(oid); - assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); - assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + assertFalse("testH5Oinc_dec_count: H5Oget_info ", obj_info == null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count", obj_info.rc == 1); } catch (Throwable err) { err.printStackTrace(); @@ -552,12 +637,17 @@ public class TestH5Ocreate { } } finally { - try{H5.H5Oclose(oid);} catch (Exception ex) {} + try { + H5.H5Oclose(oid); + } + catch (Exception ex) { + } } } @Test - public void testH5Ocork() { + public void testH5Ocork() + { boolean corked = false; // Check cork status of the group: not corked @@ -608,5 +698,4 @@ public class TestH5Ocreate { } assertFalse("H5Oare_mdc_flushes_disabled: ", corked); } - } diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java index 5cbabe1..280e9fd 100644 --- a/java/test/TestH5Oparams.java +++ b/java/test/TestH5Oparams.java @@ -13,6 +13,7 @@ package test; import static org.junit.Assert.assertTrue; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -25,177 +26,211 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Oparams { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } - @Test//(expected = HDF5LibraryException.class) - public void testH5Oclose_invalid() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Oclose_invalid() throws Throwable + { long oid = H5.H5Oclose(-1); assertTrue(oid == 0); } @Test(expected = NullPointerException.class) - public void testH5Oopen_null() throws Throwable { + public void testH5Oopen_null() throws Throwable + { H5.H5Oopen(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Oopen_invalid() throws Throwable { + public void testH5Oopen_invalid() throws Throwable + { H5.H5Oopen(-1, "Bogus", 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Ocopy_invalid() throws Throwable { + public void testH5Ocopy_invalid() throws Throwable + { H5.H5Ocopy(-1, "Bogus", -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Ocopy_null_current() throws Throwable { + public void testH5Ocopy_null_current() throws Throwable + { H5.H5Ocopy(-1, null, 0, "Bogus", 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Ocopy_null_dest() throws Throwable { + public void testH5Ocopy_null_dest() throws Throwable + { H5.H5Ocopy(-1, "Bogus", 0, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_invalid() throws Throwable { + public void testH5Oget_info_invalid() throws Throwable + { H5.H5Oget_info(-1, 0); } @Test(expected = NullPointerException.class) - public void testH5Oget_info_by_name_null() throws Throwable { + public void testH5Oget_info_by_name_null() throws Throwable + { H5.H5Oget_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_name_invalid() throws Throwable { + public void testH5Oget_info_by_name_invalid() throws Throwable + { H5.H5Oget_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_info_by_idx_invalid() throws Throwable { + public void testH5Oget_info_by_idx_invalid() throws Throwable + { H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1); } @Test(expected = NullPointerException.class) - public void testH5Oget_info_by_idx_null() throws Throwable { + public void testH5Oget_info_by_idx_null() throws Throwable + { H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_invalid() throws Throwable { + public void testH5Oget_native_info_invalid() throws Throwable + { H5.H5Oget_native_info(-1, 0); } @Test(expected = NullPointerException.class) - public void testH5Oget_native_info_by_name_null() throws Throwable { + public void testH5Oget_native_info_by_name_null() throws Throwable + { H5.H5Oget_native_info_by_name(-1, null, 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_name_invalid() throws Throwable { + public void testH5Oget_native_info_by_name_invalid() throws Throwable + { H5.H5Oget_native_info_by_name(-1, "/testH5Gcreate", 0, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_native_info_by_idx_invalid() throws Throwable { + public void testH5Oget_native_info_by_idx_invalid() throws Throwable + { H5.H5Oget_native_info_by_idx(-1, "Bogus", -1, -1, -1L, 0, -1); } @Test(expected = NullPointerException.class) - public void testH5Oget_native_info_by_idx_null() throws Throwable { + public void testH5Oget_native_info_by_idx_null() throws Throwable + { H5.H5Oget_native_info_by_idx(-1, null, 0, 0, 0L, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Olink_invalid() throws Throwable { + public void testH5Olink_invalid() throws Throwable + { H5.H5Olink(-1, -1, "Bogus", -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Olink_null_dest() throws Throwable { + public void testH5Olink_null_dest() throws Throwable + { H5.H5Olink(-1, 0, null, 0, 0); } @Test(expected = NullPointerException.class) - public void testH5Ovisit_null() throws Throwable { + public void testH5Ovisit_null() throws Throwable + { H5.H5Ovisit(-1, -1, -1, null, null, 0); } @Test(expected = NullPointerException.class) - public void testH5Ovisit_by_name_nullname() throws Throwable { + public void testH5Ovisit_by_name_nullname() throws Throwable + { H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, 0, -1); } @Test(expected = NullPointerException.class) - public void testH5Ovisit_by_name_null() throws Throwable { + public void testH5Ovisit_by_name_null() throws Throwable + { H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, 0, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oset_comment_invalid() throws Throwable { + public void testH5Oset_comment_invalid() throws Throwable + { H5.H5Oset_comment(-1, "Bogus"); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_comment_invalid() throws Throwable { + public void testH5Oget_comment_invalid() throws Throwable + { H5.H5Oget_comment(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oset_comment_by_name_invalid() throws Throwable { + public void testH5Oset_comment_by_name_invalid() throws Throwable + { H5.H5Oset_comment_by_name(-1, "Bogus", null, -1); } @Test(expected = NullPointerException.class) - public void testH5Oset_comment_by_name_null() throws Throwable { + public void testH5Oset_comment_by_name_null() throws Throwable + { H5.H5Oset_comment_by_name(-1, null, null, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oget_comment_by_name_invalid() throws Throwable { + public void testH5Oget_comment_by_name_invalid() throws Throwable + { H5.H5Oget_comment_by_name(-1, "Bogus", -1); } @Test(expected = NullPointerException.class) - public void testH5Oget_comment_by_name_null() throws Throwable { + public void testH5Oget_comment_by_name_null() throws Throwable + { H5.H5Oget_comment_by_name(-1, null, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oflush_invalid() throws Throwable { + public void testH5Oflush_invalid() throws Throwable + { H5.H5Oflush(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Orefresh_invalid() throws Throwable { + public void testH5Orefresh_invalid() throws Throwable + { H5.H5Orefresh(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Odisable_mdc_flushes() throws Throwable { + public void testH5Odisable_mdc_flushes() throws Throwable + { H5.H5Odisable_mdc_flushes(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oenable_mdc_flushes() throws Throwable { + public void testH5Oenable_mdc_flushes() throws Throwable + { H5.H5Oenable_mdc_flushes(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Oare_mdc_flushes_disabled() throws Throwable { + public void testH5Oare_mdc_flushes_disabled() throws Throwable + { H5.H5Oare_mdc_flushes_disabled(-1); } - } diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 6ae93d9..0571e3f 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -34,40 +34,47 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5P { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testP.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - long[] H5dims = { DIM_X, DIM_Y }; - 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) { + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long[] H5dims = {DIM_X, DIM_Y}; + 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); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -78,12 +85,12 @@ public class TestH5P { return did; } - private final void _createH5File(long fcpl, long fapl) { + private final void _createH5File(long fcpl, long fapl) + { try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - fcpl, fapl); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, fcpl, fapl); H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -101,28 +108,26 @@ public class TestH5P { } } - public void deleteH5file() throws HDF5LibraryException { - _deleteFile(H5_FILE); - } + public void deleteH5file() throws HDF5LibraryException { _deleteFile(H5_FILE); } @Before - public void createH5fileProperties() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5fileProperties() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); - fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); - fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); - ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); - lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); - plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); - plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); - gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS); - gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); - acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); + lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS); + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); } catch (Throwable err) { err.printStackTrace(); @@ -134,51 +139,109 @@ public class TestH5P { assertTrue(ocpl_id > 0); assertTrue(ocp_plist_id > 0); assertTrue(lcpl_id > 0); - assertTrue(plapl_id>0); + assertTrue(plapl_id > 0); assertTrue(plist_id > 0); assertTrue(gapl_id > 0); - assertTrue(gcpl_id >0); - assertTrue(acpl_id >0); + assertTrue(gcpl_id > 0); + assertTrue(acpl_id > 0); } @After - public void deleteH5fileProperties() throws HDF5LibraryException { - if (lapl_id >0) - try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} - if (fapl_id >0) - try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} - if (fcpl_id >0) - try {H5.H5Pclose(fcpl_id);} catch (Exception ex) {} - if (ocpl_id >0) - try {H5.H5Pclose(ocpl_id);} catch (Exception ex) {} - if (ocp_plist_id >0) - try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} - if (lcpl_id >0) - try {H5.H5Pclose(lcpl_id);} catch (Exception ex) {} - if (plapl_id >0) - try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} - if (plist_id >0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} - if (gapl_id >0) - try {H5.H5Pclose(gapl_id);} catch (Exception ex) {} - if (gcpl_id >0) - try {H5.H5Pclose(gcpl_id);} catch (Exception ex) {} - if (acpl_id >0) - try {H5.H5Pclose(acpl_id);} catch (Exception ex) {} + public void deleteH5fileProperties() throws HDF5LibraryException + { + if (lapl_id > 0) + try { + H5.H5Pclose(lapl_id); + } + catch (Exception ex) { + } + if (fapl_id > 0) + try { + H5.H5Pclose(fapl_id); + } + catch (Exception ex) { + } + if (fcpl_id > 0) + try { + H5.H5Pclose(fcpl_id); + } + catch (Exception ex) { + } + if (ocpl_id > 0) + try { + H5.H5Pclose(ocpl_id); + } + catch (Exception ex) { + } + if (ocp_plist_id > 0) + try { + H5.H5Pclose(ocp_plist_id); + } + catch (Exception ex) { + } + if (lcpl_id > 0) + try { + H5.H5Pclose(lcpl_id); + } + catch (Exception ex) { + } + if (plapl_id > 0) + try { + H5.H5Pclose(plapl_id); + } + catch (Exception ex) { + } + if (plist_id > 0) + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } + if (gapl_id > 0) + try { + H5.H5Pclose(gapl_id); + } + catch (Exception ex) { + } + if (gcpl_id > 0) + try { + H5.H5Pclose(gcpl_id); + } + catch (Exception ex) { + } + if (acpl_id > 0) + try { + H5.H5Pclose(acpl_id); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } System.out.println(); } @Test - public void testH5Pget_nlinks() { + public void testH5Pget_nlinks() + { long nlinks = -1; try { - nlinks = (long) H5.H5Pget_nlinks(lapl_id); + nlinks = (long)H5.H5Pget_nlinks(lapl_id); } catch (Throwable err) { err.printStackTrace(); @@ -190,12 +253,13 @@ public class TestH5P { } @Test - public void testH5Pset_nlinks() { + public void testH5Pset_nlinks() + { long nlinks = 20; int ret_val = -1; try { ret_val = H5.H5Pset_nlinks(lapl_id, nlinks); - nlinks = (long) H5.H5Pget_nlinks(lapl_id); + nlinks = (long)H5.H5Pget_nlinks(lapl_id); } catch (Throwable err) { err.printStackTrace(); @@ -207,17 +271,22 @@ public class TestH5P { } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Pset_libver_bounds_invalidlow() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST+1, HDF5Constants.H5F_LIBVER_LATEST); + public void testH5Pset_libver_bounds_invalidlow() throws Throwable + { + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST + 1, + HDF5Constants.H5F_LIBVER_LATEST); } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST+1); + public void testH5Pset_libver_bounds_invalidhigh() throws Throwable + { + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, + HDF5Constants.H5F_LIBVER_LATEST + 1); } @Test - public void testH5Pget_link_creation_order() { + public void testH5Pget_link_creation_order() + { int crt_order_flags = 0; try { crt_order_flags = H5.H5Pget_link_creation_order(fcpl_id); @@ -230,47 +299,51 @@ public class TestH5P { } @Test - public void testH5Pset_link_creation_order_trackedPLUSindexed() { - int ret_val = -1; + public void testH5Pset_link_creation_order_trackedPLUSindexed() + { + int ret_val = -1; int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; - int crtorderflags = 0; + int crtorderflags = 0; try { - ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags); + ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags); crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_link_creation_order: " + err); } - assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed",ret_val >= 0); + assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed", ret_val >= 0); assertEquals(crt_order_flags, crtorderflags); } @Test - public void testH5Pset_link_creation_order_tracked() { - int ret_val = -1; + public void testH5Pset_link_creation_order_tracked() + { + int ret_val = -1; int crtorderflags = 0; try { - ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_link_creation_order: " + err); } - assertTrue("testH5Pset_link_creation_order_tracked",ret_val >= 0); + assertTrue("testH5Pset_link_creation_order_tracked", ret_val >= 0); assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags); } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_link_creation_order_invalidvalue() throws Throwable { + public void testH5Pset_link_creation_order_invalidvalue() throws Throwable + { H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); } @Test - public void testH5Pget_attr_creation_order() { + public void testH5Pget_attr_creation_order() + { int crt_order_flags = 0; try { @@ -284,13 +357,14 @@ public class TestH5P { } @Test - public void testH5Pset_attr_creation_order_trackedPLUSindexed() { - int ret_val = -1; + public void testH5Pset_attr_creation_order_trackedPLUSindexed() + { + int ret_val = -1; int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; - int crtorderflags = 0; + int crtorderflags = 0; try { - ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags); + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags); crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); } catch (Throwable err) { @@ -302,12 +376,13 @@ public class TestH5P { } @Test - public void testH5Pset_attr_creation_order_tracked() { - int ret_val = -1; + public void testH5Pset_attr_creation_order_tracked() + { + int ret_val = -1; int crtorderflags = 0; try { - ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); } catch (Throwable err) { @@ -319,12 +394,14 @@ public class TestH5P { } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable { + public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable + { H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); } @Test - public void testH5Pset_copy_object() { + public void testH5Pset_copy_object() + { int cpy_option = -1; @@ -350,12 +427,14 @@ public class TestH5P { } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_copy_object_invalidobject() throws Throwable { + public void testH5Pset_copy_object_invalidobject() throws Throwable + { H5.H5Pset_copy_object(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG); } @Test - public void testH5Pset_create_intermediate_group() { + public void testH5Pset_create_intermediate_group() + { int ret_val = -1; try { @@ -365,16 +444,18 @@ public class TestH5P { err.printStackTrace(); fail("H5Pset_create_intermediate_group: " + err); } - assertTrue(ret_val>=0); + assertTrue(ret_val >= 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable { + public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable + { H5.H5Pset_create_intermediate_group(ocp_plist_id, true); } @Test - public void testH5Pget_create_intermediate_group() { + public void testH5Pget_create_intermediate_group() + { boolean flag = false; try { H5.H5Pset_create_intermediate_group(lcpl_id, true); @@ -388,7 +469,8 @@ public class TestH5P { } @Test - public void testH5Pget_create_intermediate_group_notcreated() { + public void testH5Pget_create_intermediate_group_notcreated() + { boolean flag = true; try { flag = H5.H5Pget_create_intermediate_group(lcpl_id); @@ -401,43 +483,48 @@ public class TestH5P { } @Test - public void testH5Pset_data_transform() { + public void testH5Pset_data_transform() + { String expression = "(5/9.0)*(x-32)"; - int ret_val = -1; + int ret_val = -1; try { - ret_val= H5.H5Pset_data_transform(plist_id, expression); + ret_val = H5.H5Pset_data_transform(plist_id, expression); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_data_transform: " + err); } - assertTrue(ret_val>=0); + assertTrue(ret_val >= 0); } @Test(expected = NullPointerException.class) - public void testH5Pset_data_transform_NullExpression() throws Throwable { + public void testH5Pset_data_transform_NullExpression() throws Throwable + { H5.H5Pset_data_transform(plist_id, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_data_transform_InvalidExpression1() throws Throwable { + public void testH5Pset_data_transform_InvalidExpression1() throws Throwable + { H5.H5Pset_data_transform(plist_id, ""); } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_data_transform_InvalidExpression2() throws Throwable { + public void testH5Pset_data_transform_InvalidExpression2() throws Throwable + { H5.H5Pset_data_transform(plist_id, "hello"); } @Test - public void testH5Pget_data_transform() { + public void testH5Pget_data_transform() + { String expression = "(5/9.0)*(x-32)"; - String [] express = {""}; + String[] express = {""}; long express_size = 0; - long size = 20; + long size = 20; try { H5.H5Pset_data_transform(plist_id, expression); @@ -447,25 +534,28 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_data_transform: " + err); } - assertTrue(express_size>=0); + assertTrue(express_size >= 0); assertTrue("The data transform expression: ", expression.equals(express[0])); } @Test(expected = HDF5LibraryException.class) - public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable { - String [] express = {""}; + public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable + { + String[] express = {""}; H5.H5Pget_data_transform(plist_id, express, 20); } @Test(expected = IllegalArgumentException.class) - public void testH5Pget_data_transform_IllegalSize() throws Throwable { - String [] express = {""}; + public void testH5Pget_data_transform_IllegalSize() throws Throwable + { + String[] express = {""}; H5.H5Pset_data_transform(plist_id, "(5/9.0)*(x-32)"); H5.H5Pget_data_transform(plist_id, express, 0); } @Test - public void testH5Pget_elink_acc_flags() { + public void testH5Pget_elink_acc_flags() + { int get_flags = -1; try { @@ -480,12 +570,13 @@ public class TestH5P { } @Test - public void testH5Pset_elink_acc_flags() { + public void testH5Pset_elink_acc_flags() + { int get_flags = -1; - int ret_val = -1; + int ret_val = -1; try { - ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR); + ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR); get_flags = H5.H5Pget_elink_acc_flags(lapl_id); } catch (Throwable err) { @@ -497,21 +588,24 @@ public class TestH5P { } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable { + public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable + { H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC); } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable { + public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable + { H5.H5Pset_elink_acc_flags(lapl_id, -1); } @Test - public void testH5Pset_link_phase_change() { + public void testH5Pset_link_phase_change() + { int ret_val = -1; try { - ret_val = H5.H5Pset_link_phase_change(fcpl_id , 2, 2); + ret_val = H5.H5Pset_link_phase_change(fcpl_id, 2, 2); } catch (Throwable err) { err.printStackTrace(); @@ -521,17 +615,20 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable { - H5.H5Pset_link_phase_change(fcpl_id , 70000000, 3); + public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable + { + H5.H5Pset_link_phase_change(fcpl_id, 70000000, 3); } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable { - H5.H5Pset_link_phase_change(fcpl_id , 5, 6); + public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable + { + H5.H5Pset_link_phase_change(fcpl_id, 5, 6); } @Test - public void testH5Pget_link_phase_change() { + public void testH5Pget_link_phase_change() + { int ret_val = -1; int[] links = new int[2]; @@ -548,10 +645,11 @@ public class TestH5P { } @Test - public void testH5Pget_link_phase_change_EqualsSet() { + public void testH5Pget_link_phase_change_EqualsSet() + { int[] links = new int[2]; try { - H5.H5Pset_link_phase_change(fcpl_id , 10, 7); + H5.H5Pset_link_phase_change(fcpl_id, 10, 7); H5.H5Pget_link_phase_change(fcpl_id, links); } catch (Throwable err) { @@ -563,13 +661,15 @@ public class TestH5P { } @Test(expected = NullPointerException.class) - public void testH5Pget_link_phase_change_Null() throws Throwable { + public void testH5Pget_link_phase_change_Null() throws Throwable + { H5.H5Pget_link_phase_change(fcpl_id, null); } @Test - public void testH5Pget_attr_phase_change() { - int ret_val = -1; + public void testH5Pget_attr_phase_change() + { + int ret_val = -1; int[] attributes = new int[2]; try { @@ -580,7 +680,8 @@ public class TestH5P { fail("H5Pget_attr_phase_change: " + err); } assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); - assertEquals("Default value of the max. no. of attributes stored in compact storage", 8, attributes[0]); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 8, + attributes[0]); assertEquals("Default value of the min. no. of attributes stored in dense storage", 6, attributes[1]); try { H5.H5Pset_attr_phase_change(ocpl_id, 9, 5); @@ -597,14 +698,16 @@ public class TestH5P { fail("H5Pget_attr_phase_change: " + err); } assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); - assertEquals("Default value of the max. no. of attributes stored in compact storage", 9, attributes[0]); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 9, + attributes[0]); assertEquals("Default value of the min. no. of attributes stored in dense storage", 5, attributes[1]); } @Test - public void testH5Pget_shared_mesg_phase_change() { + public void testH5Pget_shared_mesg_phase_change() + { int ret_val = -1; - int[] size = new int[2]; + int[] size = new int[2]; try { ret_val = H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); @@ -617,11 +720,12 @@ public class TestH5P { } @Test - public void testH5Pget_shared_mesg_phase_change_EqualsSET() { + public void testH5Pget_shared_mesg_phase_change_EqualsSET() + { int[] size = new int[2]; try { - H5.H5Pset_shared_mesg_phase_change(fcpl_id,50, 40); + H5.H5Pset_shared_mesg_phase_change(fcpl_id, 50, 40); H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); } catch (Throwable err) { @@ -633,11 +737,12 @@ public class TestH5P { } @Test - public void testH5Pset_shared_mesg_phase_change() { + public void testH5Pset_shared_mesg_phase_change() + { int ret_val = -1; try { - ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id,2, 1); + ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id, 2, 1); } catch (Throwable err) { err.printStackTrace(); @@ -647,22 +752,26 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable { + public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable + { H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5001, 4000); } @Test(expected = IllegalArgumentException.class) - public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable { + public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable + { H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5000, 5001); } @Test(expected = IllegalArgumentException.class) - public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable { - H5.H5Pset_link_phase_change(fcpl_id , 3, 7); + public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable + { + H5.H5Pset_link_phase_change(fcpl_id, 3, 7); } @Test - public void testH5Pget_shared_mesg_nindexes() { + public void testH5Pget_shared_mesg_nindexes() + { int nindexes = -1; try { @@ -676,12 +785,13 @@ public class TestH5P { } @Test - public void testH5Pset_shared_mesg_nindexes() { + public void testH5Pset_shared_mesg_nindexes() + { int nindexes = -1; - int ret_val = -1; + int ret_val = -1; try { - ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); + ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id); } catch (Throwable err) { @@ -689,21 +799,23 @@ public class TestH5P { fail("H5Pset_shared_mesg_nindexes: " + err); } assertTrue("H5Pset_shared_mesg_nindexes", ret_val >= 0); - assertEquals("Value of nindexes is equal to value set",7 ,nindexes); + assertEquals("Value of nindexes is equal to value set", 7, nindexes); } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes()throws Throwable { + public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes() throws Throwable + { H5.H5Pset_shared_mesg_nindexes(fcpl_id, 9); } @Test - public void testH5Pset_shared_mesg_index() { + public void testH5Pset_shared_mesg_index() + { int ret_val = -1; try { H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); - ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); } catch (Throwable err) { err.printStackTrace(); @@ -713,24 +825,27 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable { - H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable + { + H5.H5Pset_shared_mesg_index(fcpl_id, 2, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable { + public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable + { H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); - H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10); + H5.H5Pset_shared_mesg_index(fcpl_id, 2, HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10); } @Test - public void testH5Pget_shared_mesg_index() { + public void testH5Pget_shared_mesg_index() + { - int ret_val = -1; + int ret_val = -1; int[] mesg_info = new int[2]; try { H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); - H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + H5.H5Pset_shared_mesg_index(fcpl_id, 0, HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); ret_val = H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); } catch (Throwable err) { @@ -743,13 +858,15 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable { + public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable + { int[] mesg_info = new int[2]; H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); } @Test - public void testH5Pset_local_heap_size_hint() { + public void testH5Pset_local_heap_size_hint() + { int ret_val = -1; try { ret_val = H5.H5Pset_local_heap_size_hint(gcpl_id, 0); @@ -762,7 +879,8 @@ public class TestH5P { } @Test - public void testH5Pget_local_heap_size_hint() { + public void testH5Pget_local_heap_size_hint() + { long size_hint = -1; try { size_hint = H5.H5Pget_local_heap_size_hint(gcpl_id); @@ -775,7 +893,8 @@ public class TestH5P { } @Test - public void testH5Pset_nbit() { + public void testH5Pset_nbit() + { int ret_val = -1; try { ret_val = H5.H5Pset_nbit(ocpl_id); @@ -788,9 +907,10 @@ public class TestH5P { } @Test - public void testH5Pset_scaleoffset() { - int ret_val = -1; - int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE; + public void testH5Pset_scaleoffset() + { + int ret_val = -1; + int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE; int scale_factor = HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT; try { ret_val = H5.H5Pset_scaleoffset(ocpl_id, scale_type, scale_factor); @@ -803,20 +923,23 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable { + public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable + { H5.H5Pset_scaleoffset(ocpl_id, 3, 1); } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable { + public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable + { H5.H5Pset_scaleoffset(ocpl_id, HDF5Constants.H5Z_SO_INT, -1); } @Test - public void testH5Pset_est_link_info() { + public void testH5Pset_est_link_info() + { int ret_val = -1; try { - ret_val = H5.H5Pset_est_link_info(gcpl_id, 0,10); + ret_val = H5.H5Pset_est_link_info(gcpl_id, 0, 10); } catch (Throwable err) { err.printStackTrace(); @@ -826,13 +949,15 @@ public class TestH5P { } @Test(expected = IllegalArgumentException.class) - public void testH5Pset_est_link_info_InvalidValues() throws Throwable { - H5.H5Pset_est_link_info(gcpl_id, 100000,10); + public void testH5Pset_est_link_info_InvalidValues() throws Throwable + { + H5.H5Pset_est_link_info(gcpl_id, 100000, 10); } @Test - public void testH5Pget_est_link_info() { - int ret_val = -1; + public void testH5Pget_est_link_info() + { + int ret_val = -1; int[] link_info = new int[2]; try { ret_val = H5.H5Pget_est_link_info(gcpl_id, link_info); @@ -845,8 +970,9 @@ public class TestH5P { } @Test - public void testH5Pset_elink_prefix() { - int ret_val = -1; + public void testH5Pset_elink_prefix() + { + int ret_val = -1; String prefix = "tmp"; try { ret_val = H5.H5Pset_elink_prefix(plapl_id, prefix); @@ -859,14 +985,16 @@ public class TestH5P { } @Test(expected = NullPointerException.class) - public void testH5Pset_elink_prefix_null() throws Throwable{ + public void testH5Pset_elink_prefix_null() throws Throwable + { H5.H5Pset_elink_prefix(plapl_id, null); } @Test - public void testH5Pget_elink_prefix() { - String prefix = "tmp"; - String[] pre = {""}; + public void testH5Pget_elink_prefix() + { + String prefix = "tmp"; + String[] pre = {""}; long prefix_size = 0; try { @@ -877,22 +1005,25 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_elink_prefix: " + err); } - assertTrue(prefix_size>=0); + assertTrue(prefix_size >= 0); assertTrue("The prefix: ", prefix.equals(pre[0])); } @Test(expected = NullPointerException.class) - public void testH5Pget_elink_prefix_null() throws Throwable { + public void testH5Pget_elink_prefix_null() throws Throwable + { H5.H5Pget_elink_prefix(plapl_id, null); } @Test(expected = NullPointerException.class) - public void testH5Pget_userblock_null() throws Throwable { + public void testH5Pget_userblock_null() throws Throwable + { H5.H5Pget_userblock(fcpl_id, null); } @Test - public void testH5P_userblock() { + public void testH5P_userblock() + { long[] size = {0}; try { @@ -903,13 +1034,13 @@ public class TestH5P { H5.H5Pclose(fcpl_id); /* Get the file's dataset creation property list */ - fcpl_id = H5.H5Fget_create_plist(H5fid); + fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); - assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); - assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_userblock(fcpl_id, size); deleteH5file(); } @@ -917,17 +1048,19 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_userblock: " + err); } - assertTrue("user block size: "+size[0], size[0] == 1024); + assertTrue("user block size: " + size[0], size[0] == 1024); } @Test(expected = NullPointerException.class) - public void testH5Pget_sizes_null() throws Throwable { + public void testH5Pget_sizes_null() throws Throwable + { H5.H5Pget_sizes(fcpl_id, null); } @Test - public void testH5P_sizes() { - long[] size = {0,0}; + public void testH5P_sizes() + { + long[] size = {0, 0}; try { H5.H5Pset_sizes(fcpl_id, 4, 8); @@ -937,13 +1070,13 @@ public class TestH5P { H5.H5Pclose(fcpl_id); /* Get the file's dataset creation property list */ - fcpl_id = H5.H5Fget_create_plist(H5fid); + fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); - assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); - assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sizes(fcpl_id, size); deleteH5file(); } @@ -951,18 +1084,20 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sizes: " + err); } - assertTrue("sizeof_addr size: "+size[0], size[0] == 4); - assertTrue("sizeof_size size: "+size[1], size[1] == 8); + assertTrue("sizeof_addr size: " + size[0], size[0] == 4); + assertTrue("sizeof_size size: " + size[1], size[1] == 8); } @Test(expected = NullPointerException.class) - public void testH5Pget_sym_k_null() throws Throwable { + public void testH5Pget_sym_k_null() throws Throwable + { H5.H5Pget_sym_k(fcpl_id, null); } @Test - public void testH5P_sym_k() { - int[] size = {0,0}; + public void testH5P_sym_k() + { + int[] size = {0, 0}; try { H5.H5Pset_sym_k(fcpl_id, 32, 8); @@ -972,13 +1107,13 @@ public class TestH5P { H5.H5Pclose(fcpl_id); /* Get the file's dataset creation property list */ - fcpl_id = H5.H5Fget_create_plist(H5fid); + fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0); - assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); - assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 0); + assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_sym_k(fcpl_id, size); deleteH5file(); } @@ -986,17 +1121,19 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sym_k: " + err); } - assertTrue("symbol table tree rank: "+size[0], size[0] == 32); - assertTrue("symbol table node size: "+size[1], size[1] == 8); + assertTrue("symbol table tree rank: " + size[0], size[0] == 32); + assertTrue("symbol table node size: " + size[1], size[1] == 8); } @Test(expected = NullPointerException.class) - public void testH5Pget_istore_k_null() throws Throwable { + public void testH5Pget_istore_k_null() throws Throwable + { H5.H5Pget_istore_k(fcpl_id, null); } @Test - public void testH5P_istore_k() { + public void testH5P_istore_k() + { int[] size = {0}; try { @@ -1007,13 +1144,13 @@ public class TestH5P { H5.H5Pclose(fcpl_id); /* Get the file's dataset creation property list */ - fcpl_id = H5.H5Fget_create_plist(H5fid); + fcpl_id = H5.H5Fget_create_plist(H5fid); /* Get the file's version information */ H5F_info2_t finfo = H5.H5Fget_info(H5fid); - assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1); - assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0); - assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0); + assertTrue("super block version: " + finfo.super_version, finfo.super_version == 1); + assertTrue("free-space manager version: " + finfo.free_version, finfo.free_version == 0); + assertTrue("shared object header version: " + finfo.sohm_version, finfo.sohm_version == 0); H5.H5Pget_istore_k(fcpl_id, size); deleteH5file(); } @@ -1021,13 +1158,14 @@ public class TestH5P { err.printStackTrace(); fail("H5Pget_sym_k: " + err); } - assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64); + assertTrue("chunked storage b-tree 1/2-rank: " + size[0], size[0] == 64); } @Test - public void testH5P_obj_track_times() { + public void testH5P_obj_track_times() + { boolean default_ret_val = false; - boolean ret_val = true; + boolean ret_val = true; try { default_ret_val = H5.H5Pget_obj_track_times(ocpl_id); H5.H5Pset_obj_track_times(ocpl_id, false); @@ -1042,7 +1180,8 @@ public class TestH5P { } @Test - public void testH5Pget_char_encoding() { + public void testH5Pget_char_encoding() + { int char_encoding = 0; try { @@ -1065,18 +1204,19 @@ public class TestH5P { } @Test - public void testH5P_fill_time() { + public void testH5P_fill_time() + { int[] fill_time = {0}; try { H5.H5Pget_fill_time(ocpl_id, fill_time); - assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET); + assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET); H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_ALLOC); H5.H5Pget_fill_time(ocpl_id, fill_time); - assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC); + assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC); H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_NEVER); H5.H5Pget_fill_time(ocpl_id, fill_time); - assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER); + assertTrue("fill_time: " + fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER); } catch (Throwable err) { err.printStackTrace(); @@ -1085,18 +1225,19 @@ public class TestH5P { } @Test - public void testH5P_alloc_time() { + public void testH5P_alloc_time() + { int[] alloc_time = {0}; try { H5.H5Pget_alloc_time(ocpl_id, alloc_time); - assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE); + assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE); H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); H5.H5Pget_alloc_time(ocpl_id, alloc_time); - assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY); + assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY); H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_INCR); H5.H5Pget_alloc_time(ocpl_id, alloc_time); - assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR); + assertTrue("alloc_time: " + alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR); } catch (Throwable err) { err.printStackTrace(); @@ -1105,21 +1246,24 @@ public class TestH5P { } @Test - public void testH5P_fill_value() { - int[] fill_value = {-1}; + public void testH5P_fill_value() + { + int[] fill_value = {-1}; int[] fill_value_status = {-1}; try { H5.H5Pfill_value_defined(ocpl_id, fill_value_status); - assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT); + assertTrue("fill_value_status: " + fill_value_status[0], + fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT); H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); - assertTrue("fill_value: "+fill_value[0], fill_value[0] == 0); + assertTrue("fill_value: " + fill_value[0], fill_value[0] == 0); fill_value[0] = 255; H5.H5Pset_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); - assertTrue("fill_value: "+fill_value[0], fill_value[0] == 255); + assertTrue("fill_value: " + fill_value[0], fill_value[0] == 255); H5.H5Pfill_value_defined(ocpl_id, fill_value_status); - assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED); + assertTrue("fill_value_status: " + fill_value_status[0], + fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED); } catch (Throwable err) { err.printStackTrace(); @@ -1128,15 +1272,16 @@ public class TestH5P { } @Test - public void testH5P_layout() { + public void testH5P_layout() + { int layout_type = -1; try { layout_type = H5.H5Pget_layout(ocpl_id); - assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS); + assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS); H5.H5Pset_layout(ocpl_id, HDF5Constants.H5D_COMPACT); layout_type = H5.H5Pget_layout(ocpl_id); - assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_COMPACT); + assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_COMPACT); } catch (Throwable err) { err.printStackTrace(); @@ -1145,18 +1290,19 @@ public class TestH5P { } @Test - public void testH5P_chunk() { - long[] chunk_size = {0,0}; - long[] chunk_new_size = {2,3}; - int layout_type = -1; + public void testH5P_chunk() + { + long[] chunk_size = {0, 0}; + long[] chunk_new_size = {2, 3}; + int layout_type = -1; try { H5.H5Pset_chunk(ocpl_id, 2, chunk_new_size); H5.H5Pget_chunk(ocpl_id, 2, chunk_size); - assertTrue("chunk: "+chunk_size[0], chunk_size[0] == chunk_new_size[0]); - assertTrue("chunk: "+chunk_size[1], chunk_size[1] == chunk_new_size[1]); + assertTrue("chunk: " + chunk_size[0], chunk_size[0] == chunk_new_size[0]); + assertTrue("chunk: " + chunk_size[1], chunk_size[1] == chunk_new_size[1]); layout_type = H5.H5Pget_layout(ocpl_id); - assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CHUNKED); + assertTrue("layout: " + layout_type, layout_type == HDF5Constants.H5D_CHUNKED); } catch (Throwable err) { err.printStackTrace(); @@ -1165,20 +1311,22 @@ public class TestH5P { } @Test - public void testH5P_file_space_strategy() { - long[] threshold = {0}; + public void testH5P_file_space_strategy() + { + long[] threshold = {0}; boolean[] persist = {false}; - int strategy = 0; + int strategy = 0; try { strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold); - assertTrue("strategy(default): "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR); - assertTrue("persist(default): "+persist[0], persist[0] == false); - assertTrue("threshold(default): "+threshold[0], threshold[0] == 1); + assertTrue("strategy(default): " + strategy, + strategy == HDF5Constants.H5F_FSPACE_STRATEGY_FSM_AGGR); + assertTrue("persist(default): " + persist[0], persist[0] == false); + assertTrue("threshold(default): " + threshold[0], threshold[0] == 1); H5.H5Pset_file_space_strategy(fcpl_id, HDF5Constants.H5F_FSPACE_STRATEGY_PAGE, true, 1); strategy = H5.H5Pget_file_space_strategy(fcpl_id, persist, threshold); - assertTrue("strategy: "+strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE); - assertTrue("persist: "+persist[0], persist[0] == true); - assertTrue("threshold: "+threshold[0], threshold[0] == 1); + assertTrue("strategy: " + strategy, strategy == HDF5Constants.H5F_FSPACE_STRATEGY_PAGE); + assertTrue("persist: " + persist[0], persist[0] == true); + assertTrue("threshold: " + threshold[0], threshold[0] == 1); } catch (Throwable err) { err.printStackTrace(); @@ -1187,23 +1335,25 @@ public class TestH5P { } @Test - public void testH5P_file_space_page_size() { + public void testH5P_file_space_page_size() + { long page_size = 0; try { page_size = H5.H5Pget_file_space_page_size(fcpl_id); - assertTrue("page_size(default): "+page_size, page_size == 4096); + assertTrue("page_size(default): " + page_size, page_size == 4096); H5.H5Pset_file_space_page_size(fcpl_id, 512); page_size = H5.H5Pget_file_space_page_size(fcpl_id); - assertTrue("page_size: "+page_size, page_size == 512); + assertTrue("page_size: " + page_size, page_size == 512); } catch (Throwable err) { err.printStackTrace(); fail("testH5P_file_space_page_size: " + err); } - } + } @Test - public void testH5Pset_efile_prefix() { + public void testH5Pset_efile_prefix() + { String prefix = "tmp"; try { H5.H5Pset_efile_prefix(lapl_id, prefix); @@ -1215,14 +1365,16 @@ public class TestH5P { } @Test(expected = NullPointerException.class) - public void testH5Pset_efile_prefix_null() throws Throwable{ + public void testH5Pset_efile_prefix_null() throws Throwable + { H5.H5Pset_efile_prefix(lapl_id, null); } @Test - public void testH5Pget_efile_prefix() { + public void testH5Pget_efile_prefix() + { String prefix = "tmp"; - String pre = ""; + String pre = ""; try { H5.H5Pset_efile_prefix(lapl_id, prefix); @@ -1236,15 +1388,17 @@ public class TestH5P { } @Ignore - public void testH5P_chunk_opts() { + public void testH5P_chunk_opts() + { int chunk_opts = -1; try { chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); - assertTrue("chunk_opts: "+chunk_opts, chunk_opts == 0); + assertTrue("chunk_opts: " + chunk_opts, chunk_opts == 0); H5.H5Pset_chunk_opts(ocpl_id, HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); chunk_opts = H5.H5Pget_chunk_opts(ocpl_id); - assertTrue("chunk_opts: "+chunk_opts, chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); + assertTrue("chunk_opts: " + chunk_opts, + chunk_opts == HDF5Constants.H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); } catch (Throwable err) { err.printStackTrace(); diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java index 8b04629..49a0b7d 100644 --- a/java/test/TestH5PData.java +++ b/java/test/TestH5PData.java @@ -31,44 +31,61 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5PData { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testPD.h5"; - private static final int DIM_X = 12; - private static final int DIM_Y = 18; - 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}, - {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, - {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, - {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, - {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, - {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, - {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, - {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, - {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, - {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, - {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, - {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} - }; - - private final void _deleteFile(String filename) { + private static final int DIM_X = 12; + private static final int DIM_Y = 18; + 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}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, + -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, + -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, + -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, + -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, + -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, + -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, + -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, + -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, + -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, + -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, + -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}}; + + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final long _createFloatDataset(long fid, long dsid, String name, long dapl) { + private final long _createFloatDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -80,49 +97,67 @@ public class TestH5PData { } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); } catch (Throwable err) { err.printStackTrace(); fail("TestH5PData.createH5file: " + err); } - assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ",H5fid > 0); - assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ",H5dsid > 0); - assertTrue("TestH5PData.createH5file: _createFloatDataset: ",H5did > 0); + assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5PData.createH5file: _createFloatDataset: ", H5did > 0); assertTrue(plist_id > 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); if (plist_id > 0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } System.out.println(); } @Test - public void testH5Pdata_transform() { - String f_to_c = "(5/9.0)*(x-32)"; + public void testH5Pdata_transform() + { + String f_to_c = "(5/9.0)*(x-32)"; double windchillFread[][] = new double[DIM_X][DIM_Y]; double windchillC; NumberFormat formatter = new DecimalFormat("#0.000"); @@ -130,38 +165,40 @@ public class TestH5PData { try { H5.H5Pset_data_transform(plist_id, f_to_c); H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - plist_id, windchillF); + plist_id, windchillF); H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, windchillFread); + HDF5Constants.H5P_DEFAULT, windchillFread); } catch (Throwable err) { err.printStackTrace(); fail("H5Pdata_transform: " + err); } - for(int row = 0; row < DIM_X; row++) - for(int col = 0; col < DIM_Y; col++) { - windchillC = (5/9.0)*(windchillF[row][col]-32); - String Cstr = formatter.format(windchillC); + for (int row = 0; row < DIM_X; row++) + for (int col = 0; col < DIM_Y; col++) { + windchillC = (5 / 9.0) * (windchillF[row][col] - 32); + String Cstr = formatter.format(windchillC); String Fread = formatter.format(windchillFread[row][col]); - assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + assertTrue("H5Pdata_transform: <" + row + "," + col + ">" + Fread + "=" + Cstr, + Fread.compareTo(Cstr) == 0); } } @Test - public void testH5P_buffer() { + public void testH5P_buffer() + { long default_size = 0; - long size = 0; + long size = 0; try { default_size = H5.H5Pget_buffer_size(plist_id); - H5.H5Pset_buffer_size(plist_id, DIM_X*DIM_Y); + H5.H5Pset_buffer_size(plist_id, DIM_X * DIM_Y); size = H5.H5Pget_buffer_size(plist_id); } catch (Throwable err) { err.printStackTrace(); fail("H5P_buffer fail: " + err); } - assertTrue("H5P_buffer default: "+default_size, default_size==1024*1024); - assertTrue("H5P_buffer size: "+size, size==DIM_X*DIM_Y); + assertTrue("H5P_buffer default: " + default_size, default_size == 1024 * 1024); + assertTrue("H5P_buffer size: " + size, size == DIM_X * DIM_Y); } } diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java index d44cc0b..f6440cd 100644 --- a/java/test/TestH5PL.java +++ b/java/test/TestH5PL.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -26,39 +27,45 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5PL { - @Rule public TestName testname = new TestName(); - private static String FILENAME = "h5_dlopenChunk.h5"; - private static String DATASETNAME = "DS1"; - private static final int DIM_X = 6; - private static final int DIM_Y = 8; - private static final int CHUNK_X = 4; - private static final int CHUNK_Y = 4; - private static final int RANK = 2; - private static final int NDIMS = 2; + @Rule + public TestName testname = new TestName(); + private static String FILENAME = "h5_dlopenChunk.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; private static final int H5Z_FILTER_DYNLIB4 = 260; @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test - public void TestH5PLplugins() { + public void TestH5PLplugins() + { try { int plugin_flags = H5.H5PLget_loading_state(); - assertTrue("H5.H5PLget_loading_state: "+plugin_flags, plugin_flags == HDF5Constants.H5PL_ALL_PLUGIN); + assertTrue("H5.H5PLget_loading_state: " + plugin_flags, + plugin_flags == HDF5Constants.H5PL_ALL_PLUGIN); int new_setting = plugin_flags & ~HDF5Constants.H5PL_FILTER_PLUGIN; - H5.H5PLset_loading_state (new_setting); + H5.H5PLset_loading_state(new_setting); int changed_flags = H5.H5PLget_loading_state(); - assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == new_setting); - H5.H5PLset_loading_state (plugin_flags); + assertTrue("H5.H5PLget_loading_state: " + changed_flags, changed_flags == new_setting); + H5.H5PLset_loading_state(plugin_flags); changed_flags = H5.H5PLget_loading_state(); - assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == HDF5Constants.H5PL_ALL_PLUGIN); + assertTrue("H5.H5PLget_loading_state: " + changed_flags, + changed_flags == HDF5Constants.H5PL_ALL_PLUGIN); } catch (Throwable err) { err.printStackTrace(); @@ -67,15 +74,16 @@ public class TestH5PL { } @Test - public void TestH5PLpaths() { + public void TestH5PLpaths() + { try { // Get the original number of paths int nStartPaths = H5.H5PLsize(); - int nPaths; /* # paths from H5PLSize() */ - int nTruePaths = nStartPaths; /* What the # paths should be */ - int index; /* Path table index */ - String path; /* Path from H5PLget() */ + int nPaths; /* # paths from H5PLSize() */ + int nTruePaths = nStartPaths; /* What the # paths should be */ + int index; /* Path table index */ + String path; /* Path from H5PLget() */ // APPEND a path and ensure it was added correctly String pathAppend = "path_append"; @@ -86,8 +94,9 @@ public class TestH5PL { assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths); index = nTruePaths - 1; - path = H5.H5PLget(index); - assertTrue("Path should be " + pathAppend + " but was " + path, path.compareToIgnoreCase(pathAppend) == 0); + path = H5.H5PLget(index); + assertTrue("Path should be " + pathAppend + " but was " + path, + path.compareToIgnoreCase(pathAppend) == 0); // PREPEND a path and ensure it was added correctly String pathPrepend = "path_prepend"; @@ -98,13 +107,14 @@ public class TestH5PL { assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths); index = 0; - path = H5.H5PLget(index); - assertTrue("Path should be " + pathPrepend + " but was " + path, path.compareToIgnoreCase(pathPrepend) == 0); + path = H5.H5PLget(index); + assertTrue("Path should be " + pathPrepend + " but was " + path, + path.compareToIgnoreCase(pathPrepend) == 0); // INSERT a path and ensure it was added correctly // Inserting at the index == # of start paths ensures we're in the middle String pathInsert = "path_insert"; - index = nStartPaths; + index = nStartPaths; H5.H5PLinsert(pathInsert, index); nPaths = H5.H5PLsize(); @@ -112,22 +122,24 @@ public class TestH5PL { assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths); path = H5.H5PLget(index); - assertTrue("Path should be " + pathInsert + " but was " + path, path.compareToIgnoreCase(pathInsert) == 0); + assertTrue("Path should be " + pathInsert + " but was " + path, + path.compareToIgnoreCase(pathInsert) == 0); // REPLACE the path we just added and ensure it updated correctly String pathReplace = "path_replace"; - index = nStartPaths; + index = nStartPaths; H5.H5PLreplace(pathReplace, index); nPaths = H5.H5PLsize(); assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths); path = H5.H5PLget(index); - assertTrue("Path should be " + pathReplace + " but was " + path, path.compareToIgnoreCase(pathReplace) == 0); + assertTrue("Path should be " + pathReplace + " but was " + path, + path.compareToIgnoreCase(pathReplace) == 0); // REMOVE the path we just replaced and check that the table was compacted // The (index+1) path should move down to fill the space when the path is removed. - index = nStartPaths; + index = nStartPaths; String pathRemove = H5.H5PLget(index + 1); H5.H5PLremove(index); @@ -136,7 +148,8 @@ public class TestH5PL { assertTrue("# paths should be " + nTruePaths + " but was " + nPaths, nTruePaths == nPaths); path = H5.H5PLget(index); - assertTrue("Path should be " + pathRemove + " but was " + path, path.compareToIgnoreCase(pathRemove) == 0); + assertTrue("Path should be " + pathRemove + " but was " + path, + path.compareToIgnoreCase(pathRemove) == 0); } catch (Throwable err) { err.printStackTrace(); @@ -145,22 +158,23 @@ public class TestH5PL { } @Ignore - public void TestH5PLdlopen() { - long file_id = HDF5Constants.H5I_INVALID_HID; + public void TestH5PLdlopen() + { + 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; + 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}; - long[] dims = { DIM_X, DIM_Y }; - long[] chunk_dims = { CHUNK_X, CHUNK_Y }; - int[][] dset_data = new int[DIM_X][DIM_Y]; - int[] mdc_nelmts = {0}; + int[] cd_values = {9, 0, 0, 0}; + int[] libversion = {0, 0, 0}; + long[] dims = {DIM_X, DIM_Y}; + long[] chunk_dims = {CHUNK_X, CHUNK_Y}; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int[] mdc_nelmts = {0}; long[] rdcc_nelmts = {0}; long[] rdcc_nbytes = {0}; - double[] rdcc_w0 = {0}; + double[] rdcc_w0 = {0}; // Initialize data to "1", to make it easier to see the selections. for (int indx = 0; indx < DIM_X; indx++) @@ -170,7 +184,7 @@ public class TestH5PL { // Create a new file using default properties. try { file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -212,7 +226,8 @@ public class TestH5PL { cd_values[2] = libversion[1]; cd_values[3] = libversion[2]; if (dcpl_id >= 0) - H5.H5Pset_filter(dcpl_id, H5Z_FILTER_DYNLIB4, HDF5Constants.H5Z_FLAG_MANDATORY, 4, cd_values); + H5.H5Pset_filter(dcpl_id, H5Z_FILTER_DYNLIB4, HDF5Constants.H5Z_FLAG_MANDATORY, 4, + cd_values); } catch (Exception e) { e.printStackTrace(); @@ -222,8 +237,9 @@ public class TestH5PL { // Create the chunked dataset. try { if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) - dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_NATIVE_INT, filespace_id, - HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + dataset_id = + H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); } catch (Exception e) { e.printStackTrace(); @@ -232,8 +248,8 @@ public class TestH5PL { try { if (dataset_id >= 0) - H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5S_ALL, dset_data); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, dset_data); } catch (Exception e) { e.printStackTrace(); @@ -247,13 +263,29 @@ public class TestH5PL { finally { // End access to the dataset and release resources used by it. if (dcpl_id >= 0) - try {H5.H5Pclose_class(dcpl_id);} catch (Throwable err) {} + try { + H5.H5Pclose_class(dcpl_id); + } + catch (Throwable err) { + } if (dataset_id >= 0) - try {H5.H5Dclose(dataset_id);} catch (Throwable err) {} + try { + H5.H5Dclose(dataset_id); + } + catch (Throwable err) { + } if (filespace_id >= 0) - try {H5.H5Sclose(filespace_id);} catch (Throwable err) {} + try { + H5.H5Sclose(filespace_id); + } + catch (Throwable err) { + } if (file_id >= 0) - try {H5.H5Fclose(file_id);} catch (Throwable err) {} + try { + H5.H5Fclose(file_id); + } + catch (Throwable err) { + } } } } diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java index f6be24f..307ee74 100644 --- a/java/test/TestH5Pfapl.java +++ b/java/test/TestH5Pfapl.java @@ -35,104 +35,140 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Pfapl { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); - private static final String H5_FILE = "testPf.h5"; - private static final String H5_LOG_FILE = "testPf.log"; + private static final String H5_FILE = "testPf.h5"; + private static final String H5_LOG_FILE = "testPf.log"; private static final String H5_FAMILY_FILE = "testPf%05d"; - private static final String H5_MULTI_FILE = "testPfmulti"; - private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - private static final int DIMF_X = 12; - private static final int DIMF_Y = 18; - long H5fid = 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 = 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}, - {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, - {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, - {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, - {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, - {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, - {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, - {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, - {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, - {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, - {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, - {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} - }; - - private final void _deleteFile(String filename) { + private static final String H5_MULTI_FILE = "testPfmulti"; + private static char MULTI_LETTERS[] = {'X', 's', 'b', 'r', 'g', 'l', 'o'}; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int DIMF_X = 12; + private static final int DIMF_Y = 18; + long H5fid = 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 = 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}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, + -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, + -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, + -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, + -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, + -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, + -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, + -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, + -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, + -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, + -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, + -62.0, -69.0, -76.0, -84.0, -91.0, -98.0}}; + + private final void _deleteFile(String filename) + { File file = null; try { file = new File(filename); } - catch (Throwable err) {} + catch (Throwable err) { + } if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final void _deleteLogFile() { + private final void _deleteLogFile() + { File file = null; try { file = new File(H5_LOG_FILE); } - catch (Throwable err) {} + catch (Throwable err) { + } if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final void _deleteFamilyFile() { + private final void _deleteFamilyFile() + { File file = null; - for(int indx = 0; ;indx++) { + for (int indx = 0;; indx++) { java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); try { - file = new File("test"+myFormat.format(Integer.valueOf(indx))+".h5"); + file = new File("test" + myFormat.format(Integer.valueOf(indx)) + ".h5"); + } + catch (Throwable err) { } - catch (Throwable err) {} if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } else return; } } - private final void _deleteMultiFile() { + private final void _deleteMultiFile() + { File file = null; - for(int indx = 1;indx<7;indx++) { + for (int indx = 1; indx < 7; indx++) { try { - file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); + file = new File(H5_MULTI_FILE + "-" + MULTI_LETTERS[indx] + ".h5"); + } + catch (Throwable err) { } - catch (Throwable err) {} if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } } - private final long _createDataset(long fid, long dsid, String name, long dapl) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -143,11 +179,13 @@ public class TestH5Pfapl { return did; } - private final void _createFloatDataset() { + private final void _createFloatDataset() + { try { H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); - H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5Fdid = + H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -163,7 +201,8 @@ public class TestH5Pfapl { } } - private final void _createH5multiFileDS() { + private final void _createH5multiFileDS() + { try { H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); } @@ -181,12 +220,12 @@ public class TestH5Pfapl { } } - private final void _createH5File(long fapl) { + private final void _createH5File(long fapl) + { try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl); H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -204,12 +243,13 @@ public class TestH5Pfapl { } } - private final void _createH5familyFile(long fapl) { + private final void _createH5familyFile(long fapl) + { try { - H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); + H5fid = H5.H5Fcreate(H5_FAMILY_FILE + ".h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); @@ -227,10 +267,10 @@ public class TestH5Pfapl { } } - private final void _createH5multiFile(long fapl) { + private final void _createH5multiFile(long fapl) + { try { - H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, fapl); + H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl); H5dsid = H5.H5Screate_simple(2, H5dims, null); } catch (Throwable err) { @@ -248,22 +288,16 @@ public class TestH5Pfapl { } } - public void deleteH5file() { - _deleteFile(H5_FILE); - } + public void deleteH5file() { _deleteFile(H5_FILE); } - public void deleteH5familyfile() { - _deleteFamilyFile(); - } + public void deleteH5familyfile() { _deleteFamilyFile(); } - public void deleteH5multifile() { - _deleteMultiFile(); - } + public void deleteH5multifile() { _deleteMultiFile(); } @Before - public void createFileAccess() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createFileAccess() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { @@ -283,9 +317,9 @@ public class TestH5Pfapl { } assertTrue(plapl_id > 0); try { - plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); - dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); } catch (Throwable err) { err.printStackTrace(); @@ -297,34 +331,76 @@ public class TestH5Pfapl { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (fapl_id > 0) - try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(fapl_id); + } + catch (Exception ex) { + } if (plapl_id > 0) - try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plapl_id); + } + catch (Exception ex) { + } if (dapl_id > 0) - try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(dapl_id); + } + catch (Exception ex) { + } if (plist_id > 0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } if (btplist_id > 0) - try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(btplist_id); + } + catch (Exception ex) { + } if (H5Fdsid > 0) - try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5Fdsid); + } + catch (Exception ex) { + } if (H5Fdid > 0) - try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} + try { + H5.H5Dclose(H5Fdid); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } System.out.println(); } @Test - public void testH5Pget_libver_bounds() { - int ret_val = -1; + public void testH5Pget_libver_bounds() + { + int ret_val = -1; int[] libver = new int[2]; try { @@ -342,11 +418,12 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_libver_bounds() { + public void testH5Pset_libver_bounds() + { - int ret_val = -1; - int low = HDF5Constants.H5F_LIBVER_EARLIEST; - int high = HDF5Constants.H5F_LIBVER_LATEST; + int ret_val = -1; + int low = HDF5Constants.H5F_LIBVER_EARLIEST; + int high = HDF5Constants.H5F_LIBVER_LATEST; int[] libver = new int[2]; try { @@ -365,15 +442,17 @@ public class TestH5Pfapl { } @Test(expected = HDF5LibraryException.class) - public void testH5Pset_elink_fapl_NegativeID() throws Throwable { - H5.H5Pset_elink_fapl(-1, fapl_id ); + public void testH5Pset_elink_fapl_NegativeID() throws Throwable + { + H5.H5Pset_elink_fapl(-1, fapl_id); } @Test - public void testH5Pset_elink_fapl() { + public void testH5Pset_elink_fapl() + { int ret_val = -1; try { - ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id); } catch (Throwable err) { err.printStackTrace(); @@ -383,12 +462,13 @@ public class TestH5Pfapl { } @Test - public void testH5Pget_elink_fapl() { + public void testH5Pget_elink_fapl() + { 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); - assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id ); + assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id); } catch (Throwable err) { err.printStackTrace(); @@ -396,15 +476,20 @@ public class TestH5Pfapl { } finally { if (ret_val_id > 0) - try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + try { + H5.H5Pclose(ret_val_id); + } + catch (Exception ex) { + } } } @Test - public void testH5P_elink_fapl() { + public void testH5P_elink_fapl() + { long ret_val_id = HDF5Constants.H5I_INVALID_HID; try { - H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + H5.H5Pset_elink_fapl(plapl_id, fapl_id); ret_val_id = H5.H5Pget_elink_fapl(plapl_id); assertTrue("H5P_elink_fapl", ret_val_id >= 0); } @@ -414,16 +499,21 @@ public class TestH5Pfapl { } finally { if (ret_val_id > 0) - try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + try { + H5.H5Pclose(ret_val_id); + } + catch (Exception ex) { + } } } @Test - public void testH5P_elink_file_cache_size() { + public void testH5P_elink_file_cache_size() + { long elink_fapl_id = HDF5Constants.H5I_INVALID_HID; - int efc_size = 0; + int efc_size = 0; try { - H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + H5.H5Pset_elink_fapl(plapl_id, fapl_id); elink_fapl_id = H5.H5Pget_elink_fapl(plapl_id); assertTrue("H5P_elink_file_cache_size", elink_fapl_id >= 0); try { @@ -449,15 +539,20 @@ public class TestH5Pfapl { } finally { if (elink_fapl_id > 0) - try {H5.H5Pclose(elink_fapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(elink_fapl_id); + } + catch (Exception ex) { + } } } @Test - public void testH5P_btree_ratios() { - double[] left = {0.1}; + public void testH5P_btree_ratios() + { + double[] left = {0.1}; double[] middle = {0.5}; - double[] right = {0.7}; + double[] right = {0.7}; try { H5.H5Pset_btree_ratios(plist_id, left[0], middle[0], right[0]); H5.H5Pget_btree_ratios(plist_id, left, middle, right); @@ -470,7 +565,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_edc_check() { + public void testH5P_edc_check() + { int ret_val_id = -1; try { ret_val_id = H5.H5Pget_edc_check(plist_id); @@ -486,7 +582,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_fclose_degree() { + public void testH5P_fclose_degree() + { int ret_val_id = -1; try { ret_val_id = H5.H5Pget_fclose_degree(fapl_id); @@ -517,8 +614,9 @@ public class TestH5Pfapl { } @Test - public void testH5P_alignment() { - long[] align = {0,0}; + public void testH5P_alignment() + { + long[] align = {0, 0}; try { H5.H5Pget_alignment(fapl_id, align); assertTrue("H5P_alignment threshold default", align[0] == 1); @@ -543,7 +641,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_meta_block_size() { + public void testH5P_meta_block_size() + { long meta_size = 0; try { meta_size = H5.H5Pget_meta_block_size(fapl_id); @@ -566,7 +665,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_small_data_block_size() { + public void testH5P_small_data_block_size() + { long align = 0; try { align = H5.H5Pget_small_data_block_size(fapl_id); @@ -589,7 +689,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_hyper_vector_size() { + public void testH5P_hyper_vector_size() + { long[] align = {0}; try { H5.H5Pget_hyper_vector_size(plist_id, align); @@ -612,14 +713,15 @@ public class TestH5Pfapl { } @Test - public void testH5P_cache() { + public void testH5P_cache() + { long[] rdcc_nelmts = {0}; long[] rdcc_nbytes = {0}; - double[] rdcc_w0 = {0}; + double[] rdcc_w0 = {0}; try { H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0); assertTrue("H5P_cache default", rdcc_nelmts[0] == 521); - assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024 * 1024)); assertTrue("H5P_cache default", rdcc_w0[0] == 0.75); } catch (Throwable err) { @@ -639,14 +741,15 @@ public class TestH5Pfapl { } @Test - public void testH5P_chunk_cache() { + public void testH5P_chunk_cache() + { long[] rdcc_nslots = {0}; long[] rdcc_nbytes = {0}; - double[] rdcc_w0 = {0}; + double[] rdcc_w0 = {0}; try { H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); assertTrue("H5P_chunk_cache default", rdcc_nslots[0] == 521); - assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024 * 1024)); assertTrue("H5P_chunk_cache default", rdcc_w0[0] == 0.75); } catch (Throwable err) { @@ -666,11 +769,12 @@ public class TestH5Pfapl { } @Test - public void testH5P_sieve_buf_size() { + public void testH5P_sieve_buf_size() + { long buf_size = 0; try { buf_size = H5.H5Pget_sieve_buf_size(fapl_id); - assertTrue("H5P_sieve_buf_size default", buf_size == (64*1024)); + assertTrue("H5P_sieve_buf_size default", buf_size == (64 * 1024)); } catch (Throwable err) { err.printStackTrace(); @@ -689,7 +793,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_gc_references() { + public void testH5P_gc_references() + { boolean ret_val_id = false; try { H5.H5Pset_gc_references(fapl_id, true); @@ -703,11 +808,13 @@ public class TestH5Pfapl { } @Test - public void testH5Pget_mdc_config() { + public void testH5Pget_mdc_config() + { H5AC_cache_config_t cache_config = null; try { cache_config = H5.H5Pget_mdc_config(fapl_id); - assertTrue("H5Pget_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + assertTrue("H5Pget_mdc_config", + cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); } catch (Throwable err) { err.printStackTrace(); @@ -716,11 +823,13 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_mdc_config() { + public void testH5Pset_mdc_config() + { H5AC_cache_config_t cache_config = null; try { cache_config = H5.H5Pget_mdc_config(fapl_id); - assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + assertTrue("H5Pset_mdc_config", + cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); } catch (Throwable err) { err.printStackTrace(); @@ -730,8 +839,9 @@ public class TestH5Pfapl { cache_config.decr_mode = HDF5Constants.H5C_decr_off; H5.H5Pset_mdc_config(fapl_id, cache_config); cache_config = H5.H5Pget_mdc_config(fapl_id); - assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); - assertTrue("H5Pset_mdc_config", cache_config.decr_mode==HDF5Constants.H5C_decr_off); + assertTrue("H5Pset_mdc_config", + cache_config.version == HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + assertTrue("H5Pset_mdc_config", cache_config.decr_mode == HDF5Constants.H5C_decr_off); } catch (Throwable err) { err.printStackTrace(); @@ -740,24 +850,25 @@ public class TestH5Pfapl { } @Test - public void testH5P_fapl_core() { + public void testH5P_fapl_core() + { if (HDF5Constants.H5FD_CORE < 0) return; try { H5.H5Pset_fapl_core(fapl_id, 4096, false); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: core = "+ driver_type, HDF5Constants.H5FD_CORE==driver_type); + assertTrue("H5Pget_driver: core = " + driver_type, HDF5Constants.H5FD_CORE == driver_type); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_fapl_core: " + err); } try { - long[] increment = {-1}; + long[] increment = {-1}; boolean[] backingstore = {true}; H5.H5Pget_fapl_core(fapl_id, increment, backingstore); - assertTrue("H5Pget_fapl_core: increment="+increment[0], increment[0]==4096); - assertTrue("H5Pget_fapl_core: backingstore="+backingstore[0], !backingstore[0]); + assertTrue("H5Pget_fapl_core: increment=" + increment[0], increment[0] == 4096); + assertTrue("H5Pget_fapl_core: backingstore=" + backingstore[0], !backingstore[0]); } catch (Throwable err) { err.printStackTrace(); @@ -766,13 +877,14 @@ public class TestH5Pfapl { } @Test - public void testH5P_fapl_family() { + public void testH5P_fapl_family() + { if (HDF5Constants.H5FD_FAMILY < 0) return; try { H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + assertTrue("H5Pget_driver: family = " + driver_type, HDF5Constants.H5FD_FAMILY == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -782,8 +894,9 @@ public class TestH5Pfapl { long[] member_size = {0}; long[] member_fapl = {-1}; H5.H5Pget_fapl_family(fapl_id, member_size, member_fapl); - assertTrue("H5Pget_fapl_family: member_size="+member_size[0], member_size[0]==1024); - assertTrue("H5Pget_fapl_family: member_fapl ", H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_family: member_size=" + member_size[0], member_size[0] == 1024); + assertTrue("H5Pget_fapl_family: member_fapl ", + H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); } catch (Throwable err) { err.printStackTrace(); @@ -794,13 +907,14 @@ public class TestH5Pfapl { } @Test - public void testH5P_family_offset() { + public void testH5P_family_offset() + { if (HDF5Constants.H5FD_FAMILY < 0) return; try { H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + assertTrue("H5Pget_driver: family = " + driver_type, HDF5Constants.H5FD_FAMILY == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -817,7 +931,7 @@ public class TestH5Pfapl { } try { long offset = H5.H5Pget_family_offset(fapl_id); - assertTrue("H5Pget_fapl_family: offset="+offset, offset==family_offset); + assertTrue("H5Pget_fapl_family: offset=" + offset, offset == family_offset); } catch (Throwable err) { err.printStackTrace(); @@ -827,13 +941,14 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_fapl_sec2() { + public void testH5Pset_fapl_sec2() + { if (HDF5Constants.H5FD_SEC2 < 0) return; try { H5.H5Pset_fapl_sec2(fapl_id); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: sec2 = "+ driver_type, HDF5Constants.H5FD_SEC2==driver_type); + assertTrue("H5Pget_driver: sec2 = " + driver_type, HDF5Constants.H5FD_SEC2 == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -844,13 +959,14 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_fapl_stdio() { + public void testH5Pset_fapl_stdio() + { if (HDF5Constants.H5FD_STDIO < 0) return; try { H5.H5Pset_fapl_stdio(fapl_id); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: stdio = "+ driver_type, HDF5Constants.H5FD_STDIO==driver_type); + assertTrue("H5Pget_driver: stdio = " + driver_type, HDF5Constants.H5FD_STDIO == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -861,14 +977,15 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_fapl_log() { + public void testH5Pset_fapl_log() + { if (HDF5Constants.H5FD_LOG < 0) return; try { long log_flags = HDF5Constants.H5FD_LOG_LOC_IO; H5.H5Pset_fapl_log(fapl_id, H5_LOG_FILE, log_flags, 1024); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: log = "+ driver_type, HDF5Constants.H5FD_LOG==driver_type); + assertTrue("H5Pget_driver: log = " + driver_type, HDF5Constants.H5FD_LOG == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -880,19 +997,20 @@ public class TestH5Pfapl { } @Test - public void testH5P_fapl_muti_nulls() { + public void testH5P_fapl_muti_nulls() + { if (HDF5Constants.H5FD_MULTI < 0) return; - int[] member_map = null; - long[] member_fapl = null; + int[] member_map = null; + long[] member_fapl = null; String[] member_name = null; - long[] member_addr = null; + long[] member_addr = null; try { H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -911,53 +1029,68 @@ public class TestH5Pfapl { } @Test - public void testH5P_fapl_muti_defaults() { + public void testH5P_fapl_muti_defaults() + { if (HDF5Constants.H5FD_MULTI < 0) return; int H5FD_MEM_NTYPES = HDF5Constants.H5FD_MEM_NTYPES; // 7 long sH5FD_MEM_DEFAULT_HADDR = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; - long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE; - long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE; - long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE; - long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE; - long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE; - long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE; - long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE; - int[] member_map = null; - long[] member_fapl = null; - String[] member_name = null; - long[] member_addr = null; + long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE; + long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE; + long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE; + long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE; + long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE; + long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE; + long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE; + int[] member_map = null; + long[] member_fapl = null; + String[] member_name = null; + long[] member_addr = null; try { H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_fapl_muti: " + err); } try { - member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; - member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; - member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; - member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); assertTrue("H5Pget_fapl_muti: relax ", relax); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT); - assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DEFAULT], member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5")==0); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5")==0); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5")==0); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_SUPER], member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_LHEAP], member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_OHDR], member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT], + member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT); + assertTrue("H5Pget_fapl_muti: member_fapl ", + H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], + HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DEFAULT], + member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER], + member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE], + member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW], + member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT], + member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_SUPER], + member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE], + member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW], + member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP], + member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_LHEAP], + member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_OHDR], + member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR); } catch (Throwable err) { err.printStackTrace(); @@ -969,20 +1102,21 @@ public class TestH5Pfapl { } @Test - public void testH5P_fapl_muti() { + public void testH5P_fapl_muti() + { if (HDF5Constants.H5FD_MULTI < 0) return; long HADDR_DEFAULT_SIZE = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; - int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; - String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; - for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt<HDF5Constants.H5FD_MEM_NTYPES; mt++) { + for (int mt = HDF5Constants.H5FD_MEM_DEFAULT; mt < HDF5Constants.H5FD_MEM_NTYPES; mt++) { member_fapl[mt] = HDF5Constants.H5P_DEFAULT; - member_map[mt] = HDF5Constants.H5FD_MEM_SUPER; + member_map[mt] = HDF5Constants.H5FD_MEM_SUPER; } - member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW; + member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW; member_map[HDF5Constants.H5FD_MEM_BTREE] = HDF5Constants.H5FD_MEM_BTREE; member_map[HDF5Constants.H5FD_MEM_GHEAP] = HDF5Constants.H5FD_MEM_GHEAP; @@ -990,18 +1124,18 @@ public class TestH5Pfapl { member_addr[HDF5Constants.H5FD_MEM_SUPER] = 0; member_name[HDF5Constants.H5FD_MEM_BTREE] = new String("%s-btree.h5"); - member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDR_DEFAULT_SIZE/4; + member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDR_DEFAULT_SIZE / 4; member_name[HDF5Constants.H5FD_MEM_DRAW] = new String("%s-draw.h5"); - member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDR_DEFAULT_SIZE/2; + member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDR_DEFAULT_SIZE / 2; member_name[HDF5Constants.H5FD_MEM_GHEAP] = new String("%s-gheap.h5"); - member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDR_DEFAULT_SIZE/4)*3; + member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDR_DEFAULT_SIZE / 4) * 3; try { H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -1010,23 +1144,37 @@ public class TestH5Pfapl { try { boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); assertTrue("H5Pget_fapl_muti: relax ", relax); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DRAW], member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_BTREE], member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_GHEAP], member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP); - - assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5")==0); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDR_DEFAULT_SIZE/4); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDR_DEFAULT_SIZE/2); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_GHEAP], member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDR_DEFAULT_SIZE/4)*3); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT], + member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DRAW], + member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_BTREE], + member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_GHEAP], + member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP); + + assertTrue("H5Pget_fapl_muti: member_fapl ", + H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], + HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT], + member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER], + member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5") == 0); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE], + member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE], + member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDR_DEFAULT_SIZE / 4); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW], + member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW], + member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDR_DEFAULT_SIZE / 2); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_GHEAP], + member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP], + member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDR_DEFAULT_SIZE / 4) * 3); } catch (Throwable err) { err.printStackTrace(); @@ -1035,7 +1183,8 @@ public class TestH5Pfapl { _createH5multiFile(fapl_id); try { long file_size = H5.H5Fget_filesize(H5fid); - assertTrue("H5Pget_fapl_muti: file_size ", file_size >= HADDR_DEFAULT_SIZE/4 || file_size <= HADDR_DEFAULT_SIZE/2); + assertTrue("H5Pget_fapl_muti: file_size ", + file_size >= HADDR_DEFAULT_SIZE / 4 || file_size <= HADDR_DEFAULT_SIZE / 2); } catch (Throwable err) { err.printStackTrace(); @@ -1043,67 +1192,71 @@ public class TestH5Pfapl { } _createH5multiFileDS(); deleteH5multifile(); - File file = new File(H5_MULTI_FILE+"-super.h5"); + File file = new File(H5_MULTI_FILE + "-super.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-btree.h5"); + file = new File(H5_MULTI_FILE + "-btree.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-draw.h5"); + file = new File(H5_MULTI_FILE + "-draw.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-gheap.h5"); + file = new File(H5_MULTI_FILE + "-gheap.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } } @Test - public void testH5P_fapl_split() { + public void testH5P_fapl_split() + { if (HDF5Constants.H5FD_MULTI < 0) return; try { - H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5", HDF5Constants.H5P_DEFAULT); + H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5", + HDF5Constants.H5P_DEFAULT); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: split = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + assertTrue("H5Pget_driver: split = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type); } catch (Throwable err) { err.printStackTrace(); fail("H5Pset_fapl_split: " + err); } try { - int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); assertTrue("H5Pget_fapl_multi: relax ", relax); - assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5")==0); - assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5")==0); + assertTrue("H5Pget_fapl_multi: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER], + member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5") == 0); + assertTrue("H5Pget_fapl_multi: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW], + member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -1111,34 +1264,35 @@ public class TestH5Pfapl { } _createH5multiFile(fapl_id); deleteH5multifile(); - File file = new File(H5_MULTI_FILE+"-meta.h5"); + File file = new File(H5_MULTI_FILE + "-meta.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-raw.h5"); + file = new File(H5_MULTI_FILE + "-raw.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } } @Test - public void testH5P_fapl_direct() { + public void testH5P_fapl_direct() + { if (HDF5Constants.H5FD_DIRECT < 0) return; try { - H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8*4096); + H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8 * 4096); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: direct = "+ driver_type, HDF5Constants.H5FD_DIRECT==driver_type); + assertTrue("H5Pget_driver: direct = " + driver_type, HDF5Constants.H5FD_DIRECT == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -1147,9 +1301,9 @@ public class TestH5Pfapl { try { long[] params = {-1, -1, -1}; H5.H5Pget_fapl_direct(fapl_id, params); - assertTrue("H5Pget_fapl_direct: alignment="+params[0], params[0]==1024); - assertTrue("H5Pget_fapl_direct: block_size="+params[1], params[1]==4096); - assertTrue("H5Pget_fapl_direct: cbuf_size="+params[2], params[2]==8*4096); + assertTrue("H5Pget_fapl_direct: alignment=" + params[0], params[0] == 1024); + assertTrue("H5Pget_fapl_direct: block_size=" + params[1], params[1] == 4096); + assertTrue("H5Pget_fapl_direct: cbuf_size=" + params[2], params[2] == 8 * 4096); } catch (Throwable err) { err.printStackTrace(); @@ -1160,13 +1314,14 @@ public class TestH5Pfapl { } @Test - public void testH5Pset_fapl_windows() { + public void testH5Pset_fapl_windows() + { if (HDF5Constants.H5FD_WINDOWS < 0) return; try { H5.H5Pset_fapl_windows(fapl_id); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: windows = "+ driver_type, HDF5Constants.H5FD_WINDOWS==driver_type); + assertTrue("H5Pget_driver: windows = " + driver_type, HDF5Constants.H5FD_WINDOWS == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -1177,19 +1332,20 @@ public class TestH5Pfapl { } @Test - public void testH5Pmulti_transform() { + public void testH5Pmulti_transform() + { if (HDF5Constants.H5FD_MULTI < 0) return; - String f_to_c = "(5/9.0)*(x-32)"; + String f_to_c = "(5/9.0)*(x-32)"; double windchillFread[][] = new double[DIMF_X][DIMF_Y]; double windchillC; NumberFormat formatter = new DecimalFormat("#0.000"); - long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; - int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; - long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; try { H5.H5Pset_data_transform(plist_id, f_to_c); @@ -1200,11 +1356,11 @@ public class TestH5Pfapl { fail("H5Pdata_transform: " + err); } - for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt<HDF5Constants.H5FD_MEM_NTYPES; mt++) { + for (int mt = HDF5Constants.H5FD_MEM_DEFAULT; mt < HDF5Constants.H5FD_MEM_NTYPES; mt++) { member_fapl[mt] = HDF5Constants.H5P_DEFAULT; - member_map[mt] = HDF5Constants.H5FD_MEM_SUPER; + member_map[mt] = HDF5Constants.H5FD_MEM_SUPER; } - member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW; + member_map[HDF5Constants.H5FD_MEM_DRAW] = HDF5Constants.H5FD_MEM_DRAW; member_map[HDF5Constants.H5FD_MEM_BTREE] = HDF5Constants.H5FD_MEM_BTREE; member_map[HDF5Constants.H5FD_MEM_GHEAP] = HDF5Constants.H5FD_MEM_GHEAP; @@ -1212,18 +1368,18 @@ public class TestH5Pfapl { member_addr[HDF5Constants.H5FD_MEM_SUPER] = 0; member_name[HDF5Constants.H5FD_MEM_BTREE] = new String("%s-btree.h5"); - member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDRMAX/4; + member_addr[HDF5Constants.H5FD_MEM_BTREE] = HADDRMAX / 4; member_name[HDF5Constants.H5FD_MEM_DRAW] = new String("%s-draw.h5"); - member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDRMAX/2; + member_addr[HDF5Constants.H5FD_MEM_DRAW] = HADDRMAX / 2; member_name[HDF5Constants.H5FD_MEM_GHEAP] = new String("%s-gheap.h5"); - member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDRMAX/4)*3; + member_addr[HDF5Constants.H5FD_MEM_GHEAP] = (HADDRMAX / 4) * 3; try { H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); long driver_type = H5.H5Pget_driver(fapl_id); - assertTrue("H5Pget_driver: multi = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + assertTrue("H5Pget_driver: multi = " + driver_type, HDF5Constants.H5FD_MULTI == driver_type); } catch (Throwable err) { err.printStackTrace(); @@ -1232,23 +1388,37 @@ public class TestH5Pfapl { try { boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); assertTrue("H5Pget_fapl_muti: relax ", relax); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DRAW], member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_BTREE], member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE); - assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_GHEAP], member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP); - - assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0); - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5")==0); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDRMAX/4); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDRMAX/2); - - assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_GHEAP], member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5")==0); - assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDRMAX/4)*3); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DEFAULT], + member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_SUPER); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_DRAW], + member_map[HDF5Constants.H5FD_MEM_DRAW] == HDF5Constants.H5FD_MEM_DRAW); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_BTREE], + member_map[HDF5Constants.H5FD_MEM_BTREE] == HDF5Constants.H5FD_MEM_BTREE); + assertTrue("H5Pget_fapl_muti: member_map=" + member_map[HDF5Constants.H5FD_MEM_GHEAP], + member_map[HDF5Constants.H5FD_MEM_GHEAP] == HDF5Constants.H5FD_MEM_GHEAP); + + assertTrue("H5Pget_fapl_muti: member_fapl ", + H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], + HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DEFAULT], + member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == 0); + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_SUPER], + member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-super.h5") == 0); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_BTREE], + member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-btree.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_BTREE], + member_addr[HDF5Constants.H5FD_MEM_BTREE] == HADDRMAX / 4); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_DRAW], + member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-draw.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_DRAW], + member_addr[HDF5Constants.H5FD_MEM_DRAW] == HADDRMAX / 2); + + assertTrue("H5Pget_fapl_muti: member_name=" + member_name[HDF5Constants.H5FD_MEM_GHEAP], + member_name[HDF5Constants.H5FD_MEM_GHEAP].compareTo("%s-gheap.h5") == 0); + assertTrue("H5Pget_fapl_muti: member_addr=" + member_addr[HDF5Constants.H5FD_MEM_GHEAP], + member_addr[HDF5Constants.H5FD_MEM_GHEAP] == (HADDRMAX / 4) * 3); } catch (Throwable err) { err.printStackTrace(); @@ -1257,7 +1427,8 @@ public class TestH5Pfapl { try { _createH5multiFile(fapl_id); long file_size = H5.H5Fget_filesize(H5fid); - assertTrue("H5Pget_fapl_muti: file_size ", file_size >= HADDRMAX/4 || file_size <= HADDRMAX/2); + assertTrue("H5Pget_fapl_muti: file_size ", + file_size >= HADDRMAX / 4 || file_size <= HADDRMAX / 2); _createH5multiFileDS(); _createFloatDataset(); } @@ -1267,68 +1438,70 @@ public class TestH5Pfapl { } try { H5.H5Dwrite(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - plist_id, windchillF); + plist_id, windchillF); H5.H5Dread(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, windchillFread); + HDF5Constants.H5P_DEFAULT, windchillFread); } catch (Throwable err) { err.printStackTrace(); fail("H5Pdata_transform: " + err); } - for(int row = 0; row < DIMF_X; row++) { - for(int col = 0; col < DIMF_Y; col++) { - windchillC = (5/9.0)*(windchillF[row][col]-32); - String Cstr = formatter.format(windchillC); + for (int row = 0; row < DIMF_X; row++) { + for (int col = 0; col < DIMF_Y; col++) { + windchillC = (5 / 9.0) * (windchillF[row][col] - 32); + String Cstr = formatter.format(windchillC); String Fread = formatter.format(windchillFread[row][col]); - assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + assertTrue("H5Pdata_transform: <" + row + "," + col + ">" + Fread + "=" + Cstr, + Fread.compareTo(Cstr) == 0); } } deleteH5multifile(); - File file = new File(H5_MULTI_FILE+"-super.h5"); + File file = new File(H5_MULTI_FILE + "-super.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-btree.h5"); + file = new File(H5_MULTI_FILE + "-btree.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-draw.h5"); + file = new File(H5_MULTI_FILE + "-draw.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } - file = new File(H5_MULTI_FILE+"-gheap.h5"); + file = new File(H5_MULTI_FILE + "-gheap.h5"); if (file.exists()) { try { file.delete(); } catch (SecurityException e) { - ;// e.printStackTrace(); + ; // e.printStackTrace(); } } } @Test - public void testH5Fmdc_logging() { + public void testH5Fmdc_logging() + { boolean[] mdc_logging_status = {false, false}; - boolean[] mdc_log_options = {false, false}; + boolean[] mdc_log_options = {false, false}; try { - boolean is_enabled = true; + boolean is_enabled = true; boolean start_on_access = false; H5.H5Pset_mdc_log_options(fapl_id, is_enabled, H5_LOG_FILE, start_on_access); @@ -1336,7 +1509,8 @@ public class TestH5Pfapl { assertTrue("H5.H5Pget_mdc_log_options: is_enabled", mdc_log_options[0]); assertFalse("H5.H5Pget_mdc_log_options: start_on_access_out", mdc_log_options[1]); - H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, + HDF5Constants.H5F_LIBVER_LATEST); } catch (Throwable err) { err.printStackTrace(); @@ -1370,7 +1544,7 @@ public class TestH5Pfapl { catch (Throwable err) { fail("stop H5.H5Fget_mdc_logging_status: " + err); } -// assertFalse("stop: is_enabled", mdc_logging_status[0]); + // assertFalse("stop: is_enabled", mdc_logging_status[0]); assertFalse("stop: is_currently_logging", mdc_logging_status[1]); deleteH5file(); @@ -1378,7 +1552,8 @@ public class TestH5Pfapl { } @Test - public void testH5P_evict_on_close() { + public void testH5P_evict_on_close() + { boolean ret_val_id = false; try { H5.H5Pset_evict_on_close(fapl_id, true); @@ -1399,20 +1574,21 @@ public class TestH5Pfapl { } @Test - public void testH5P_file_locking() { - boolean use_file_locking = false; + public void testH5P_file_locking() + { + boolean use_file_locking = false; boolean ignore_disabled_file_locking = false; try { // false values (usually not the default) H5.H5Pset_file_locking(fapl_id, false, false); - use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); assertFalse("H5P_file_locking", use_file_locking); assertFalse("H5P_file_locking", ignore_disabled_file_locking); // true values (typically the default) H5.H5Pset_file_locking(fapl_id, true, true); - use_file_locking = H5.H5Pget_use_file_locking(fapl_id); + use_file_locking = H5.H5Pget_use_file_locking(fapl_id); ignore_disabled_file_locking = H5.H5Pget_ignore_disabled_file_locking(fapl_id); assertTrue("H5P_file_locking", use_file_locking); assertTrue("H5P_file_locking", ignore_disabled_file_locking); diff --git a/java/test/TestH5Pfaplhdfs.java b/java/test/TestH5Pfaplhdfs.java index d922666..e99967b 100644 --- a/java/test/TestH5Pfaplhdfs.java +++ b/java/test/TestH5Pfaplhdfs.java @@ -31,12 +31,13 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Pfaplhdfs { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); - 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 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 @@ -62,9 +63,9 @@ public class TestH5Pfaplhdfs { } assertTrue(plapl_id > 0); try { - plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); - dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); } catch (Throwable err) { err.printStackTrace(); @@ -79,15 +80,35 @@ public class TestH5Pfaplhdfs { public void deleteFileAccess() throws HDF5LibraryException { if (fapl_id > 0) - try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(fapl_id); + } + catch (Exception ex) { + } if (plapl_id > 0) - try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plapl_id); + } + catch (Exception ex) { + } if (dapl_id > 0) - try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(dapl_id); + } + catch (Exception ex) { + } if (plist_id > 0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } if (btplist_id > 0) - try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(btplist_id); + } + catch (Exception ex) { + } System.out.println(); } @@ -97,19 +118,21 @@ public class TestH5Pfaplhdfs { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); - String nodename = "blues"; - int nodeport = 12345; - String username = "sparticus"; + String nodename = "blues"; + int nodeport = 12345; + String username = "sparticus"; String kerbcache = "/dev/null"; - int streamsize = 1024; + int streamsize = 1024; - final H5FD_hdfs_fapl_t config = new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize); + final H5FD_hdfs_fapl_t config = + new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize); assertTrue("setting fapl should succeed", -1 < H5.H5Pset_fapl_hdfs(fapl_id, config)); assertEquals("driver types should match", HDF5Constants.H5FD_HDFS, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t copy = H5.H5Pget_fapl_hdfs(fapl_id); - assertEquals("fapl contents should match", new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy); + assertEquals("fapl contents should match", + new H5FD_hdfs_fapl_t(nodename, nodeport, username, kerbcache, streamsize), copy); } @Test(expected = HDF5LibraryException.class) @@ -125,13 +148,12 @@ public class TestH5Pfaplhdfs { { if (HDF5Constants.H5FD_HDFS < 0) throw new HDF5LibraryException("skip"); - if (HDF5Constants.H5FD_SEC2 < 0 ) + if (HDF5Constants.H5FD_SEC2 < 0) throw new HDF5LibraryException("skip"); - /* TODO: for now, test against a sec2 fapl only */ + /* TODO: for now, test against a sec2 fapl only */ H5.H5Pset_fapl_sec2(fapl_id); assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_hdfs_fapl_t fails = H5.H5Pget_fapl_hdfs(fapl_id); } - } diff --git a/java/test/TestH5Pfapls3.java b/java/test/TestH5Pfapls3.java index dda2716..06baef2 100644 --- a/java/test/TestH5Pfapls3.java +++ b/java/test/TestH5Pfapls3.java @@ -31,12 +31,13 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Pfapls3 { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); - 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 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 @@ -62,9 +63,9 @@ public class TestH5Pfapls3 { } assertTrue(plapl_id > 0); try { - plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); - dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); } catch (Throwable err) { err.printStackTrace(); @@ -79,15 +80,35 @@ public class TestH5Pfapls3 { public void deleteFileAccess() throws HDF5LibraryException { if (fapl_id > 0) - try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(fapl_id); + } + catch (Exception ex) { + } if (plapl_id > 0) - try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plapl_id); + } + catch (Exception ex) { + } if (dapl_id > 0) - try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(dapl_id); + } + catch (Exception ex) { + } if (plist_id > 0) - try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_id); + } + catch (Exception ex) { + } if (btplist_id > 0) - try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + try { + H5.H5Pclose(btplist_id); + } + catch (Exception ex) { + } System.out.println(); } @@ -98,18 +119,15 @@ public class TestH5Pfapls3 { return; final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(); - assertEquals("Default fapl has unexpected contents", - new H5FD_ros3_fapl_t("", "", ""), config); + assertEquals("Default fapl has unexpected contents", new H5FD_ros3_fapl_t("", "", ""), config); H5.H5Pset_fapl_ros3(fapl_id, config); - assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); + assertEquals("driver types don't match", HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); /* get_fapl_ros3 can throw exception in error cases */ H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); - assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t("", "", ""), copy); + assertEquals("contents of fapl set and get don't match", new H5FD_ros3_fapl_t("", "", ""), copy); } @Test(expected = HDF5LibraryException.class) @@ -125,13 +143,12 @@ public class TestH5Pfapls3 { { if (HDF5Constants.H5FD_ROS3 < 0) throw new HDF5LibraryException("skip"); - if (HDF5Constants.H5FD_SEC2 < 0 ) + if (HDF5Constants.H5FD_SEC2 < 0) throw new HDF5LibraryException("skip"); - /* TODO: for now, test against a sec2 fapl only */ + /* TODO: for now, test against a sec2 fapl only */ H5.H5Pset_fapl_sec2(fapl_id); - assertEquals("fapl_id was not set properly", - HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); + assertEquals("fapl_id was not set properly", HDF5Constants.H5FD_SEC2, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t fails = H5.H5Pget_fapl_ros3(fapl_id); } @@ -147,12 +164,10 @@ public class TestH5Pfapls3 { final H5FD_ros3_fapl_t config = new H5FD_ros3_fapl_t(region, acc_id, acc_key); H5.H5Pset_fapl_ros3(fapl_id, config); - assertEquals("driver types don't match", - HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); + assertEquals("driver types don't match", HDF5Constants.H5FD_ROS3, H5.H5Pget_driver(fapl_id)); H5FD_ros3_fapl_t copy = H5.H5Pget_fapl_ros3(fapl_id); assertEquals("contents of fapl set and get don't match", - new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy); + new H5FD_ros3_fapl_t(region, acc_id, acc_key), copy); } - } diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index 03e1c8f..d8a429b 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -17,11 +17,11 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; -import java.util.ArrayList; import java.io.File; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.text.NumberFormat; -import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; @@ -32,15 +32,15 @@ import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t; import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb; import hdf.hdf5lib.callbacks.H5P_cls_create_func_t; -import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; -import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; import hdf.hdf5lib.callbacks.H5P_iterate_cb; import hdf.hdf5lib.callbacks.H5P_iterate_t; +import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; import hdf.hdf5lib.exceptions.HDF5Exception; import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.structs.H5AC_cache_config_t; @@ -52,7 +52,8 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Plist { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); // Property definitions private static final String CLASS1_NAME = "Class 1"; @@ -63,33 +64,31 @@ public class TestH5Plist { // Property definitions private static final String PROP1_NAME = "Property 1"; - private static final int prop1_def = 10; // Property 1 default value - private static final int PROP1_SIZE = 2; + private static final int prop1_def = 10; // Property 1 default value + private static final int PROP1_SIZE = 2; private static final String PROP2_NAME = "Property 2"; - private static final float prop2_def = 3.14F; // Property 2 default value - private static final int PROP2_SIZE = 8; + private static final float prop2_def = 3.14F; // Property 2 default value + private static final int PROP2_SIZE = 8; - private static final String PROP3_NAME = "Property 3"; - private static final char[] prop3_def = {'T','e','n',' ','c','h','a','r','s',' '}; // Property 3 default value - private static final int PROP3_SIZE = 10; + private static final String PROP3_NAME = "Property 3"; + private static final char[] prop3_def = {'T', 'e', 'n', ' ', 'c', + 'h', 'a', 'r', 's', ' '}; // Property 3 default value + private static final int PROP3_SIZE = 10; - private static final String PROP4_NAME = "Property 4"; - private static final double prop4_def = 1.41F; // Property 4 default value - private static final int PROP4_SIZE = 8; + private static final String PROP4_NAME = "Property 4"; + private static final double prop4_def = 1.41F; // Property 4 default value + private static final int PROP4_SIZE = 8; - private static final String [] pnames = { // Names of properties for iterator - PROP1_NAME, - PROP2_NAME, - PROP3_NAME, - PROP4_NAME}; + private static final String[] pnames = { // Names of properties for iterator + PROP1_NAME, PROP2_NAME, PROP3_NAME, PROP4_NAME}; long plist_class_id = HDF5Constants.H5I_INVALID_HID; @Before - public void createPropClass()throws NullPointerException, HDF5Exception + public void createPropClass() throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); // Create a new generic class, derived from the root of the class hierarchy try { @@ -103,20 +102,26 @@ public class TestH5Plist { } @After - public void deleteFileAccess() throws HDF5LibraryException { + public void deleteFileAccess() throws HDF5LibraryException + { if (plist_class_id > 0) - try {H5.H5Pclose(plist_class_id);} catch (Exception ex) {} + try { + H5.H5Pclose(plist_class_id); + } + catch (Exception ex) { + } System.out.println(); } // Test basic generic property list code. Tests creating new generic classes. @Test - public void testH5P_genprop_basic_class() { - int status = -1; - 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 + public void testH5P_genprop_basic_class() + { + int status = -1; + 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 { // Check class name @@ -127,7 +132,8 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_class_name plist_class_id: " + err); } - assertTrue("Class names don't match!, "+name+"="+CLASS1_NAME+"\n", name.compareTo(CLASS1_NAME)==0); + assertTrue("Class names don't match!, " + name + "=" + CLASS1_NAME + "\n", + name.compareTo(CLASS1_NAME) == 0); // Check class parent try { @@ -196,7 +202,8 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_class_name cid1: " + err); } - assertTrue("Class names don't match!, "+name+"="+CLASS2_NAME+"\n", name.compareTo(CLASS2_NAME)==0); + assertTrue("Class names don't match!, " + name + "=" + CLASS2_NAME + "\n", + name.compareTo(CLASS2_NAME) == 0); // Check class parent try { @@ -270,20 +277,33 @@ public class TestH5Plist { } finally { if (cid3 > 0) - try {H5.H5Pclose_class(cid3);} catch (Throwable err) {} + try { + H5.H5Pclose_class(cid3); + } + catch (Throwable err) { + } if (cid2 > 0) - try {H5.H5Pclose_class(cid2);} catch (Throwable err) {} + try { + H5.H5Pclose_class(cid2); + } + catch (Throwable err) { + } if (cid1 > 0) - try {H5.H5Pclose_class(cid1);} catch (Throwable err) {} + try { + H5.H5Pclose_class(cid1); + } + catch (Throwable err) { + } } } // Test basic generic property list code. Tests adding properties to generic classes. @Test - public void testH5P_genprop_basic_class_prop() { - boolean status = false; - long size = -1; // Generic Property size - long nprops = -1; // Generic Property class number + public void testH5P_genprop_basic_class_prop() + { + boolean status = false; + long size = -1; // Generic Property size + long nprops = -1; // Generic Property class number // Check the number of properties in class try { @@ -293,7 +313,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==0); + assertTrue("H5Pget_nprops: " + nprops, nprops == 0); // Check the existence of the first property (should fail) try { @@ -303,7 +323,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertFalse("H5Pexist plist_class_id "+PROP1_NAME, status); + assertFalse("H5Pexist plist_class_id " + PROP1_NAME, status); // Insert first property into class (with no callbacks) try { @@ -313,7 +333,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err); } // Try to insert the first property again (should fail) @@ -321,7 +341,7 @@ public class TestH5Plist { byte[] prop_value = HDFNativeData.intToByte(prop1_def); H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value); - fail("H5Pregister2 plist_class_id: "+PROP1_NAME); + fail("H5Pregister2 plist_class_id: " + PROP1_NAME); } catch (Throwable err) { } @@ -334,7 +354,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status); + assertTrue("H5Pexist plist_class_id " + PROP1_NAME, status); // Check the size of the first property try { @@ -344,7 +364,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_size PROP1_NAME: " + err); } - assertTrue("H5Pget_size "+PROP1_NAME +" size: "+size, size == PROP1_SIZE); + assertTrue("H5Pget_size " + PROP1_NAME + " size: " + size, size == PROP1_SIZE); // Check the number of properties in class try { @@ -354,7 +374,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==1); + assertTrue("H5Pget_nprops: " + nprops, nprops == 1); // Insert second property into class (with no callbacks) try { @@ -364,7 +384,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err); } // Try to insert the second property again (should fail) @@ -372,7 +392,7 @@ public class TestH5Plist { byte[] prop_value = HDFNativeData.floatToByte(prop2_def); H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value); - fail("H5Pregister2 plist_class_id: "+PROP2_NAME); + fail("H5Pregister2 plist_class_id: " + PROP2_NAME); } catch (Throwable err) { } @@ -385,7 +405,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status); + assertTrue("H5Pexist plist_class_id " + PROP2_NAME, status); // Check the size of the second property try { @@ -395,7 +415,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_size PROP2_NAME: " + err); } - assertTrue("H5Pget_size "+PROP2_NAME +" size: "+size, size == PROP2_SIZE); + assertTrue("H5Pget_size " + PROP2_NAME + " size: " + size, size == PROP2_SIZE); // Check the number of properties in class try { @@ -405,7 +425,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==2); + assertTrue("H5Pget_nprops: " + nprops, nprops == 2); // Insert third property into class (with no callbacks) try { @@ -415,7 +435,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP3_NAME + err); } // Check the existence of the third property @@ -426,7 +446,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status); + assertTrue("H5Pexist plist_class_id " + PROP3_NAME, status); // Check the size of the third property try { @@ -436,7 +456,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_size PROP3_NAME: " + err); } - assertTrue("H5Pget_size "+PROP3_NAME +" size: "+size, size == PROP3_SIZE); + assertTrue("H5Pget_size " + PROP3_NAME + " size: " + size, size == PROP3_SIZE); // Check the number of properties in class try { @@ -446,7 +466,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==3); + assertTrue("H5Pget_nprops: " + nprops, nprops == 3); // Unregister first property try { @@ -454,7 +474,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Punregister plist_class_id: "+PROP1_NAME + err); + fail("H5Punregister plist_class_id: " + PROP1_NAME + err); } // Try to check the size of the first property (should fail) @@ -473,7 +493,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==2); + assertTrue("H5Pget_nprops: " + nprops, nprops == 2); // Unregister second property try { @@ -481,7 +501,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Punregister plist_class_id: "+PROP2_NAME + err); + fail("H5Punregister plist_class_id: " + PROP2_NAME + err); } // Check the number of properties in class @@ -492,7 +512,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==1); + assertTrue("H5Pget_nprops: " + nprops, nprops == 1); // Unregister third property try { @@ -500,7 +520,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Punregister plist_class_id: "+PROP3_NAME + err); + fail("H5Punregister plist_class_id: " + PROP3_NAME + err); } // Check the number of properties in class @@ -511,16 +531,18 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==0); + assertTrue("H5Pget_nprops: " + nprops, nprops == 0); } // Test basic generic property list code. Tests iterating over properties in a generic class. @Test - public void testH5P_genprop_class_iter() { + public void testH5P_genprop_class_iter() + { class idata { - public String[] iter_names= null; - public int iter_count = -1; - idata(String[] names, int count) { + public String[] iter_names = null; + public int iter_count = -1; + idata(String[] names, int count) + { this.iter_names = names; this.iter_count = count; } @@ -531,16 +553,17 @@ public class TestH5Plist { H5P_iterate_t iter_data = new H5P_iter_data(); class H5P_iter_callback implements H5P_iterate_cb { - public int callback(long list_id, String name, H5P_iterate_t op_data) { + public int callback(long list_id, String name, H5P_iterate_t op_data) + { idata id = ((H5P_iter_data)op_data).iterdata.get(0); return name.compareTo(id.iter_names[id.iter_count++]); } } H5P_iterate_cb iter_cb = new H5P_iter_callback(); - long size = -1; // Generic Property size - long nprops = -1; // Generic Property class number - int[] idx = {0}; // Index to start iteration at + long size = -1; // Generic Property size + long nprops = -1; // Generic Property class number + int[] idx = {0}; // Index to start iteration at // Insert first property into class (with no callbacks) */ try { @@ -550,7 +573,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err); } // Insert second property into class (with no callbacks) */ @@ -561,7 +584,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err); } // Insert third property into class (with no callbacks) */ @@ -572,7 +595,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP3_NAME + err); } // Insert fourth property into class (with no callbacks) */ @@ -583,7 +606,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP4_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP4_NAME + err); } // Check the number of properties in class */ @@ -594,7 +617,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops plist_class_id: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==4); + assertTrue("H5Pget_nprops: " + nprops, nprops == 4); // Iterate over all properties in class */ idata id = new idata(pnames, 0); @@ -606,12 +629,14 @@ public class TestH5Plist { err.printStackTrace(); fail("H5.H5Piterate: " + err); } - assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1); - assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4); + assertFalse("H5Piterate ", ((H5P_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Piterate " + ((H5P_iter_data)iter_data).iterdata.size(), + ((H5P_iter_data)iter_data).iterdata.size() == 1); + assertTrue("H5Piterate " + (((H5P_iter_data)iter_data).iterdata.get(0)).iter_count, + ((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count == 4); // Iterate over last three properties in class */ - idx[0] = 1; + idx[0] = 1; ((H5P_iter_data)iter_data).iterdata.get(0).iter_count = 1; try { H5.H5Piterate(plist_class_id, idx, iter_cb, iter_data); @@ -620,21 +645,24 @@ public class TestH5Plist { err.printStackTrace(); fail("H5.H5Piterate: " + err); } - assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty()); - assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1); - assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4); + assertFalse("H5Piterate ", ((H5P_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Piterate " + ((H5P_iter_data)iter_data).iterdata.size(), + ((H5P_iter_data)iter_data).iterdata.size() == 1); + assertTrue("H5Piterate " + (((H5P_iter_data)iter_data).iterdata.get(0)).iter_count, + ((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count == 4); - assertTrue("H5Piterate: "+nprops+"="+idx[0], nprops == idx[0]); + assertTrue("H5Piterate: " + nprops + "=" + idx[0], nprops == idx[0]); } // Test basic generic property list code. // Tests creating new generic property lists and adding and // removing properties from them. @Test - public void testH5P_genprop_basic_list_prop() { - boolean status = false; - long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID - long nprops = -1; // Number of properties in class + public void testH5P_genprop_basic_list_prop() + { + boolean status = false; + long lid1 = HDF5Constants.H5I_INVALID_HID; // Generic Property list ID + long nprops = -1; // Number of properties in class try { // Add several properties (several w/default values) @@ -647,7 +675,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP1_NAME + err); } // Insert second property into class (with no callbacks) @@ -658,7 +686,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + fail("H5Pregister2 plist_class_id: " + PROP2_NAME + err); } // Create a property list from the class @@ -678,7 +706,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops lid1: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==2); + assertTrue("H5Pget_nprops: " + nprops, nprops == 2); // Add temporary properties @@ -690,7 +718,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pinsertr2 lid1: "+PROP3_NAME + err); + fail("H5Pinsertr2 lid1: " + PROP3_NAME + err); } // Insert second temporary property into list (with no callbacks) @@ -701,7 +729,7 @@ public class TestH5Plist { } catch (Throwable err) { err.printStackTrace(); - fail("H5Pinsert2 lid1: "+PROP4_NAME + err); + fail("H5Pinsert2 lid1: " + PROP4_NAME + err); } // Check the number of properties in class @@ -712,7 +740,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pget_nprops lid1: " + err); } - assertTrue("H5Pget_nprops: "+nprops, nprops==4); + assertTrue("H5Pget_nprops: " + nprops, nprops == 4); // Check existence of all properties try { @@ -722,7 +750,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP1_NAME, status); + assertTrue("H5Pexist lid1 " + PROP1_NAME, status); try { status = H5.H5Pexist(lid1, PROP2_NAME); } @@ -730,7 +758,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP2_NAME, status); + assertTrue("H5Pexist lid1 " + PROP2_NAME, status); try { status = H5.H5Pexist(lid1, PROP3_NAME); } @@ -738,7 +766,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP3_NAME, status); + assertTrue("H5Pexist lid1 " + PROP3_NAME, status); try { status = H5.H5Pexist(lid1, PROP4_NAME); } @@ -746,265 +774,279 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP4_NAME, status); - + assertTrue("H5Pexist lid1 " + PROP4_NAME, status); } finally { if (lid1 > 0) - try {H5.H5Pclose(lid1);} catch (Throwable err) {} + try { + H5.H5Pclose(lid1); + } + catch (Throwable err) { + } } } -// // Test basic generic property list code. Tests callbacks for property lists in a generic class. -// @Test -// public void testH5P_genprop_class_callback() { -// class cdata { -// public long cls_id = HDF5Constants.H5I_INVALID_HID; -// public int cls_count = -1; -// cdata(long id, int count) { -// this.cls_id = id; -// this.cls_count = count; -// } -// } -// class H5P_cls_create_data implements H5P_cls_create_func_t { -// public ArrayList<cdata> clsdata = new ArrayList<cdata>(); -// } -// H5P_cls_create_func_t cls_create_data = new H5P_cls_create_data(); -// -// class H5P_cls_create_callback implements H5P_cls_create_func_cb { -// public int callback(long list_id, H5P_cls_create_func_t cls_data) { -// System.err.println("H5P_cls_create_callback enter"); -// cdata cd = ((H5P_cls_create_data)cls_create_data).clsdata.get(0); -// cd.cls_count++; -// cd.cls_id = list_id; -// return 0; -// } -// } -// H5P_cls_create_func_cb cls_create_cb = new H5P_cls_create_callback(); -// -// class H5P_cls_copy_data implements H5P_cls_copy_func_t { -// public ArrayList<cdata> clsdata = new ArrayList<cdata>(); -// } -// H5P_cls_copy_func_t cls_copy_data = new H5P_cls_copy_data(); -// -// class H5P_cls_copy_callback implements H5P_cls_copy_func_cb { -// public int callback(long list_id1, long list_id2, H5P_cls_copy_func_t cls_data) { -// cdata cd = ((H5P_cls_copy_data)cls_copy_data).clsdata.get(0); -// cd.cls_count++; -// cd.cls_id = list_id1; -// return 0; -// } -// } -// H5P_cls_copy_func_cb cls_copy_cb = new H5P_cls_copy_callback(); -// -// class H5P_cls_close_data implements H5P_cls_close_func_t { -// public ArrayList<cdata> clsdata = new ArrayList<cdata>(); -// } -// H5P_cls_close_func_t cls_close_data = new H5P_cls_close_data(); -// -// class H5P_cls_close_callback implements H5P_cls_close_func_cb { -// public int callback(long list_id, H5P_cls_close_func_t cls_data) { -// cdata cd = ((H5P_cls_close_data)cls_close_data).clsdata.get(0); -// cd.cls_count++; -// cd.cls_id = list_id; -// return 0; -// } -// } -// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback(); -// -// 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 { -// // Create a new generic class, derived from the root of the class hierarchy -// try { -// cid1 = H5.H5Pcreate_class(HDF5Constants.H5P_ROOT, CLASS1_NAME, cls_create_cb, cls_create_data, cls_copy_cb, cls_copy_data, cls_close_cb, cls_close_data); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pcreate_class cid1: " + err); -// } -// assertTrue("H5Pcreate_class cid1", cid1 >= 0); -// -// // Insert first property into class (with no callbacks) -// try { -// byte[] prop_value = HDFNativeData.intToByte(prop1_def); -// -// H5.H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, prop_value, null, null, null, null, null, null, null); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pregister2 cid1: "+PROP1_NAME + err); -// } -// -// // Insert second property into class (with no callbacks) -// try { -// byte[] prop_value = HDFNativeData.floatToByte(prop2_def); -// -// H5.H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, prop_value, null, null, null, null, null, null, null); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pregister2 cid1: "+PROP2_NAME + err); -// } -// -// // Insert third property into class (with no callbacks) -// try { -// byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); -// -// H5.H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, prop_value, null, null, null, null, null, null, null); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pregister2 cid1: "+PROP3_NAME + err); -// } -// -// // Check the number of properties in class -// try { -// nprops = H5.H5Pget_nprops(cid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pget_nprops cid1: " + err); -// } -// assertTrue("H5Pget_nprops: "+nprops, nprops==3); -// -// // Initialize class callback structs -// cdata create_id = new cdata(-1, 0); -// cdata copy_id = new cdata(-1, 0); -// cdata close_id = new cdata(-1, 0); -// ((H5P_cls_create_data)cls_create_data).clsdata.add(create_id); -// ((H5P_cls_copy_data)cls_copy_data).clsdata.add(copy_id); -// ((H5P_cls_close_data)cls_close_data).clsdata.add(close_id); -// -// // Create a property list from the class -// try { -// lid1 = H5.H5Pcreate(cid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pcreate lid1: " + err); -// } -// -// // Verify that the creation callback occurred -// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); -// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid1); -// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==1); -// -// // Check the number of properties in list -// try { -// nprops = H5.H5Pget_nprops(lid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pget_nprops lid1: " + err); -// } -// assertTrue("H5Pget_nprops: "+nprops, nprops==3); -// -// // Create another property list from the class -// try { -// lid2 = H5.H5Pcreate(cid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pcreate lid2: " + err); -// } -// -// /* Verify that the creation callback occurred */ -// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); -// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid2); -// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==2); -// -// // Check the number of properties in list -// try { -// nprops = H5.H5Pget_nprops(lid2); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pget_nprops lid2: " + err); -// } -// assertTrue("H5Pget_nprops: "+nprops, nprops==3); -// -// // Create another property list by copying an existing list -// try { -// lid3= H5.H5Pcopy(lid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pcopy lid3: " + err); -// } -// -// // Verify that the copy callback occurred -// assertFalse("H5Pcopy ",((H5P_cls_copy_data)cls_copy_data).clsdata.isEmpty()); -// assertTrue("H5Pcopy "+((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id ,((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id == lid3); -// assertTrue("H5Pcopy "+(((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count==1); -// -// // Check the number of properties in list -// try { -// nprops = H5.H5Pget_nprops(lid3); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pget_nprops lid3: " + err); -// } -// assertTrue("H5Pget_nprops: "+nprops, nprops==3); -// -// // Close first list -// try { -// H5.H5Pclose(lid1); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pclose lid1: " + err); -// } -// -// /* Verify that the close callback occurred */ -// assertFalse("H5Pclose ",((H5P_cls_close_data)cls_close_data).clsdata.isEmpty()); -// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_copy_data).clsdata.get(0).cls_id == lid1); -// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_copy_data).clsdata.get(0)).cls_count==1); -// -// // Close second list -// try { -// H5.H5Pclose(lid2); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pclose lid2: " + err); -// } -// -// // Verify that the close callback occurred -// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid2); -// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==2); -// -// // Close third list -// try { -// H5.H5Pclose(lid3); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("H5Pclose lid3: " + err); -// } -// -// // Verify that the close callback occurred -// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid3); -// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==3); -// } -// finally { -// if (lid3 > 0) -// try {H5.H5Pclose(lid3);} catch (Throwable err) {} -// if (lid2 > 0) -// try {H5.H5Pclose(lid2);} catch (Throwable err) {} -// if (lid1 > 0) -// try {H5.H5Pclose(lid1);} catch (Throwable err) {} -// if (cid2 > 0) -// try {H5.H5Pclose_class(cid2);} catch (Throwable err) {} -// if (cid1 > 0) -// try {H5.H5Pclose_class(cid1);} catch (Throwable err) {} -// } -// } - + // // Test basic generic property list code. Tests callbacks for property lists in a generic class. + // @Test + // public void testH5P_genprop_class_callback() { + // class cdata { + // public long cls_id = HDF5Constants.H5I_INVALID_HID; + // public int cls_count = -1; + // cdata(long id, int count) { + // this.cls_id = id; + // this.cls_count = count; + // } + // } + // class H5P_cls_create_data implements H5P_cls_create_func_t { + // public ArrayList<cdata> clsdata = new ArrayList<cdata>(); + // } + // H5P_cls_create_func_t cls_create_data = new H5P_cls_create_data(); + // + // class H5P_cls_create_callback implements H5P_cls_create_func_cb { + // public int callback(long list_id, H5P_cls_create_func_t cls_data) { + // System.err.println("H5P_cls_create_callback enter"); + // cdata cd = ((H5P_cls_create_data)cls_create_data).clsdata.get(0); + // cd.cls_count++; + // cd.cls_id = list_id; + // return 0; + // } + // } + // H5P_cls_create_func_cb cls_create_cb = new H5P_cls_create_callback(); + // + // class H5P_cls_copy_data implements H5P_cls_copy_func_t { + // public ArrayList<cdata> clsdata = new ArrayList<cdata>(); + // } + // H5P_cls_copy_func_t cls_copy_data = new H5P_cls_copy_data(); + // + // class H5P_cls_copy_callback implements H5P_cls_copy_func_cb { + // public int callback(long list_id1, long list_id2, H5P_cls_copy_func_t cls_data) { + // cdata cd = ((H5P_cls_copy_data)cls_copy_data).clsdata.get(0); + // cd.cls_count++; + // cd.cls_id = list_id1; + // return 0; + // } + // } + // H5P_cls_copy_func_cb cls_copy_cb = new H5P_cls_copy_callback(); + // + // class H5P_cls_close_data implements H5P_cls_close_func_t { + // public ArrayList<cdata> clsdata = new ArrayList<cdata>(); + // } + // H5P_cls_close_func_t cls_close_data = new H5P_cls_close_data(); + // + // class H5P_cls_close_callback implements H5P_cls_close_func_cb { + // public int callback(long list_id, H5P_cls_close_func_t cls_data) { + // cdata cd = ((H5P_cls_close_data)cls_close_data).clsdata.get(0); + // cd.cls_count++; + // cd.cls_id = list_id; + // return 0; + // } + // } + // H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback(); + // + // 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 { + // // Create a new generic class, derived from the root of the class hierarchy + // try { + // cid1 = H5.H5Pcreate_class(HDF5Constants.H5P_ROOT, CLASS1_NAME, cls_create_cb, + // cls_create_data, cls_copy_cb, cls_copy_data, cls_close_cb, cls_close_data); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pcreate_class cid1: " + err); + // } + // assertTrue("H5Pcreate_class cid1", cid1 >= 0); + // + // // Insert first property into class (with no callbacks) + // try { + // byte[] prop_value = HDFNativeData.intToByte(prop1_def); + // + // H5.H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, prop_value, null, null, null, null, null, + // null, null); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pregister2 cid1: "+PROP1_NAME + err); + // } + // + // // Insert second property into class (with no callbacks) + // try { + // byte[] prop_value = HDFNativeData.floatToByte(prop2_def); + // + // H5.H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, prop_value, null, null, null, null, null, + // null, null); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pregister2 cid1: "+PROP2_NAME + err); + // } + // + // // Insert third property into class (with no callbacks) + // try { + // byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); + // + // H5.H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, prop_value, null, null, null, null, null, + // null, null); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pregister2 cid1: "+PROP3_NAME + err); + // } + // + // // Check the number of properties in class + // try { + // nprops = H5.H5Pget_nprops(cid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pget_nprops cid1: " + err); + // } + // assertTrue("H5Pget_nprops: "+nprops, nprops==3); + // + // // Initialize class callback structs + // cdata create_id = new cdata(-1, 0); + // cdata copy_id = new cdata(-1, 0); + // cdata close_id = new cdata(-1, 0); + // ((H5P_cls_create_data)cls_create_data).clsdata.add(create_id); + // ((H5P_cls_copy_data)cls_copy_data).clsdata.add(copy_id); + // ((H5P_cls_close_data)cls_close_data).clsdata.add(close_id); + // + // // Create a property list from the class + // try { + // lid1 = H5.H5Pcreate(cid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pcreate lid1: " + err); + // } + // + // // Verify that the creation callback occurred + // assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); + // assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id + // ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid1); + // assertTrue("H5Pcreate + // "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==1); + // + // // Check the number of properties in list + // try { + // nprops = H5.H5Pget_nprops(lid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pget_nprops lid1: " + err); + // } + // assertTrue("H5Pget_nprops: "+nprops, nprops==3); + // + // // Create another property list from the class + // try { + // lid2 = H5.H5Pcreate(cid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pcreate lid2: " + err); + // } + // + // /* Verify that the creation callback occurred */ + // assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); + // assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id + // ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid2); + // assertTrue("H5Pcreate + // "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==2); + // + // // Check the number of properties in list + // try { + // nprops = H5.H5Pget_nprops(lid2); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pget_nprops lid2: " + err); + // } + // assertTrue("H5Pget_nprops: "+nprops, nprops==3); + // + // // Create another property list by copying an existing list + // try { + // lid3= H5.H5Pcopy(lid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pcopy lid3: " + err); + // } + // + // // Verify that the copy callback occurred + // assertFalse("H5Pcopy ",((H5P_cls_copy_data)cls_copy_data).clsdata.isEmpty()); + // assertTrue("H5Pcopy "+((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id + // ,((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id == lid3); assertTrue("H5Pcopy + // "+(((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count==1); + // + // // Check the number of properties in list + // try { + // nprops = H5.H5Pget_nprops(lid3); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pget_nprops lid3: " + err); + // } + // assertTrue("H5Pget_nprops: "+nprops, nprops==3); + // + // // Close first list + // try { + // H5.H5Pclose(lid1); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pclose lid1: " + err); + // } + // + // /* Verify that the close callback occurred */ + // assertFalse("H5Pclose ",((H5P_cls_close_data)cls_close_data).clsdata.isEmpty()); + // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id + // ,((H5P_cls_close_data)cls_copy_data).clsdata.get(0).cls_id == lid1); assertTrue("H5Pclose + // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_copy_data).clsdata.get(0)).cls_count==1); + // + // // Close second list + // try { + // H5.H5Pclose(lid2); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pclose lid2: " + err); + // } + // + // // Verify that the close callback occurred + // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id + // ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid2); assertTrue("H5Pclose + // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==2); + // + // // Close third list + // try { + // H5.H5Pclose(lid3); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("H5Pclose lid3: " + err); + // } + // + // // Verify that the close callback occurred + // assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id + // ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid3); assertTrue("H5Pclose + // "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==3); + // } + // finally { + // if (lid3 > 0) + // try {H5.H5Pclose(lid3);} catch (Throwable err) {} + // if (lid2 > 0) + // try {H5.H5Pclose(lid2);} catch (Throwable err) {} + // if (lid1 > 0) + // try {H5.H5Pclose(lid1);} catch (Throwable err) {} + // if (cid2 > 0) + // try {H5.H5Pclose_class(cid2);} catch (Throwable err) {} + // if (cid1 > 0) + // try {H5.H5Pclose_class(cid1);} catch (Throwable err) {} + // } + // } } diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java index 0478356..41ae6d1 100644 --- a/java/test/TestH5Pvirtual.java +++ b/java/test/TestH5Pvirtual.java @@ -32,48 +32,47 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Pvirtual { - @Rule public TestName testname = new TestName(); - - private static final String H5_FILE = "vds.h5"; - private static final String SRC_FILE[] = { - "v-0.h5", - "v-1.h5", - "v-2.h5" - }; - private static final String SRC_DATASET[] = { - "A", - "B", - "C" - }; - private static final int DIM_Y = 6; - private static final int VDSDIM_X = 4; - private static final int VDSDIM_Y = 6; - private static final int fill_value = -1; - long[] H5dims = { DIM_Y }; - long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y }; - 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) { + @Rule + public TestName testname = new TestName(); + + private static final String H5_FILE = "vds.h5"; + private static final String SRC_FILE[] = {"v-0.h5", "v-1.h5", "v-2.h5"}; + private static final String SRC_DATASET[] = {"A", "B", "C"}; + private static final int DIM_Y = 6; + private static final int VDSDIM_X = 4; + private static final int VDSDIM_Y = 6; + private static final int fill_value = -1; + long[] H5dims = {DIM_Y}; + long[] VDSH5dims = {VDSDIM_X, VDSDIM_Y}; + 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); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } - private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { - long did = HDF5Constants.H5I_INVALID_HID; + private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) + { + long did = HDF5Constants.H5I_INVALID_HID; long space_id = HDF5Constants.H5I_INVALID_HID; - long[] start = {0, 0}; + long[] start = {0, 0}; long[] stride = null; - long[] count = {1, 1}; - long[] block = {1, VDSDIM_Y}; + long[] count = {1, 1}; + long[] block = {1, VDSDIM_Y}; try { H5dssid = H5.H5Screate_simple(1, H5dims, null); @@ -83,8 +82,8 @@ public class TestH5Pvirtual { H5.H5Sselect_hyperslab(dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); H5.H5Pset_virtual(dcpl, dsid, SRC_FILE[i], SRC_DATASET[i], H5dssid); } - did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_INT, dsid, - HDF5Constants.H5P_DEFAULT, dcpl, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_INT, dsid, HDF5Constants.H5P_DEFAULT, dcpl, + dapl); } catch (Throwable err) { err.printStackTrace(); @@ -95,23 +94,26 @@ public class TestH5Pvirtual { return did; } - private final void _createH5File(long fcpl, long fapl) { + private final void _createH5File(long fcpl, long fapl) + { int[] dset_data = new int[DIM_Y]; // Create source files and datasets - for (int i=0; i < 3; i++) { + for (int i = 0; i < 3; i++) { 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; + 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 { - file_id = H5.H5Fcreate(SRC_FILE[i], HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + file_id = H5.H5Fcreate(SRC_FILE[i], HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); space_id = H5.H5Screate_simple(1, H5dims, null); - dset_id = H5.H5Dcreate(file_id, SRC_DATASET[i], HDF5Constants.H5T_NATIVE_INT, space_id, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5.H5Dwrite (dset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, - dset_data); + dset_id = H5.H5Dcreate(file_id, SRC_DATASET[i], HDF5Constants.H5T_NATIVE_INT, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5.H5Dwrite(dset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); } catch (Throwable err) { err.printStackTrace(); @@ -119,19 +121,32 @@ public class TestH5Pvirtual { } finally { if (dset_id > 0) - try {H5.H5Dclose(dset_id);} catch (Exception ex) {} + try { + H5.H5Dclose(dset_id); + } + catch (Exception ex) { + } if (space_id > 0) - try {H5.H5Sclose(space_id);} catch (Exception ex) {} + try { + H5.H5Sclose(space_id); + } + catch (Exception ex) { + } if (file_id > 0) - try {H5.H5Fclose(file_id);} catch (Exception ex) {} + try { + H5.H5Fclose(file_id); + } + catch (Exception ex) { + } } } try { int[] fill_value = {-1}; - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - H5dsid = H5.H5Screate_simple(2, VDSH5dims, null); - H5dcplid = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, VDSH5dims, null); + H5dcplid = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); H5.H5Pset_fill_value(H5dcplid, HDF5Constants.H5T_NATIVE_INT, fill_value); } catch (Throwable err) { @@ -151,25 +166,42 @@ public class TestH5Pvirtual { } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); _createH5File(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); H5dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); assertTrue("TestH5Pvirtual.createH5file: H5.H5Pcreate: ", H5dapl_id > 0); - } + } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dapl_id > 0) - try {H5.H5Pclose(H5dapl_id);} catch (Exception ex) {} + try { + H5.H5Pclose(H5dapl_id); + } + catch (Exception ex) { + } if (H5dcplid > 0) - try {H5.H5Pclose(H5dcplid);} catch (Exception ex) {} + try { + H5.H5Pclose(H5dcplid); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } for (int i = 0; i < 3; i++) { _deleteFile(SRC_FILE[i]); } @@ -178,12 +210,13 @@ public class TestH5Pvirtual { } @Test - public void testH5Pvirtual_storage() { + public void testH5Pvirtual_storage() + { int layout = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { - layout = H5.H5Pget_layout (H5dcplid); + layout = H5.H5Pget_layout(H5dcplid); } catch (Throwable err) { err.printStackTrace(); @@ -191,15 +224,24 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } assertTrue("testH5Pvirtual_storage", HDF5Constants.H5D_VIRTUAL == layout); } @Test - public void testH5Pget_virtual_count() { + public void testH5Pget_virtual_count() + { long num_map = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); @@ -212,21 +254,30 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } - assertTrue("testH5Pget_virtual_count: "+num_map, num_map >= 0); + assertTrue("testH5Pget_virtual_count: " + num_map, num_map >= 0); assertEquals(3, num_map); } @Test - public void testH5Pget_source_filename() throws Throwable { + public void testH5Pget_source_filename() throws Throwable + { String filename = null; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { - filename = (H5.H5Pget_virtual_filename (H5dcplid, 2)); + filename = (H5.H5Pget_virtual_filename(H5dcplid, 2)); } catch (Throwable err) { err.printStackTrace(); @@ -234,20 +285,29 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } - assertTrue("testH5Pget_source_filename: "+filename, filename.compareTo("v-2.h5") == 0); + assertTrue("testH5Pget_source_filename: " + filename, filename.compareTo("v-2.h5") == 0); } @Test - public void testH5Pget_source_datasetname() throws Throwable { + public void testH5Pget_source_datasetname() throws Throwable + { String datasetname = null; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { - datasetname = H5.H5Pget_virtual_dsetname (H5dcplid, 1); + datasetname = H5.H5Pget_virtual_dsetname(H5dcplid, 1); } catch (Throwable err) { err.printStackTrace(); @@ -255,21 +315,30 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } - assertTrue("testH5Pget_source_datasetname: "+datasetname, datasetname.compareTo("B") == 0); + assertTrue("testH5Pget_source_datasetname: " + datasetname, datasetname.compareTo("B") == 0); } @Test - public void testH5Pget_selection_source_dataset() throws Throwable { - long src_space = HDF5Constants.H5I_INVALID_HID; + public void testH5Pget_selection_source_dataset() throws Throwable + { + long src_space = HDF5Constants.H5I_INVALID_HID; long src_selection = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { - src_space = H5.H5Pget_virtual_srcspace (H5dcplid, 0); + src_space = H5.H5Pget_virtual_srcspace(H5dcplid, 0); src_selection = H5.H5Sget_select_type(src_space); } catch (Throwable err) { @@ -278,17 +347,30 @@ public class TestH5Pvirtual { } finally { if (src_space > 0) - try {H5.H5Sclose(src_space);} catch (Exception ex) {} + try { + H5.H5Sclose(src_space); + } + catch (Exception ex) { + } if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } assertTrue("testH5Pget_selection_source_dataset", src_selection == HDF5Constants.H5S_SEL_ALL); } @Test - public void testH5Pget_mapping_parameters() { + public void testH5Pget_mapping_parameters() + { long num_map = -1; H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); @@ -302,22 +384,22 @@ public class TestH5Pvirtual { } for (int i = 0; i < num_map; i++) { int vselection = -1; - long vspace = -1; - long nblocks; // Number of hyperslab blocks - long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks - long[] start = {i, 0}; - long[] stride = {1, 1}; - long[] count = {1, 1}; - long[] block = {1, VDSDIM_Y}; - long q_start[] = new long[2]; - long q_stride[] = new long[2]; - long q_count[] = new long[2]; - long q_block[] = new long[2]; + long vspace = -1; + long nblocks; // Number of hyperslab blocks + long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks + long[] start = {i, 0}; + long[] stride = {1, 1}; + long[] count = {1, 1}; + long[] block = {1, VDSDIM_Y}; + long q_start[] = new long[2]; + long q_stride[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; boolean is_regular = false; try { try { - vspace = H5.H5Pget_virtual_vspace (H5dcplid, i); + vspace = H5.H5Pget_virtual_vspace(H5dcplid, i); } catch (Throwable err) { err.printStackTrace(); @@ -330,7 +412,8 @@ public class TestH5Pvirtual { err.printStackTrace(); fail("H5.H5Sget_select_type: " + err); } - assertTrue("testH5Pget_mapping_parameters["+i+"]", vselection == HDF5Constants.H5S_SEL_HYPERSLABS); + assertTrue("testH5Pget_mapping_parameters[" + i + "]", + vselection == HDF5Constants.H5S_SEL_HYPERSLABS); // Verify that there is only one block nblocks = H5.H5Sget_select_hyper_nblocks(vspace); @@ -340,30 +423,38 @@ public class TestH5Pvirtual { H5.H5Sget_select_hyper_blocklist(vspace, 0, nblocks, blocks); // Verify that the correct block is defined - assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [0]: "+blocks[0], start[0] == blocks[0]); - assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [1]: "+blocks[1], start[1] == blocks[1]); - assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [2]: "+blocks[2], (block[0]-1+i) == blocks[2]); - assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [3]: "+blocks[3], (block[1]-1) == blocks[3]); + assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [0]: " + blocks[0], + start[0] == blocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [1]: " + blocks[1], + start[1] == blocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [2]: " + blocks[2], + (block[0] - 1 + i) == blocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist[" + i + "] [3]: " + blocks[3], + (block[1] - 1) == blocks[3]); // We also can use new APIs to get start, stride, count and block is_regular = H5.H5Sis_regular_hyperslab(vspace); assertTrue("H5.H5Sis_regular_hyperslab", is_regular); - H5.H5Sget_regular_hyperslab (vspace, q_start, q_stride, q_count, q_block); + H5.H5Sget_regular_hyperslab(vspace, q_start, q_stride, q_count, q_block); // Verify the hyperslab parameters - for(int u = 0; u < 2; u++) { + for (int u = 0; u < 2; u++) { assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]); assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]); assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]); assertTrue("H5Sget_regular_hyperslab, block", block[u] == q_block[u]); } - } + } catch (Throwable err) { err.printStackTrace(); fail("H5.testH5Pget_mapping_parameters: " + err); } finally { if (vspace > 0) - try {H5.H5Sclose(vspace);} catch (Exception ex) {} + try { + H5.H5Sclose(vspace); + } + catch (Exception ex) { + } } } } @@ -373,16 +464,25 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } } @Test - public void testH5Pset_get_virtual_view() { + public void testH5Pset_get_virtual_view() + { int ret_val = -1; - H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { ret_val = H5.H5Pget_virtual_view(H5dapl_id); assertTrue("H5Pget_virtual_view", ret_val >= 0); @@ -398,16 +498,25 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } } @Test - public void testH5Pset_get_virtual_printf_gap() { + public void testH5Pset_get_virtual_printf_gap() + { long ret_val = -1; - H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); try { ret_val = H5.H5Pget_virtual_printf_gap(H5dapl_id); assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0); @@ -423,14 +532,23 @@ public class TestH5Pvirtual { } finally { if (H5dssid > 0) - try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dssid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } } } @Test - public void testH5Pset_virtual_prefix() { + public void testH5Pset_virtual_prefix() + { String prefix = "tmp"; try { H5.H5Pset_virtual_prefix(H5dapl_id, prefix); @@ -442,14 +560,16 @@ public class TestH5Pvirtual { } @Test(expected = NullPointerException.class) - public void testH5Pset_virtual_prefix_null() throws Throwable{ + public void testH5Pset_virtual_prefix_null() throws Throwable + { H5.H5Pset_virtual_prefix(H5dapl_id, null); } @Test - public void testH5Pget_virtual_prefix() { + public void testH5Pget_virtual_prefix() + { String prefix = "tmp"; - String pre = ""; + String pre = ""; try { H5.H5Pset_virtual_prefix(H5dapl_id, prefix); diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java index 031b8e4..4e610bc 100644 --- a/java/test/TestH5R.java +++ b/java/test/TestH5R.java @@ -23,8 +23,8 @@ import java.io.File; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; -import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; +import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; @@ -34,38 +34,46 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5R { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testH5R.h5"; - private static final int DIM_X = 4; - private static final int DIM_Y = 6; - long H5fid = 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) { + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + 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; try { file = new File(filename); } - catch (Throwable err) {} + catch (Throwable err) { + } if (file.exists()) { - try {file.delete();} catch (SecurityException e) {e.printStackTrace();} + 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) { + private final long _createDataset(long fid, long dsid, String name, long dapl) + { long did = HDF5Constants.H5I_INVALID_HID; try { - did = H5.H5Dcreate(fid, name, - HDF5Constants.H5T_STD_I32BE, dsid, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, dapl); } catch (Throwable err) { err.printStackTrace(); @@ -76,34 +84,35 @@ public class TestH5R { return did; } - private final long _createGroup(long fid, String name) { + private final long _createGroup(long fid, String name) + { long gid = HDF5Constants.H5I_INVALID_HID; try { - gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Gcreate: " + err); } - assertTrue("TestH5R._createGroup: ",gid > 0); + assertTrue("TestH5R._createGroup: ", gid > 0); return gid; } @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); try { - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5dsid = H5.H5Screate_simple(2, H5dims, null); - H5gid = _createGroup(H5fid, "Group1"); + H5gid = _createGroup(H5fid, "Group1"); H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT); - H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); // Initialize the dataset. for (int indx = 0; indx < DIM_X; indx++) @@ -112,38 +121,57 @@ public class TestH5R { try { if (H5did >= 0) - H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, dset_data[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(); fail("TestH5R.createH5file: " + err); } - assertTrue("TestH5R.createH5file: H5.H5Fcreate: ",H5fid > 0); - assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ",H5dsid > 0); - assertTrue("TestH5R.createH5file: _createDataset: ",H5did > 0); + assertTrue("TestH5R.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5R.createH5file: _createDataset: ", H5did > 0); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5did > 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } if (H5gid > 0) - try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + try { + H5.H5Gclose(H5gid); + } + catch (Exception ex) { + } if (H5did2 > 0) - try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did2); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); @@ -152,11 +180,12 @@ public class TestH5R { // Test v1.12 APIs params @Test - public void testH5Rget_object() { - int ref_type = HDF5Constants.H5R_OBJECT2; - long ret_val = -1; - byte[] ref = null; - String name = ""; + public void testH5Rget_object() + { + int ref_type = HDF5Constants.H5R_OBJECT2; + long ret_val = -1; + byte[] ref = null; + String name = ""; String objName = "/dset"; try { @@ -197,9 +226,10 @@ public class TestH5R { } @Test - public void testH5Rget_obj_type3() { - int obj_type = -1; - byte[] ref = null; + public void testH5Rget_obj_type3() + { + int obj_type = -1; + byte[] ref = null; String objName = "/dset"; try { @@ -222,13 +252,14 @@ public class TestH5R { } @Test - public void testH5Rcreate_regionref_object() { - byte[] ref = null; + public void testH5Rcreate_regionref_object() + { + byte[] ref = null; String objName = "/dset"; - long start[] = {2,2}; // Starting location of hyperslab - long stride[] = {1,1}; // Stride of hyperslab - long count[] = {1,1}; // Element count of hyperslab - long block[] = {3,3}; // Block size of hyperslab + long start[] = {2, 2}; // Starting location of hyperslab + long stride[] = {1, 1}; // Stride of hyperslab + long count[] = {1, 1}; // Element count of hyperslab + long block[] = {3, 3}; // Block size of hyperslab // Select 3x3 hyperslab for reference try { @@ -249,235 +280,252 @@ public class TestH5R { H5.H5Rdestroy(ref); } -// These tests need to be updated with new APIs -// @Test// -// public void testH5Rget_group() { -// long loc_id = H5fid; -// int ref_type = HDF5Constants.H5R_OBJECT2; -// long ret_val = -1; -// byte[] ref = null; -// String name = ""; -// String objName = "/dset"; -// -// try { -// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("testH5Rget_object: H5Rcreate_object " + err); -// } -// try { -// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); -// -// //Create reference on group -// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); -// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); -// assertNotNull(ref1); -// assertNotNull(ref2); -// assertTrue(dataset_id >= 0); -// assertTrue(group_id >= 0); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("TestH5Rdereference " + err); -// } -// finally { -// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} -// try {H5.H5Gclose(group_id);} catch (Exception ex) {} -// } -// } - -// @Test// -// public void testH5Rget_region_dataset() { -// long loc_id = H5fid; -// int ref_type = HDF5Constants.H5R_OBJECT2; -// long ret_val = -1; -// byte[] ref = null; -// String name = ""; -// String objName = "/dset"; -// -// try { -// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("testH5Rget_object: H5Rcreate_object " + err); -// } -// try { -// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); -// assertNotNull(ref); -// assertTrue(dsid >= 0); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("TestH5Rget_region: " + err); -// } -// finally { -// try {H5.H5Sclose(dsid);} catch (Exception ex) {} -// } -// } - -// @Test// -// public void testH5Rget_attr() { -// long loc_id = H5fid; -// int ref_type = HDF5Constants.H5R_OBJECT2; -// long ret_val = -1; -// byte[] ref = null; -// String name = ""; -// String objName = "/dset"; -// -// try { -// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("testH5Rget_object: H5Rcreate_object " + err); -// } -// try { -// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); -// assertNotNull(ref); -// assertTrue(dsid >= 0); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("TestH5Rget_region: " + err); -// } -// finally { -// try {H5.H5Sclose(dsid);} catch (Exception ex) {} -// } -// } + // These tests need to be updated with new APIs + // @Test// + // public void testH5Rget_group() { + // long loc_id = H5fid; + // int ref_type = HDF5Constants.H5R_OBJECT2; + // long ret_val = -1; + // byte[] ref = null; + // String name = ""; + // String objName = "/dset"; + // + // try { + // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("testH5Rget_object: H5Rcreate_object " + err); + // } + // try { + // dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, + // HDF5Constants.H5R_DATASET_REGION, ref1); + // + // //Create reference on group + // ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + // group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, + // ref2); assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); + // assertTrue(group_id >= 0); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("TestH5Rdereference " + err); + // } + // finally { + // try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} + // try {H5.H5Gclose(group_id);} catch (Exception ex) {} + // } + // } + + // @Test// + // public void testH5Rget_region_dataset() { + // long loc_id = H5fid; + // int ref_type = HDF5Constants.H5R_OBJECT2; + // long ret_val = -1; + // byte[] ref = null; + // String name = ""; + // String objName = "/dset"; + // + // try { + // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("testH5Rget_object: H5Rcreate_object " + err); + // } + // try { + // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + // assertNotNull(ref); + // assertTrue(dsid >= 0); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("TestH5Rget_region: " + err); + // } + // finally { + // try {H5.H5Sclose(dsid);} catch (Exception ex) {} + // } + // } + + // @Test// + // public void testH5Rget_attr() { + // long loc_id = H5fid; + // int ref_type = HDF5Constants.H5R_OBJECT2; + // long ret_val = -1; + // byte[] ref = null; + // String name = ""; + // String objName = "/dset"; + // + // try { + // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("testH5Rget_object: H5Rcreate_object " + err); + // } + // try { + // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + // assertNotNull(ref); + // assertTrue(dsid >= 0); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("TestH5Rget_region: " + err); + // } + // finally { + // try {H5.H5Sclose(dsid);} catch (Exception ex) {} + // } + // } // Test parameters to H5Rcreate_object @Test(expected = NullPointerException.class) - public void testH5Rcreate_object_Nullname() throws Throwable { + public void testH5Rcreate_object_Nullname() throws Throwable + { String name = null; H5.H5Rcreate_object(H5fid, name, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Rget_name_Invalidloc() throws Throwable { - String name= ""; + public void testH5Rget_name_Invalidloc() throws Throwable + { + String name = ""; H5.H5Rcreate_object(-1, name, HDF5Constants.H5P_DEFAULT); } // Test parameters to H5Rcreate_region @Test(expected = NullPointerException.class) - public void testH5Rcreate_region_Nullname() throws Throwable { + public void testH5Rcreate_region_Nullname() throws Throwable + { String name = null; H5.H5Rcreate_region(H5fid, name, -1, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Rcreate_region_Invalidloc() throws Throwable { - String name= ""; + public void testH5Rcreate_region_Invalidloc() throws Throwable + { + String name = ""; H5.H5Rcreate_region(-1, name, -1, HDF5Constants.H5P_DEFAULT); } // Test parameters to H5Rcreate_attr @Test(expected = NullPointerException.class) - public void testH5Rcreate_attr_Nullname() throws Throwable { - String name = null; + public void testH5Rcreate_attr_Nullname() throws Throwable + { + String name = null; String attrname = ""; H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT); } @Test(expected = NullPointerException.class) - public void testH5Rcreate_attr_Nullattrname() throws Throwable { - String name = ""; + public void testH5Rcreate_attr_Nullattrname() throws Throwable + { + String name = ""; String attrname = null; H5.H5Rcreate_attr(H5fid, name, attrname, HDF5Constants.H5P_DEFAULT); } @Test(expected = HDF5FunctionArgumentException.class) - public void testH5Rcreate_attr_Invalidloc() throws Throwable { - String name= ""; - String attrname= ""; + public void testH5Rcreate_attr_Invalidloc() throws Throwable + { + String name = ""; + String attrname = ""; H5.H5Rcreate_attr(-1, name, attrname, HDF5Constants.H5P_DEFAULT); } // Test parameters to H5Rdestroy @Test(expected = NullPointerException.class) - public void testH5Rdestroy_Nullref() throws Throwable { + public void testH5Rdestroy_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rdestroy(ref); } // Test parameters to H5Rget_type @Test(expected = NullPointerException.class) - public void testH5Rget_type_Nullref() throws Throwable { + public void testH5Rget_type_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rget_type(ref); } // Test parameters to H5Requal @Test(expected = NullPointerException.class) - public void testH5Requal_Nullref1() throws Throwable { + public void testH5Requal_Nullref1() throws Throwable + { byte[] ref1 = null; - byte[] ref2 = {0,0,0,0}; + byte[] ref2 = {0, 0, 0, 0}; H5.H5Requal(ref1, ref2); } @Test(expected = NullPointerException.class) - public void testH5Requal_Nullref2() throws Throwable { - byte[] ref1 = {0,0,0,0}; + public void testH5Requal_Nullref2() throws Throwable + { + byte[] ref1 = {0, 0, 0, 0}; byte[] ref2 = null; H5.H5Requal(ref1, ref2); } // Test parameters to H5Rcopy @Test(expected = NullPointerException.class) - public void testH5Rcopy_Nullref1() throws Throwable { + public void testH5Rcopy_Nullref1() throws Throwable + { byte[] ref1 = null; byte[] ref2 = H5.H5Rcopy(ref1); } // Test parameters to H5Ropen_object @Test(expected = NullPointerException.class) - public void testH5Ropen_object_Nullref() throws Throwable { + public void testH5Ropen_object_Nullref() throws Throwable + { byte[] ref = null; H5.H5Ropen_object(ref, -1, -1); } // Test parameters to H5Ropen_region @Test(expected = NullPointerException.class) - public void testH5Ropen_region_Nullref() throws Throwable { + public void testH5Ropen_region_Nullref() throws Throwable + { byte[] ref = null; H5.H5Ropen_region(ref, -1, -1); } // Test parameters to H5Ropen_attr @Test(expected = NullPointerException.class) - public void testH5Ropen_attr_Nullref() throws Throwable { + public void testH5Ropen_attr_Nullref() throws Throwable + { byte[] ref = null; H5.H5Ropen_attr(ref, -1, -1); } // Test parameters to H5Rget_obj_type3 @Test(expected = NullPointerException.class) - public void testH5Rget_obj_type3_Nullref() throws Throwable { + public void testH5Rget_obj_type3_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rget_obj_type3(ref, -1); } // Test parameters to H5Rget_file_name @Test(expected = NullPointerException.class) - public void testH5Rget_file_name_Nullref() throws Throwable { + public void testH5Rget_file_name_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rget_file_name(ref); } // Test parameters to H5Rget_obj_name @Test(expected = NullPointerException.class) - public void testH5Rget_obj_name_Nullref() throws Throwable { + public void testH5Rget_obj_name_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rget_obj_name(ref, -1); } // Test parameters to H5Rget_attr_name @Test(expected = NullPointerException.class) - public void testH5Rget_attr_name_Nullref() throws Throwable { + public void testH5Rget_attr_name_Nullref() throws Throwable + { byte[] ref = null; H5.H5Rget_attr_name(ref); } - } diff --git a/java/test/TestH5Rref.java b/java/test/TestH5Rref.java index 5733aae..520de74 100644 --- a/java/test/TestH5Rref.java +++ b/java/test/TestH5Rref.java @@ -23,8 +23,8 @@ import java.io.File; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; -import hdf.hdf5lib.exceptions.HDF5LibraryException; import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; +import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; import org.junit.Before; @@ -34,14 +34,16 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Rref { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_DREG_FILE = "trefer_reg.h5"; private static final String H5_AREG_FILE = "trefer_attr.h5"; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5dsid = HDF5Constants.H5I_INVALID_HID; - long H5did = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5dsid = HDF5Constants.H5I_INVALID_HID; + long H5did = HDF5Constants.H5I_INVALID_HID; - private boolean byteArrayCheck(final byte[] array) { + private boolean byteArrayCheck(final byte[] array) + { for (byte b : array) { if (b != 0) { return false; @@ -50,67 +52,81 @@ public class TestH5Rref { return true; } - 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("TestH5R._openH5file: " + err); - } - assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0); - try { - H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5R._openH5file: " + err); - } - assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0); - try { - H5dsid = H5.H5Dget_space(H5did); - } - catch (Throwable err) { - err.printStackTrace(); - fail("TestH5R._openH5file: " + err); - } - assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + 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("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Fopen: ", H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, dsetname, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Dopen: ", H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R._openH5file: " + err); + } + assertTrue("TestH5R._openH5file: H5.H5Screate_simple: ", H5dsid > 0); } @After - public void closeH5file() throws HDF5LibraryException { + public void closeH5file() throws HDF5LibraryException + { if (H5did >= 0) - try {H5.H5Dclose(H5did);} catch (Exception ex) {} + try { + H5.H5Dclose(H5did); + } + catch (Exception ex) { + } if (H5dsid > 0) - try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5dsid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} - H5fid = HDF5Constants.H5I_INVALID_HID; + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } + H5fid = HDF5Constants.H5I_INVALID_HID; H5dsid = HDF5Constants.H5I_INVALID_HID; - H5did = HDF5Constants.H5I_INVALID_HID; + H5did = HDF5Constants.H5I_INVALID_HID; System.out.println(); } @Before - public void verifyCount() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void verifyCount() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } // Test v1.12 APIs params @Test - public void testH5Rget_object() { - int ref_type = HDF5Constants.H5R_OBJECT1; - long f_type = HDF5Constants.H5I_INVALID_HID; - int obj_type = -1; - int ndims = 1; - long ret_val = -1; + public void testH5Rget_object() + { + int ref_type = HDF5Constants.H5R_OBJECT1; + long f_type = HDF5Constants.H5I_INVALID_HID; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; byte[][] refbuf = null; - String name = ""; - String objName = "/DS_NA"; + String name = ""; + String objName = "/DS_NA"; try { openH5file(H5_DREG_FILE, objName); @@ -120,18 +136,22 @@ public class TestH5Rref { fail("testH5Rget_object: openH5file: " + err); } try { - f_type = H5.H5Dget_type(H5did); + f_type = H5.H5Dget_type(H5did); int result = H5.H5Tget_class(f_type); assertTrue("testH5Rget_object: H5Tget_class", result > 0); String class_name = H5.H5Tget_class_name(result); - assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE")==0); + assertTrue("testH5Rget_object: H5Tget_class", class_name.compareTo("H5T_REFERENCE") == 0); } catch (Throwable err) { err.printStackTrace(); fail("testH5Rget_object: " + err); } finally { - try {H5.H5Tclose(f_type);} catch (Exception ex) {} + try { + H5.H5Tclose(f_type); + } + catch (Exception ex) { + } } try { ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); @@ -143,9 +163,8 @@ public class TestH5Rref { refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; // Read the reference from the dataset. try { - H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, refbuf); + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); } catch (Exception err) { err.printStackTrace(); @@ -155,7 +174,7 @@ public class TestH5Rref { for (int i = 0; i < ndims; i++) { try { ret_val = H5.H5Rget_type(refbuf[i]); - assertTrue("testH5Rget_object: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + assertTrue("testH5Rget_object: H5Rget_type[" + i + "]=" + ret_val, ret_val == ref_type); if (!byteArrayCheck(refbuf[i])) { try { obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); @@ -178,14 +197,15 @@ public class TestH5Rref { } @Test - public void testH5Rget_obj_type3() { - long f_type = HDF5Constants.H5I_INVALID_HID; - int ref_type = HDF5Constants.H5R_DATASET_REGION2; - int obj_type = -1; - int ndims = 1; - long ret_val = -1; + public void testH5Rget_obj_type3() + { + long f_type = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; byte[][] refbuf = null; - String objName = "/Dataset1"; + String objName = "/Dataset1"; try { openH5file(H5_DREG_FILE, objName); @@ -195,18 +215,23 @@ public class TestH5Rref { fail("testH5Rget_obj_type3: openH5file: " + err); } try { - f_type = H5.H5Dget_type(H5did); + f_type = H5.H5Dget_type(H5did); int result = H5.H5Tget_class(f_type); assertTrue("testH5Rget_obj_type3: H5Tget_class", result > 0); String class_name = H5.H5Tget_class_name(result); - assertTrue("testH5Rget_obj_type3: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); + assertTrue("testH5Rget_obj_type3: H5Tget_class=" + class_name, + class_name.compareTo("H5T_REFERENCE") == 0); } catch (Throwable err) { err.printStackTrace(); fail("testH5Rget_obj_type3: " + err); } finally { - try {H5.H5Tclose(f_type);} catch (Exception ex) {} + try { + H5.H5Tclose(f_type); + } + catch (Exception ex) { + } } try { ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); @@ -218,9 +243,8 @@ public class TestH5Rref { refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; // Read the reference from the dataset. try { - H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, refbuf); + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); } catch (Exception err) { err.printStackTrace(); @@ -230,7 +254,7 @@ public class TestH5Rref { for (int i = 0; i < ndims; i++) { try { ret_val = H5.H5Rget_type(refbuf[i]); - assertTrue("testH5Rget_obj_type3: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); + assertTrue("testH5Rget_obj_type3: H5Rget_type[" + i + "]=" + ret_val, ret_val == ref_type); if (!byteArrayCheck(refbuf[i])) { try { obj_type = H5.H5Rget_obj_type3(refbuf[i], HDF5Constants.H5P_DEFAULT); @@ -252,312 +276,341 @@ public class TestH5Rref { } } - @Test - public void testH5Rget_region_dataset() { - long f_type = HDF5Constants.H5I_INVALID_HID; - long loc_id = HDF5Constants.H5I_INVALID_HID; - long loc_sid = HDF5Constants.H5I_INVALID_HID; - int ref_type = HDF5Constants.H5R_DATASET_REGION2; - int ndims = 1; - long ret_val = -1; - byte[][] refbuf = null; - String name = ""; - String objName = "/Dataset1"; - - try { - openH5file(H5_DREG_FILE, objName); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_dataset: openH5file: " + err); - } - try { - f_type = H5.H5Dget_type(H5did); - int result = H5.H5Tget_class(f_type); - assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0); - String class_name = H5.H5Tget_class_name(result); - assertTrue("testH5Rget_region_dataset: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_dataset: " + err); - } - finally { - try {H5.H5Tclose(f_type);} catch (Exception ex) {} - } - try { - ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err); - } - refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; - // Read the reference from the dataset. - try { - H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, refbuf); - } - catch (Exception err) { - err.printStackTrace(); - fail("testH5Rget_obj_type3: H5Dread: " + err); - } - for (int i = 0; i < ndims; i++) { - try { - try { - ret_val = H5.H5Rget_type(refbuf[i]); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_dataset: H5Rget_type["+i+"]: " + err); - } - assertTrue("testH5Rget_region_dataset: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); - try { - loc_id = H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - assertTrue(loc_id >= 0); - try { - loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - assertTrue(loc_sid >= 0); - int region_type = -1; - try { - int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); - region_type = H5.H5Sget_select_type(loc_sid); - if (i == 1) - assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); - else - assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); - if (region_type == HDF5Constants.H5S_SEL_POINTS) { - long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); - // Coordinates for get point selection - long getcoord[] = new long[reg_ndims * (int)reg_npoints]; - // Known coordinates for point selection - long coord[][] = {{6,9},{2,2},{8,4},{1,6},{2,8},{3,2}, - {0,4},{9,0},{7,1},{3,3}}; - try { - H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); - assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); - } - catch (Throwable err3) { - err3.printStackTrace(); - fail("H5.H5Sget_select_elem_pointlist: " + err3); - } - } - else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { - long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); - assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); - // Coordinates for get block selection - long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; - long start[] = {2,2}; - long block[] = {8,8}; - try { - H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); - assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); - assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == getblocks[2]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == getblocks[3]); - } - catch (Throwable err3) { - err3.printStackTrace(); - fail("H5.H5Sget_select_hyper_blocklist: " + err3); - } - } - } - catch (Throwable err2) { - err2.printStackTrace(); - assertTrue("testH5Rget_region_dataset: H5Sget_select_type: " + err2, i > 1); - } - } - catch (Throwable err1) { - err1.printStackTrace(); - fail("testH5Rget_region_dataset: " + err1); - } - finally { - try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} - } - } - catch (Throwable err0) { - err0.printStackTrace(); - fail("testH5Rget_region_dataset: " + err0); - } - finally { - try {H5.H5Dclose(loc_id);} catch (Exception ex) {} - } - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_dataset: H5Rget_type: " + err); - } - finally { - H5.H5Rdestroy(refbuf[i]); - } - } //for (int i = 0; i < ndims; i++) - } - - @Test - public void testH5Rget_region_attribute() { - long f_type = HDF5Constants.H5I_INVALID_HID; - long loc_id = HDF5Constants.H5I_INVALID_HID; - long loc_sid = HDF5Constants.H5I_INVALID_HID; - int ref_type = HDF5Constants.H5R_ATTR; - int obj_type = -1; - int ndims = 1; - long ret_val = -1; - byte[][] refbuf = null; - String objName = "/Dataset3"; + @Test + public void testH5Rget_region_dataset() + { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_DATASET_REGION2; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String name = ""; + String objName = "/Dataset1"; - try { - openH5file(H5_AREG_FILE, objName); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_attribute: openH5file: " + err); - } - try { - f_type = H5.H5Dget_type(H5did); - int result = H5.H5Tget_class(f_type); - assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0); - String class_name = H5.H5Tget_class_name(result); - assertTrue("testH5Rget_region_attribute: H5Tget_class="+class_name, class_name.compareTo("H5T_REFERENCE")==0); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_attribute: " + err); - } - finally { - try {H5.H5Tclose(f_type);} catch (Exception ex) {} - } - try { - ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err); - } - refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; - // Read the reference from the dataset. - try { - H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, - HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, - HDF5Constants.H5P_DEFAULT, refbuf); - } - catch (Exception err) { - err.printStackTrace(); - fail("testH5Rget_region_attribute: H5Dread: " + err); - } + try { + openH5file(H5_DREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_dataset: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_dataset: H5Tget_class=" + class_name, + class_name.compareTo("H5T_REFERENCE") == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: " + err); + } + finally { + try { + H5.H5Tclose(f_type); + } + catch (Exception ex) { + } + } + try { + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_obj_type3: H5Dread: " + err); + } + for (int i = 0; i < ndims; i++) { + try { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Rget_type[" + i + "]: " + err); + } + assertTrue("testH5Rget_region_dataset: H5Rget_type[" + i + "]=" + ret_val, + ret_val == ref_type); + try { + loc_id = + H5.H5Ropen_object(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + try { + loc_sid = H5.H5Ropen_region(refbuf[i], HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + assertTrue(loc_sid >= 0); + int region_type = -1; + try { + int reg_ndims = H5.H5Sget_simple_extent_ndims(loc_sid); + region_type = H5.H5Sget_select_type(loc_sid); + if (i == 1) + assertTrue(region_type == HDF5Constants.H5S_SEL_POINTS); + else + assertTrue(region_type == HDF5Constants.H5S_SEL_HYPERSLABS); + if (region_type == HDF5Constants.H5S_SEL_POINTS) { + long reg_npoints = H5.H5Sget_select_elem_npoints(loc_sid); + // Coordinates for get point selection + long getcoord[] = new long[reg_ndims * (int)reg_npoints]; + // Known coordinates for point selection + long coord[][] = {{6, 9}, {2, 2}, {8, 4}, {1, 6}, {2, 8}, + {3, 2}, {0, 4}, {9, 0}, {7, 1}, {3, 3}}; + try { + H5.H5Sget_select_elem_pointlist(loc_sid, 0, reg_npoints, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err3); + } + } + else if (region_type == HDF5Constants.H5S_SEL_HYPERSLABS) { + long reg_nblocks = H5.H5Sget_select_hyper_nblocks(loc_sid); + assertTrue("H5Sget_select_hyper_nblocks", reg_nblocks == 1); + // Coordinates for get block selection + long getblocks[] = new long[reg_ndims * (int)reg_nblocks * 2]; + long start[] = {2, 2}; + long block[] = {8, 8}; + try { + H5.H5Sget_select_hyper_blocklist(loc_sid, 0, reg_nblocks, getblocks); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == getblocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == getblocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", + (block[0] - 1) == getblocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", + (block[1] - 1) == getblocks[3]); + } + catch (Throwable err3) { + err3.printStackTrace(); + fail("H5.H5Sget_select_hyper_blocklist: " + err3); + } + } + } + catch (Throwable err2) { + err2.printStackTrace(); + assertTrue("testH5Rget_region_dataset: H5Sget_select_type: " + err2, i > 1); + } + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_dataset: " + err1); + } + finally { + try { + H5.H5Sclose(loc_sid); + } + catch (Exception ex) { + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + fail("testH5Rget_region_dataset: " + err0); + } + finally { + try { + H5.H5Dclose(loc_id); + } + catch (Exception ex) { + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_dataset: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } // for (int i = 0; i < ndims; i++) + } - for (int i = 0; i < ndims; i++) { - try { - ret_val = H5.H5Rget_type(refbuf[i]); - assertTrue("testH5Rget_region_attribute: H5Rget_type["+i+"]="+ret_val, ret_val == ref_type); - try { - loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); - assertTrue(loc_id >= 0); - if (!byteArrayCheck(refbuf[i])) { - try { - loc_sid = H5.H5Aget_space(loc_id); - assertTrue(loc_sid >= 0); - } - catch (Throwable err1) { - err1.printStackTrace(); - fail("testH5Rget_region_attribute: " + err1); - } - finally { - try {H5.H5Sclose(loc_sid);} catch (Exception ex) {} - } - } - } - catch (Throwable err0) { - err0.printStackTrace(); - // second attribute is null - assertTrue("testH5Rget_region_attribute: " + err0, i == 1); - } - finally { - try {H5.H5Aclose(loc_id);} catch (Exception ex) {} - } - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Rget_region_attribute: H5Rget_type: " + err); - } - finally { - H5.H5Rdestroy(refbuf[i]); - } - } - } + @Test + public void testH5Rget_region_attribute() + { + long f_type = HDF5Constants.H5I_INVALID_HID; + long loc_id = HDF5Constants.H5I_INVALID_HID; + long loc_sid = HDF5Constants.H5I_INVALID_HID; + int ref_type = HDF5Constants.H5R_ATTR; + int obj_type = -1; + int ndims = 1; + long ret_val = -1; + byte[][] refbuf = null; + String objName = "/Dataset3"; + try { + openH5file(H5_AREG_FILE, objName); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: openH5file: " + err); + } + try { + f_type = H5.H5Dget_type(H5did); + int result = H5.H5Tget_class(f_type); + assertTrue("testH5Rget_region_attribute: H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("testH5Rget_region_attribute: H5Tget_class=" + class_name, + class_name.compareTo("H5T_REFERENCE") == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: " + err); + } + finally { + try { + H5.H5Tclose(f_type); + } + catch (Exception ex) { + } + } + try { + ndims = (int)H5.H5Sget_simple_extent_npoints(H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Sget_simple_extent_ndims: " + err); + } + refbuf = new byte[ndims][HDF5Constants.H5R_REF_BUF_SIZE]; + // Read the reference from the dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_STD_REF, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, refbuf); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Dread: " + err); + } -// These tests need to be updated with new APIs -// @Test// -// public void testH5Rget_group() { -// long loc_id = H5fid; -// int ref_type = HDF5Constants.H5R_OBJECT2; -// long ret_val = -1; -// byte[] ref = null; -// String name = ""; -// String objName = "/dset"; -// -// try { -// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("testH5Rget_object: H5Rcreate_object " + err); -// } -// try { -// dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); -// -// //Create reference on group -// ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); -// group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); -// assertNotNull(ref1); -// assertNotNull(ref2); -// assertTrue(dataset_id >= 0); -// assertTrue(group_id >= 0); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("TestH5Rdereference " + err); -// } -// finally { -// try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} -// try {H5.H5Gclose(group_id);} catch (Exception ex) {} -// } -// } + for (int i = 0; i < ndims; i++) { + try { + ret_val = H5.H5Rget_type(refbuf[i]); + assertTrue("testH5Rget_region_attribute: H5Rget_type[" + i + "]=" + ret_val, + ret_val == ref_type); + try { + loc_id = H5.H5Ropen_attr(refbuf[i], HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue(loc_id >= 0); + if (!byteArrayCheck(refbuf[i])) { + try { + loc_sid = H5.H5Aget_space(loc_id); + assertTrue(loc_sid >= 0); + } + catch (Throwable err1) { + err1.printStackTrace(); + fail("testH5Rget_region_attribute: " + err1); + } + finally { + try { + H5.H5Sclose(loc_sid); + } + catch (Exception ex) { + } + } + } + } + catch (Throwable err0) { + err0.printStackTrace(); + // second attribute is null + assertTrue("testH5Rget_region_attribute: " + err0, i == 1); + } + finally { + try { + H5.H5Aclose(loc_id); + } + catch (Exception ex) { + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Rget_region_attribute: H5Rget_type: " + err); + } + finally { + H5.H5Rdestroy(refbuf[i]); + } + } + } -// @Test// -// public void testH5Rget_attr() { -// long loc_id = H5fid; -// int ref_type = HDF5Constants.H5R_OBJECT2; -// long ret_val = -1; -// byte[] ref = null; -// String name = ""; -// String objName = "/dset"; -// -// try { -// ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("testH5Rget_object: H5Rcreate_object " + err); -// } -// try { -// dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); -// assertNotNull(ref); -// assertTrue(dsid >= 0); -// } -// catch (Throwable err) { -// err.printStackTrace(); -// fail("TestH5Rget_region: " + err); -// } -// finally { -// try {H5.H5Sclose(dsid);} catch (Exception ex) {} -// } -// } + // These tests need to be updated with new APIs + // @Test// + // public void testH5Rget_group() { + // long loc_id = H5fid; + // int ref_type = HDF5Constants.H5R_OBJECT2; + // long ret_val = -1; + // byte[] ref = null; + // String name = ""; + // String objName = "/dset"; + // + // try { + // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("testH5Rget_object: H5Rcreate_object " + err); + // } + // try { + // dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, + // HDF5Constants.H5R_DATASET_REGION, ref1); + // + // //Create reference on group + // ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + // group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, + // ref2); assertNotNull(ref1); assertNotNull(ref2); assertTrue(dataset_id >= 0); + // assertTrue(group_id >= 0); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("TestH5Rdereference " + err); + // } + // finally { + // try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} + // try {H5.H5Gclose(group_id);} catch (Exception ex) {} + // } + // } + // @Test// + // public void testH5Rget_attr() { + // long loc_id = H5fid; + // int ref_type = HDF5Constants.H5R_OBJECT2; + // long ret_val = -1; + // byte[] ref = null; + // String name = ""; + // String objName = "/dset"; + // + // try { + // ref = H5.H5Rcreate_object(H5fid, objName, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("testH5Rget_object: H5Rcreate_object " + err); + // } + // try { + // dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + // assertNotNull(ref); + // assertTrue(dsid >= 0); + // } + // catch (Throwable err) { + // err.printStackTrace(); + // fail("TestH5Rget_region: " + err); + // } + // finally { + // try {H5.H5Sclose(dsid);} catch (Exception ex) {} + // } + // } } diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java index 7eeed7a..6e081a6 100644 --- a/java/test/TestH5S.java +++ b/java/test/TestH5S.java @@ -12,10 +12,10 @@ package test; - import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; @@ -28,16 +28,17 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5S { - @Rule public TestName testname = new TestName(); - long H5sid = HDF5Constants.H5I_INVALID_HID; - int H5rank = 2; - long H5dims[] = {5, 5}; - long H5maxdims[] = {10, 10}; + @Rule + public TestName testname = new TestName(); + long H5sid = HDF5Constants.H5I_INVALID_HID; + int H5rank = 2; + long H5dims[] = {5, 5}; + long H5maxdims[] = {10, 10}; @Before - public void createH5file() - throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); H5sid = H5.H5Screate_simple(H5rank, H5dims, H5maxdims); @@ -45,15 +46,21 @@ public class TestH5S { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5sid > 0) { - try {H5.H5Sclose(H5sid);} catch (Exception ex) {} + try { + H5.H5Sclose(H5sid); + } + catch (Exception ex) { + } } System.out.println(); } @Test - public void testH5Sget_simple_extent_ndims() { + public void testH5Sget_simple_extent_ndims() + { int read_rank = -1; try { read_rank = H5.H5Sget_simple_extent_ndims(H5sid); @@ -66,7 +73,8 @@ public class TestH5S { } @Test - public void testH5Sget_simple_extent_dims_null() { + public void testH5Sget_simple_extent_dims_null() + { int read_rank = -1; try { @@ -80,9 +88,10 @@ public class TestH5S { } @Test - public void testH5Sget_simple_extent_dims() { - int read_rank = -1; - long dims[] = {5, 5}; + public void testH5Sget_simple_extent_dims() + { + int read_rank = -1; + long dims[] = {5, 5}; long maxdims[] = {10, 10}; try { @@ -98,11 +107,12 @@ public class TestH5S { } @Test - public void testH5Sget_simple_extent_npoints() { + public void testH5Sget_simple_extent_npoints() + { long num_elements = -1; try { num_elements = H5.H5Sget_simple_extent_npoints(H5sid); - assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0]*H5dims[1]) == num_elements); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0] * H5dims[1]) == num_elements); } catch (Throwable err) { err.printStackTrace(); @@ -111,7 +121,8 @@ public class TestH5S { } @Test - public void testH5Sget_simple_extent_type() { + public void testH5Sget_simple_extent_type() + { int read_type = -1; try { read_type = H5.H5Sget_simple_extent_type(H5sid); @@ -124,7 +135,8 @@ public class TestH5S { } @Test - public void testH5Sis_simple() { + public void testH5Sis_simple() + { boolean result = false; try { @@ -138,12 +150,13 @@ public class TestH5S { } @Test - public void testH5Sset_extent_simple() { + public void testH5Sset_extent_simple() + { long num_elements = -1; try { H5.H5Sset_extent_simple(H5sid, H5rank, H5maxdims, H5maxdims); num_elements = H5.H5Sget_simple_extent_npoints(H5sid); - assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0]*H5maxdims[1]) == num_elements); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0] * H5maxdims[1]) == num_elements); } catch (Throwable err) { err.printStackTrace(); @@ -152,7 +165,8 @@ public class TestH5S { } @Test - public void testH5Sget_select_type() { + public void testH5Sget_select_type() + { int read_type = -1; try { read_type = H5.H5Sget_select_type(H5sid); @@ -165,12 +179,13 @@ public class TestH5S { } @Test - public void testH5Sset_extent_none() { + public void testH5Sset_extent_none() + { int read_type = -1; try { H5.H5Sset_extent_none(H5sid); read_type = H5.H5Sget_simple_extent_type(H5sid); - assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NULL == read_type); + assertTrue("H5.H5Sget_simple_extent_type: " + read_type, HDF5Constants.H5S_NULL == read_type); } catch (Throwable err) { err.printStackTrace(); @@ -179,8 +194,9 @@ public class TestH5S { } @Test - public void testH5Scopy() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Scopy() + { + long sid = HDF5Constants.H5I_INVALID_HID; int read_rank = -1; try { @@ -194,13 +210,18 @@ public class TestH5S { fail("H5.H5Scopy: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Sextent_copy() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sextent_copy() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { @@ -215,18 +236,23 @@ public class TestH5S { fail("H5.H5Sextent_copy: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Sextent_equal() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sextent_equal() + { + long sid = HDF5Constants.H5I_INVALID_HID; boolean result = false; try { sid = H5.H5Screate(HDF5Constants.H5S_NULL); - assertTrue("H5.H5Screate_null",sid > 0); + assertTrue("H5.H5Screate_null", sid > 0); } catch (Throwable err) { err.printStackTrace(); @@ -235,7 +261,7 @@ public class TestH5S { try { result = H5.H5Sextent_equal(sid, H5sid); - assertFalse("H5.testH5Sextent_equal",result); + assertFalse("H5.testH5Sextent_equal", result); H5.H5Sextent_copy(sid, H5sid); result = H5.H5Sextent_equal(sid, H5sid); assertTrue("H5.testH5Sextent_equal", result); @@ -245,16 +271,21 @@ public class TestH5S { fail("H5.H5Sextent_copy " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Sencode_decode_null_dataspace() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sencode_decode_null_dataspace() + { + long sid = HDF5Constants.H5I_INVALID_HID; long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] null_sbuf = null; - boolean result = false; + boolean result = false; try { sid = H5.H5Screate(HDF5Constants.H5S_NULL); @@ -267,21 +298,25 @@ public class TestH5S { try { null_sbuf = H5.H5Sencode(sid); - assertFalse("H5.testH5Sencode", null_sbuf==null); + assertFalse("H5.testH5Sencode", null_sbuf == null); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Sencode " + err); } finally { - if(null_sbuf == null) { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + if (null_sbuf == null) { + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } try { decoded_sid = H5.H5Sdecode(null_sbuf); - assertTrue("H5.testH5Sdecode", decoded_sid>0); + assertTrue("H5.testH5Sdecode", decoded_sid > 0); result = H5.H5Sextent_equal(sid, decoded_sid); assertTrue("H5.testH5Sextent_equal", result); @@ -291,19 +326,28 @@ public class TestH5S { fail("H5.H5Sdecode " + err); } finally { - try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(decoded_sid); + } + catch (Exception ex) { + } + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Sencode_decode_scalar_dataspace() { - long sid = HDF5Constants.H5I_INVALID_HID; - long decoded_sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sencode_decode_scalar_dataspace() + { + long sid = HDF5Constants.H5I_INVALID_HID; + long decoded_sid = HDF5Constants.H5I_INVALID_HID; byte[] scalar_sbuf = null; - boolean result = false; - int iresult = -1; - long lresult = -1; + boolean result = false; + int iresult = -1; + long lresult = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); @@ -316,52 +360,65 @@ public class TestH5S { try { scalar_sbuf = H5.H5Sencode(sid); - assertFalse("H5.testH5Sencode", scalar_sbuf==null); + assertFalse("H5.testH5Sencode", scalar_sbuf == null); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Sencode " + err); } finally { - if(scalar_sbuf == null) { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + if (scalar_sbuf == null) { + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } try { decoded_sid = H5.H5Sdecode(scalar_sbuf); - assertTrue("H5.testH5Sdecode", decoded_sid>0); + assertTrue("H5.testH5Sdecode", decoded_sid > 0); result = H5.H5Sextent_equal(sid, decoded_sid); assertTrue("H5.testH5Sextent_equal", result); /* Verify decoded dataspace */ lresult = H5.H5Sget_simple_extent_npoints(decoded_sid); - assertTrue("H5.testH5Sget_simple_extent_npoints", lresult==1); + assertTrue("H5.testH5Sget_simple_extent_npoints", lresult == 1); iresult = H5.H5Sget_simple_extent_ndims(decoded_sid); - assertTrue("H5.testH5Sget_simple_extent_ndims", iresult==0); + assertTrue("H5.testH5Sget_simple_extent_ndims", iresult == 0); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Sdecode " + err); } finally { - try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(decoded_sid); + } + catch (Exception ex) { + } + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Sselect_none() { + public void testH5Sselect_none() + { int read_type = -1; try { H5.H5Sselect_none(H5sid); read_type = H5.H5Sget_select_type(H5sid); - assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_NONE == read_type); + assertTrue("H5.H5Sget_select_type: " + read_type, HDF5Constants.H5S_SEL_NONE == read_type); H5.H5Sselect_all(H5sid); read_type = H5.H5Sget_select_type(H5sid); - assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_ALL == read_type); + assertTrue("H5.H5Sget_select_type: " + read_type, HDF5Constants.H5S_SEL_ALL == read_type); } catch (Throwable err) { err.printStackTrace(); @@ -370,13 +427,14 @@ public class TestH5S { } @Test - public void testH5Sget_select_npoints() { - long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ + public void testH5Sget_select_npoints() + { + long coord[][] = {{0, 1}, {2, 4}, {5, 6}}; /* Coordinates for point selection */ long num_elements = -1; try { H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); num_elements = H5.H5Sget_select_npoints(H5sid); - assertTrue("H5.H5Sget_select_npoints: "+num_elements, 3 == num_elements); + assertTrue("H5.H5Sget_select_npoints: " + num_elements, 3 == num_elements); } catch (Throwable err) { err.printStackTrace(); @@ -385,9 +443,10 @@ public class TestH5S { } @Test(expected = IllegalArgumentException.class) - public void testH5Sget_select_elem_pointlist_invalid() throws Throwable { - long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ - long getcoord[] = {-1,-1}; /* Coordinates for get point selection */ + public void testH5Sget_select_elem_pointlist_invalid() throws Throwable + { + long coord[][] = {{0, 1}, {2, 4}, {5, 6}}; /* Coordinates for point selection */ + long getcoord[] = {-1, -1}; /* Coordinates for get point selection */ try { H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); } @@ -399,9 +458,10 @@ public class TestH5S { } @Test - public void testH5Sget_select_elem_pointlist() { - long coord[][] = {{0,1},{2,3},{4,5}}; /* Coordinates for point selection */ - long getcoord[] = {-1,-1,-1,-1,-1,-1}; /* Coordinates for get point selection */ + public void testH5Sget_select_elem_pointlist() + { + long coord[][] = {{0, 1}, {2, 3}, {4, 5}}; /* Coordinates for point selection */ + long getcoord[] = {-1, -1, -1, -1, -1, -1}; /* Coordinates for get point selection */ try { H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord); @@ -419,15 +479,16 @@ public class TestH5S { } @Test - public void testH5Sget_select_bounds() { - long lowbounds[] = {-1,-1}; - long hibounds[] = {-1,-1}; + public void testH5Sget_select_bounds() + { + long lowbounds[] = {-1, -1}; + long hibounds[] = {-1, -1}; try { H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[0]); assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[1]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 1) == hibounds[1]); } catch (Throwable err) { err.printStackTrace(); @@ -436,30 +497,31 @@ public class TestH5S { } @Test - public void testH5Soffset_simple() { - long coord[][] = {{2,2},{2,4},{4,2},{4,4}}; /* Coordinates for point selection */ - long lowbounds[] = {-1,-1}; - long hibounds[] = {-1,-1}; + public void testH5Soffset_simple() + { + long coord[][] = {{2, 2}, {2, 4}, {4, 2}, {4, 4}}; /* Coordinates for point selection */ + long lowbounds[] = {-1, -1}; + long hibounds[] = {-1, -1}; try { H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 4, coord); H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[0]); assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[1]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 1) == hibounds[1]); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Sget_select_bounds: " + err); } try { - long offset[] = {-1,-1}; + long offset[] = {-1, -1}; H5.H5Soffset_simple(H5sid, offset); H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[0]); assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[1]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-2) == hibounds[0]); - assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-2) == hibounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0] - 2) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1] - 2) == hibounds[1]); } catch (Throwable err) { err.printStackTrace(); @@ -468,14 +530,15 @@ public class TestH5S { } @Test - public void testH5Sget_select_hyper() { - long space1 = HDF5Constants.H5I_INVALID_HID; - long start[] = {0,0}; - long stride[] = {1,1}; - long count[] = {1,1}; - long block[] = {4,4}; - long nblocks; // Number of hyperslab blocks - long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks + public void testH5Sget_select_hyper() + { + long space1 = HDF5Constants.H5I_INVALID_HID; + long start[] = {0, 0}; + long stride[] = {1, 1}; + long count[] = {1, 1}; + long block[] = {4, 4}; + long nblocks; // Number of hyperslab blocks + long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks try { // Copy "all" selection & space space1 = H5.H5Scopy(H5sid); @@ -493,26 +556,31 @@ public class TestH5S { // Verify that the correct block is defined assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == blocks[0]); assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == blocks[1]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == blocks[2]); - assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == blocks[3]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0] - 1) == blocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1] - 1) == blocks[3]); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Sget_select_bounds: " + err); } finally { - try {H5.H5Sclose(space1);} catch (Exception ex) {} + try { + H5.H5Sclose(space1); + } + catch (Exception ex) { + } } } @Test - public void testH5Sget_select_valid() { - long space1 = HDF5Constants.H5I_INVALID_HID; - long start[] = {1,0}; - long stride[] = {1,1}; - long count[] = {2,3}; - long block[] = {1,1}; - long offset[] = {0,0}; // Offset of selection + public void testH5Sget_select_valid() + { + long space1 = HDF5Constants.H5I_INVALID_HID; + long start[] = {1, 0}; + long stride[] = {1, 1}; + long count[] = {2, 3}; + long block[] = {1, 1}; + long offset[] = {0, 0}; // Offset of selection try { // Copy "all" selection & space @@ -522,20 +590,20 @@ public class TestH5S { H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); // Check a valid offset - offset[0]=-1; - offset[1]=0; + offset[0] = -1; + offset[1] = 0; H5.H5Soffset_simple(space1, offset); assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); // Check an invalid offset - offset[0]=10; - offset[1]=0; + offset[0] = 10; + offset[1] = 0; H5.H5Soffset_simple(space1, offset); assertFalse("H5Sselect_valid", H5.H5Sselect_valid(space1)); /* Reset offset */ - offset[0]=0; - offset[1]=0; + offset[0] = 0; + offset[1] = 0; H5.H5Soffset_simple(space1, offset); assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); } @@ -544,20 +612,25 @@ public class TestH5S { fail("testH5Sget_select_valid: " + err); } finally { - try {H5.H5Sclose(space1);} catch (Exception ex) {} + try { + H5.H5Sclose(space1); + } + catch (Exception ex) { + } } } @Test - public void testH5Shyper_regular() { - long start[] = {1,0}; - long stride[] = {1,1}; - long count[] = {2,3}; - long block[] = {1,1}; - long q_start[] = new long[2]; - long q_stride[] = new long[2]; - long q_count[] = new long[2]; - long q_block[] = new long[2]; + public void testH5Shyper_regular() + { + long start[] = {1, 0}; + long stride[] = {1, 1}; + long count[] = {2, 3}; + long block[] = {1, 1}; + long q_start[] = new long[2]; + long q_stride[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; boolean is_regular = false; try { @@ -572,7 +645,7 @@ public class TestH5S { H5.H5Sget_regular_hyperslab(H5sid, q_start, q_stride, q_count, q_block); /* Verify the hyperslab parameters */ - for(int u = 0; u < H5rank; u++) { + for (int u = 0; u < H5rank; u++) { assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]); assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]); assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]); diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java index 548ac95..3b92c92 100644 --- a/java/test/TestH5Sbasic.java +++ b/java/test/TestH5Sbasic.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -25,56 +26,68 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Sbasic { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } - @Test//(expected = HDF5LibraryException.class) - public void testH5Sclose_invalid() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Sclose_invalid() throws Throwable + { long sid = H5.H5Sclose(-1); assertTrue(sid == 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Screate_invalid() throws Throwable { + public void testH5Screate_invalid() throws Throwable + { H5.H5Screate(-1); } @Test(expected = IllegalArgumentException.class) - public void testH5Sget_simple_extent_type_invalid() throws Throwable { + public void testH5Sget_simple_extent_type_invalid() throws Throwable + { H5.H5Sget_simple_extent_type(-1); } @Test - public void testH5Screate_scalar() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Screate_scalar() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); - assertTrue("H5.H5Screate_scalar",sid > 0); + assertTrue("H5.H5Screate_scalar", sid > 0); class_type = H5.H5Sget_simple_extent_type(sid); - assertTrue("H5.H5Screate_scalar: type",class_type == HDF5Constants.H5S_SCALAR); + assertTrue("H5.H5Screate_scalar: type", class_type == HDF5Constants.H5S_SCALAR); } catch (Throwable err) { err.printStackTrace(); fail("H5.H5Screate: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Screate_null() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Screate_null() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; try { sid = H5.H5Screate(HDF5Constants.H5S_NULL); @@ -87,47 +100,56 @@ public class TestH5Sbasic { fail("H5.H5Screate: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = NullPointerException.class) - public void testH5Screate_simple_dims_null() throws Throwable { + public void testH5Screate_simple_dims_null() throws Throwable + { H5.H5Screate_simple(2, (long[])null, null); } @Test(expected = IllegalArgumentException.class) - public void testH5Screate_simple_rank_invalid() throws Throwable { + public void testH5Screate_simple_rank_invalid() throws Throwable + { long dims[] = {5, 5}; H5.H5Screate_simple(-1, dims, null); } @Test(expected = IllegalArgumentException.class) - public void testH5Screate_simple_dims_invalid() throws Throwable { + public void testH5Screate_simple_dims_invalid() throws Throwable + { long dims[] = {2, 2}; H5.H5Screate_simple(5, dims, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Screate_simple_dims_exceed() throws Throwable { - long dims[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, - 21,22,23,24,25,26,27,28,29,30,31,32,33,35}; + public void testH5Screate_simple_dims_exceed() throws Throwable + { + long dims[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35}; H5.H5Screate_simple(35, dims, null); } -//H5Screate_simple was changed to allow a dim of 0 -// @Ignore(expected = HDF5LibraryException.class) -// public void testH5Screate_simple_dims_zero() { -// long dims[] = {0, 0}; -// H5.H5Screate_simple(2, dims, null); -// } + // H5Screate_simple was changed to allow a dim of 0 + // @Ignore(expected = HDF5LibraryException.class) + // public void testH5Screate_simple_dims_zero() { + // long dims[] = {0, 0}; + // H5.H5Screate_simple(2, dims, null); + // } @Test - public void testH5Screate_simple() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Screate_simple() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; - int rank = 2; - long dims[] = {5, 5}; + int rank = 2; + long dims[] = {5, 5}; long maxdims[] = {10, 10}; try { @@ -141,16 +163,21 @@ public class TestH5Sbasic { fail("H5.H5Screate_simple: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Screate_simple_unlimted() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Screate_simple_unlimted() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; - int rank = 2; - long dims[] = {5, 5}; + int rank = 2; + long dims[] = {5, 5}; long maxdims[] = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED}; try { @@ -164,16 +191,21 @@ public class TestH5Sbasic { fail("H5.H5Screate_simple: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Screate_simple_unlimted_1d() { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Screate_simple_unlimted_1d() + { + long sid = HDF5Constants.H5I_INVALID_HID; int class_type = -1; - int rank = 1; - long dims[] = {5}; + int rank = 1; + long dims[] = {5}; long maxdims[] = {HDF5Constants.H5S_UNLIMITED}; try { @@ -187,14 +219,19 @@ public class TestH5Sbasic { fail("H5.H5Screate_simple: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Screate_simple_max_default() { - long sid = HDF5Constants.H5I_INVALID_HID; - int rank = 2; + public void testH5Screate_simple_max_default() + { + long sid = HDF5Constants.H5I_INVALID_HID; + int rank = 2; long dims[] = {5, 5}; try { @@ -206,20 +243,25 @@ public class TestH5Sbasic { fail("H5.H5Screate_simple: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test - public void testH5Screate_simple_extent() { - long sid = HDF5Constants.H5I_INVALID_HID; - int rank = 2; - long dims[] = {5, 5}; + public void testH5Screate_simple_extent() + { + long sid = HDF5Constants.H5I_INVALID_HID; + int rank = 2; + long dims[] = {5, 5}; long maxdims[] = {10, 10}; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Sset_extent_simple(sid, rank, dims, maxdims); } catch (Throwable err) { @@ -227,156 +269,195 @@ public class TestH5Sbasic { fail("H5.H5Screate: " + err); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = IllegalArgumentException.class) - public void testH5Sencode_invalid() throws Throwable { + public void testH5Sencode_invalid() throws Throwable + { H5.H5Sencode(-1); } @Test(expected = NullPointerException.class) - public void testH5Sdecode_null() throws Throwable { + public void testH5Sdecode_null() throws Throwable + { H5.H5Sdecode(null); } @Test(expected = IllegalArgumentException.class) - public void testH5Sget_regular_hyperslab_invalid() throws Throwable { - long q_start[] = new long[2]; + public void testH5Sget_regular_hyperslab_invalid() throws Throwable + { + long q_start[] = new long[2]; long q_stride[] = new long[2]; - long q_count[] = new long[2]; - long q_block[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; H5.H5Sget_regular_hyperslab(-1, q_start, q_stride, q_count, q_block); } @Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class) - public void testH5Sselect_copy_invalid() throws Throwable { + public void testH5Sselect_copy_invalid() throws Throwable + { H5.H5Sselect_copy(-1, -1); } @Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class) - public void testH5Sselect_shape_same_invalid() throws Throwable { + public void testH5Sselect_shape_same_invalid() throws Throwable + { H5.H5Sselect_shape_same(-1, -1); } @Test(expected = IllegalArgumentException.class) - public void testH5Sselect_adjust_invalid() throws Throwable { - long offset[][] = {{0,1},{2,4},{5,6}}; + public void testH5Sselect_adjust_invalid() throws Throwable + { + long offset[][] = {{0, 1}, {2, 4}, {5, 6}}; H5.H5Sselect_adjust(-1, offset); } @Test(expected = IllegalArgumentException.class) - public void testH5Sselect_adjust_rank_offset() throws Throwable { - long sid = HDF5Constants.H5I_INVALID_HID; - long offset[][] = {{0,1},{2,4},{5,6}}; + public void testH5Sselect_adjust_rank_offset() throws Throwable + { + long sid = HDF5Constants.H5I_INVALID_HID; + long offset[][] = {{0, 1}, {2, 4}, {5, 6}}; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Sselect_adjust(sid, offset); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = IllegalArgumentException.class) - public void testH5Sselect_intersect_block_invalid() throws Throwable { + public void testH5Sselect_intersect_block_invalid() throws Throwable + { long start[] = new long[2]; - long end[] = new long[2]; + long end[] = new long[2]; H5.H5Sselect_intersect_block(-1, start, end); } @Test(expected = IllegalArgumentException.class) - public void testH5Sselect_intersect_block_rank_start() throws Throwable { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sselect_intersect_block_rank_start() throws Throwable + { + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = new long[2]; - long end[] = null; + long end[] = null; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Sselect_intersect_block(sid, start, end); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = IllegalArgumentException.class) - public void testH5Sselect_intersect_block_rank_end() throws Throwable { - long sid = HDF5Constants.H5I_INVALID_HID; + public void testH5Sselect_intersect_block_rank_end() throws Throwable + { + long sid = HDF5Constants.H5I_INVALID_HID; long start[] = null; - long end[] = new long[2]; + long end[] = new long[2]; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Sselect_intersect_block(sid, start, end); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = hdf.hdf5lib.exceptions.HDF5DataspaceInterfaceException.class) - public void testH5Sselect_project_intersection_invalid() throws Throwable { + public void testH5Sselect_project_intersection_invalid() throws Throwable + { H5.H5Sselect_project_intersection(-1, -1, -1); } @Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class) - public void testH5Scombine_hyperslab_invalid() throws Throwable { + public void testH5Scombine_hyperslab_invalid() throws Throwable + { long start[] = new long[2]; long count[] = new long[2]; H5.H5Scombine_hyperslab(-1, 0, start, null, count, null); } @Test(expected = NullPointerException.class) - public void testH5Scombine_hyperslab_null_start() throws Throwable { - long sid = HDF5Constants.H5I_INVALID_HID; - long start[] = null; + public void testH5Scombine_hyperslab_null_start() throws Throwable + { + long sid = HDF5Constants.H5I_INVALID_HID; + long start[] = null; long stride[] = null; - long count[] = new long[2]; - long block[] = null; + long count[] = new long[2]; + long block[] = null; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = NullPointerException.class) - public void testH5Scombine_hyperslab_null_count() throws Throwable { - long sid = HDF5Constants.H5I_INVALID_HID; - long start[] = new long[2]; + public void testH5Scombine_hyperslab_null_count() throws Throwable + { + long sid = HDF5Constants.H5I_INVALID_HID; + long start[] = new long[2]; long stride[] = null; - long count[] = null; - long block[] = null; + long count[] = null; + long block[] = null; try { sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); - assertTrue("H5.H5Screate_simple_extent",sid > 0); + assertTrue("H5.H5Screate_simple_extent", sid > 0); H5.H5Scombine_hyperslab(sid, 0, start, stride, count, block); } finally { - try {H5.H5Sclose(sid);} catch (Exception ex) {} + try { + H5.H5Sclose(sid); + } + catch (Exception ex) { + } } } @Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class) - public void testH5Smodify_select_invalid() throws Throwable { + public void testH5Smodify_select_invalid() throws Throwable + { H5.H5Smodify_select(-1, 0, -1); } @Test(expected = hdf.hdf5lib.exceptions.HDF5FunctionArgumentException.class) - public void testH5Scombine_select_invalid() throws Throwable { + public void testH5Scombine_select_invalid() throws Throwable + { H5.H5Scombine_select(-1, 0, -1); } - } diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java index ed4e2a9..0121cc2 100644 --- a/java/test/TestH5T.java +++ b/java/test/TestH5T.java @@ -30,30 +30,38 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5T { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); private static final String H5_FILE = "testT.h5"; - long H5fid = HDF5Constants.H5I_INVALID_HID; - long H5strdid = HDF5Constants.H5I_INVALID_HID; + long H5fid = HDF5Constants.H5I_INVALID_HID; + long H5strdid = HDF5Constants.H5I_INVALID_HID; - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = null; try { file = new File(filename); } - catch (Throwable err) {} + catch (Throwable err) { + } if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void createH5file() throws NullPointerException, HDF5Exception { - assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + public void createH5file() throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); - H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); assertTrue("H5.H5Fcreate", H5fid > 0); H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); assertTrue("H5.H5Tcopy", H5strdid > 0); @@ -62,28 +70,39 @@ public class TestH5T { } @After - public void deleteH5file() throws HDF5LibraryException { + public void deleteH5file() throws HDF5LibraryException + { if (H5strdid >= 0) - try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5strdid); + } + catch (Exception ex) { + } if (H5fid > 0) - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } _deleteFile(H5_FILE); System.out.println(); } @Test(expected = HDF5LibraryException.class) - public void testH5Tequal_type_error() throws Throwable { + public void testH5Tequal_type_error() throws Throwable + { H5.H5Tequal(HDF5Constants.H5T_INTEGER, H5strdid); } @Test - public void testH5Tget_class() { + public void testH5Tget_class() + { try { int result = H5.H5Tget_class(H5strdid); assertTrue("H5.H5Tget_class", result > 0); String class_name = H5.H5Tget_class_name(result); - assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING")==0); + assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -92,7 +111,8 @@ public class TestH5T { } @Test - public void testH5Tget_size() { + public void testH5Tget_size() + { long dt_size = -1; try { @@ -106,7 +126,8 @@ public class TestH5T { } @Test - public void testH5Tset_size() { + public void testH5Tset_size() + { long dt_size = 5; try { @@ -127,89 +148,105 @@ public class TestH5T { } @Test - public void testH5Tarray_create() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - long[] adims = { 3, 5 }; - - try { - filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); - assertTrue("testH5Tarray_create", filetype_id >= 0); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tarray_create.H5Tarray_create " + err); - } - finally { - if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} - } + public void testH5Tarray_create() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + long[] adims = {3, 5}; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + assertTrue("testH5Tarray_create", filetype_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + finally { + if (filetype_id >= 0) + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } + } } @Test - public void testH5Tget_array_ndims() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - int ndims = 0; - long[] adims = { 3, 5 }; - - try { - filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tarray_create.H5Tarray_create " + err); - } - assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0); - try { - ndims = H5.H5Tget_array_ndims(filetype_id); - assertTrue("testH5Tget_array_ndims", ndims == 2); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err); - } - finally { - if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} - } + public void testH5Tget_array_ndims() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + int ndims = 0; + long[] adims = {3, 5}; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_ndims(filetype_id); + assertTrue("testH5Tget_array_ndims", ndims == 2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err); + } + finally { + if (filetype_id >= 0) + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } + } } @Test - public void testH5Tget_array_dims() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - int ndims = 0; - long[] adims = { 3, 5 }; - long[] rdims = new long[2]; - - try { - filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tarray_create.H5Tarray_create " + err); - } - assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0); - try { - ndims = H5.H5Tget_array_dims(filetype_id, rdims); - assertTrue("testH5Tget_array_dims", ndims == 2); - assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]); - assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tget_array_dims.H5Tget_array_dims " + err); - } - finally { - if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} - } + public void testH5Tget_array_dims() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + int ndims = 0; + long[] adims = {3, 5}; + long[] rdims = new long[2]; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_dims(filetype_id, rdims); + assertTrue("testH5Tget_array_dims", ndims == 2); + assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]); + assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_dims.H5Tget_array_dims " + err); + } + finally { + if (filetype_id >= 0) + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } + } } @Test - public void testH5Tenum_functions() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - String enum_type ="Enum_type"; - byte[] enum_val = new byte[1]; - String enum_name = null; + public void testH5Tenum_functions() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + String enum_type = "Enum_type"; + byte[] enum_val = new byte[1]; + String enum_name = null; // Create a enumerate datatype try { @@ -221,15 +258,15 @@ public class TestH5T { } assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0); try { - enum_val[0]=10; + enum_val[0] = 10; H5.H5Tenum_insert(filetype_id, "RED", enum_val); - enum_val[0]=11; + enum_val[0] = 11; H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); - enum_val[0]=12; + enum_val[0] = 12; H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); - enum_val[0]=13; + enum_val[0] = 13; H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); - enum_val[0]=14; + enum_val[0] = 14; H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); // Query member number and member index by member name, for enumeration type. @@ -237,7 +274,8 @@ public class TestH5T { assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); // Commit enumeration datatype and close it */ - H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Tclose(filetype_id); @@ -250,17 +288,17 @@ public class TestH5T { assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); // Query member value by member name, for enumeration type - H5.H5Tenum_valueof (filetype_id, "ORANGE", enum_val); - assertTrue("Incorrect value for enum member", enum_val[0]==13); + H5.H5Tenum_valueof(filetype_id, "ORANGE", enum_val); + assertTrue("Incorrect value for enum member", enum_val[0] == 13); // Query member value by member index, for enumeration type - H5.H5Tget_member_value (filetype_id, 2, enum_val); - assertTrue("Incorrect value for enum member", enum_val[0]==12); + H5.H5Tget_member_value(filetype_id, 2, enum_val); + assertTrue("Incorrect value for enum member", enum_val[0] == 12); // Query member name by member value, for enumeration type enum_val[0] = 14; - enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16); - assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW")==0); + enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16); + assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -268,14 +306,19 @@ public class TestH5T { } finally { if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Tenum_create_functions() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - byte[] enum_val = new byte[1]; + public void testH5Tenum_create_functions() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + byte[] enum_val = new byte[1]; // Create a enumerate datatype try { @@ -287,15 +330,15 @@ public class TestH5T { } assertTrue("testH5Tenum_create_functions:H5Tcreate", filetype_id >= 0); try { - enum_val[0]=10; + enum_val[0] = 10; H5.H5Tenum_insert(filetype_id, "RED", enum_val); - enum_val[0]=11; + enum_val[0] = 11; H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); - enum_val[0]=12; + enum_val[0] = 12; H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); - enum_val[0]=13; + enum_val[0] = 13; H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); - enum_val[0]=14; + enum_val[0] = 14; H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); // Query member number and member index by member name, for enumeration type. @@ -308,14 +351,19 @@ public class TestH5T { } finally { if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Topaque_functions() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - String opaque_name = null; + public void testH5Topaque_functions() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + String opaque_name = null; // Create a opaque datatype try { @@ -330,7 +378,7 @@ public class TestH5T { try { H5.H5Tset_tag(filetype_id, "opaque type"); opaque_name = H5.H5Tget_tag(filetype_id); - assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type")==0); + assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type") == 0); } catch (Throwable err) { err.printStackTrace(); @@ -338,67 +386,83 @@ public class TestH5T { } finally { if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } } } @Test - public void testH5Tvlen_create() { + public void testH5Tvlen_create() + { long filetype_id = HDF5Constants.H5I_INVALID_HID; - try { - filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); - assertTrue("testH5Tvlen_create", filetype_id >= 0); - - // Check if datatype is VL type - int vlclass = H5.H5Tget_class(filetype_id); - assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); - assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tvlen_create.H5Tvlen_create " + err); - } - finally { - if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} - } + try { + filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tvlen_create", filetype_id >= 0); + + // Check if datatype is VL type + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tvlen_create.H5Tvlen_create " + err); + } + finally { + if (filetype_id >= 0) + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } + } } @Test - public void testH5Tis_variable_str() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; - - try { - filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); - assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0); - - // Convert to variable-length string - H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE); - - // Check if datatype is VL string - int vlclass = H5.H5Tget_class(filetype_id); - assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); - assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); - - assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id)); - - // Verify that the class detects as a string - assertTrue("testH5Tis_variable_str:H5Tdetect_class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING)); - } - catch (Throwable err) { - err.printStackTrace(); - fail("testH5Tis_variable_str " + err); - } - finally { - if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} - } + public void testH5Tis_variable_str() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; + + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0); + + // Convert to variable-length string + H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE); + + // Check if datatype is VL string + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + + assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id)); + + // Verify that the class detects as a string + assertTrue("testH5Tis_variable_str:H5Tdetect_class", + H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tis_variable_str " + err); + } + finally { + if (filetype_id >= 0) + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } + } } @Test - public void testH5Tcompound_functions() { - long filetype_id = HDF5Constants.H5I_INVALID_HID; + public void testH5Tcompound_functions() + { + long filetype_id = HDF5Constants.H5I_INVALID_HID; // Create a compound datatype try { @@ -420,28 +484,34 @@ public class TestH5T { // We started to support this function for compound type in 1.8.6 release. int order = H5.H5Tget_order(filetype_id); assertFalse("Can't get order for compound type.", order == HDF5Constants.H5T_ORDER_ERROR); - assertTrue("Wrong order for this type.", (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE)); + assertTrue("Wrong order for this type.", + (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE)); // Make certain that the correct classes can be detected - assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND)); + assertTrue("Can't get correct class", + H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND)); assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_FLOAT)); // Make certain that an incorrect class is not detected assertFalse("Can get incorrect class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_TIME)); // Query member name by member index - String index_name = H5.H5Tget_member_name (filetype_id, 0); - assertTrue("Incorrect name for member index", index_name.compareTo("Lon")==0); + String index_name = H5.H5Tget_member_name(filetype_id, 0); + assertTrue("Incorrect name for member index", index_name.compareTo("Lon") == 0); // Query member offset by member no - long index_offset = H5.H5Tget_member_offset (filetype_id, 1); + long index_offset = H5.H5Tget_member_offset(filetype_id, 1); assertTrue("Incorrect offset for member no", index_offset == 8); // Query member type by member index - long index_type = H5.H5Tget_member_type (filetype_id, 0); - assertTrue("Incorrect type for member index", H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type)); + long index_type = H5.H5Tget_member_type(filetype_id, 0); + assertTrue("Incorrect type for member index", + H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type)); if (index_type >= 0) - try {H5.H5Tclose(index_type);} catch (Exception ex) {} - + try { + H5.H5Tclose(index_type); + } + catch (Exception ex) { + } } catch (Throwable err) { err.printStackTrace(); @@ -449,8 +519,11 @@ public class TestH5T { } finally { if (filetype_id >= 0) - try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + try { + H5.H5Tclose(filetype_id); + } + catch (Exception ex) { + } } } - } diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java index 7aac2ab..8fb1e58 100644 --- a/java/test/TestH5Tbasic.java +++ b/java/test/TestH5Tbasic.java @@ -15,6 +15,7 @@ package test; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; @@ -25,24 +26,28 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Tbasic { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test - public void testH5Tcopy() { + public void testH5Tcopy() + { long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); - assertTrue("H5.H5Tcopy",H5strdid > 0); + assertTrue("H5.H5Tcopy", H5strdid > 0); } catch (Throwable err) { err.printStackTrace(); @@ -50,18 +55,23 @@ public class TestH5Tbasic { } finally { if (H5strdid >= 0) - try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5strdid); + } + catch (Exception ex) { + } } } @Test - public void testH5Tequal() { + public void testH5Tequal() + { long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); - assertTrue("H5.H5Tcopy",H5strdid > 0); + assertTrue("H5.H5Tcopy", H5strdid > 0); boolean teq = H5.H5Tequal(HDF5Constants.H5T_C_S1, H5strdid); - assertTrue("H5.H5Tequal",teq); + assertTrue("H5.H5Tequal", teq); } catch (Throwable err) { err.printStackTrace(); @@ -69,18 +79,23 @@ public class TestH5Tbasic { } finally { if (H5strdid >= 0) - try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5strdid); + } + catch (Exception ex) { + } } } @Test - public void testH5Tequal_not() { + public void testH5Tequal_not() + { long H5strdid = HDF5Constants.H5I_INVALID_HID; try { H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE); - assertTrue("H5.H5Tcopy",H5strdid > 0); + assertTrue("H5.H5Tcopy", H5strdid > 0); boolean teq = H5.H5Tequal(HDF5Constants.H5T_IEEE_F32BE, H5strdid); - assertFalse("H5.H5Tequal",teq); + assertFalse("H5.H5Tequal", teq); } catch (Throwable err) { err.printStackTrace(); @@ -88,22 +103,27 @@ public class TestH5Tbasic { } finally { if (H5strdid >= 0) - try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5strdid); + } + catch (Exception ex) { + } } } @Test - public void testH5Tconvert() { - String[] strs = {"a1234","b1234"}; - int srcLen = 5; - int dstLen = 10; - long srcId = HDF5Constants.H5I_INVALID_HID; - long dstId = HDF5Constants.H5I_INVALID_HID; - int dimSize = strs.length; - byte[] buf = new byte[dimSize*dstLen]; - - for (int i=0; i<dimSize; i++) - System.arraycopy(strs[i].getBytes(), 0, buf, i*srcLen, 5); + public void testH5Tconvert() + { + String[] strs = {"a1234", "b1234"}; + int srcLen = 5; + int dstLen = 10; + long srcId = HDF5Constants.H5I_INVALID_HID; + long dstId = HDF5Constants.H5I_INVALID_HID; + int dimSize = strs.length; + byte[] buf = new byte[dimSize * dstLen]; + + for (int i = 0; i < dimSize; i++) + System.arraycopy(strs[i].getBytes(), 0, buf, i * srcLen, 5); try { srcId = H5.H5Tcopy(HDF5Constants.H5T_C_S1); @@ -119,22 +139,31 @@ public class TestH5Tbasic { fail("testH5Tconvert: " + err); } finally { - try {H5.H5Tclose(srcId);} catch (Exception ex) {} - try {H5.H5Tclose(dstId);} catch (Exception ex) {} + try { + H5.H5Tclose(srcId); + } + catch (Exception ex) { + } + try { + H5.H5Tclose(dstId); + } + catch (Exception ex) { + } } - for (int i=0; i<strs.length; i++) { - assertTrue((new String(buf, i*dstLen, dstLen)).startsWith(strs[i])); + for (int i = 0; i < strs.length; i++) { + assertTrue((new String(buf, i * dstLen, dstLen)).startsWith(strs[i])); } } @Test - public void testH5Torder_size() { + public void testH5Torder_size() + { long H5strdid = HDF5Constants.H5I_INVALID_HID; try { // Fixed length string H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); - assertTrue("H5.H5Tcopy",H5strdid > 0); + assertTrue("H5.H5Tcopy", H5strdid > 0); H5.H5Tset_size(H5strdid, (long)5); assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid)); H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_NONE); @@ -152,7 +181,11 @@ public class TestH5Tbasic { } finally { if (H5strdid >= 0) - try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + try { + H5.H5Tclose(H5strdid); + } + catch (Exception ex) { + } } } } diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java index 92a034c..a1710af 100644 --- a/java/test/TestH5Tparams.java +++ b/java/test/TestH5Tparams.java @@ -13,6 +13,7 @@ package test; import static org.junit.Assert.assertTrue; + import hdf.hdf5lib.H5; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -23,385 +24,459 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Tparams { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } - @Test//(expected = HDF5LibraryException.class) - public void testH5Tclose_invalid() throws Throwable { + @Test //(expected = HDF5LibraryException.class) + public void testH5Tclose_invalid() throws Throwable + { long tid = H5.H5Tclose(-1); assertTrue(tid == 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tcopy_invalid() throws Throwable { + public void testH5Tcopy_invalid() throws Throwable + { H5.H5Tcopy(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tequal_invalid() throws Throwable { + public void testH5Tequal_invalid() throws Throwable + { H5.H5Tequal(-1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tlock_invalid() throws Throwable { + public void testH5Tlock_invalid() throws Throwable + { H5.H5Tlock(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_class_invalid() throws Throwable { + public void testH5Tget_class_invalid() throws Throwable + { H5.H5Tget_class(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_size_invalid() throws Throwable { + public void testH5Tget_size_invalid() throws Throwable + { H5.H5Tget_size(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_size_invalid() throws Throwable { + public void testH5Tset_size_invalid() throws Throwable + { H5.H5Tset_size(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_order_invalid() throws Throwable { + public void testH5Tget_order_invalid() throws Throwable + { H5.H5Tget_order(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_order_invalid() throws Throwable { + public void testH5Tset_order_invalid() throws Throwable + { H5.H5Tset_order(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_precision_invalid() throws Throwable { + public void testH5Tget_precision_invalid() throws Throwable + { H5.H5Tget_precision(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_precision_long_invalid() throws Throwable { + public void testH5Tget_precision_long_invalid() throws Throwable + { H5.H5Tget_precision_long(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_precision_invalid() throws Throwable { + public void testH5Tset_precision_invalid() throws Throwable + { H5.H5Tset_precision(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_offset_invalid() throws Throwable { + public void testH5Tget_offset_invalid() throws Throwable + { H5.H5Tget_offset(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_offset_invalid() throws Throwable { + public void testH5Tset_offset_invalid() throws Throwable + { H5.H5Tset_offset(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tcreate_invalid() throws Throwable { + public void testH5Tcreate_invalid() throws Throwable + { H5.H5Tcreate(-1, (long)0); } @Test(expected = NullPointerException.class) - public void testH5Topen_null() throws Throwable { + public void testH5Topen_null() throws Throwable + { H5.H5Topen(-1, null, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Topen_invalid() throws Throwable { + public void testH5Topen_invalid() throws Throwable + { H5.H5Topen(-1, "Bogus", 0); } @Test(expected = NullPointerException.class) - public void testH5Tcommit_null() throws Throwable { + public void testH5Tcommit_null() throws Throwable + { H5.H5Tcommit(-1, null, 0, -1, -1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tcommit_invalid() throws Throwable { + public void testH5Tcommit_invalid() throws Throwable + { H5.H5Tcommit(-1, "Bogus", -1, -1, -1, -1); } @Test(expected = NullPointerException.class) - public void testH5Tget_pad_null() throws Throwable { + public void testH5Tget_pad_null() throws Throwable + { H5.H5Tget_pad(-1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_pad_invalid() throws Throwable { + public void testH5Tget_pad_invalid() throws Throwable + { int[] pad = new int[2]; H5.H5Tget_pad(-1, pad); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_pad_invalid() throws Throwable { + public void testH5Tset_pad_invalid() throws Throwable + { H5.H5Tset_pad(-1, -1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_sign_invalid() throws Throwable { + public void testH5Tget_sign_invalid() throws Throwable + { H5.H5Tget_sign(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_sign_invalid() throws Throwable { + public void testH5Tset_sign_invalid() throws Throwable + { H5.H5Tset_sign(-1, 0); } @Test(expected = NullPointerException.class) - public void testH5Tget_fields_null() throws Throwable { + public void testH5Tget_fields_null() throws Throwable + { H5.H5Tget_fields(-1, (long[])null); } @Test(expected = IllegalArgumentException.class) - public void testH5Tget_fields_length_invalid() throws Throwable { + public void testH5Tget_fields_length_invalid() throws Throwable + { long[] fields = new long[2]; H5.H5Tget_fields(-1, fields); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_fields_invalid() throws Throwable { + public void testH5Tget_fields_invalid() throws Throwable + { long[] fields = new long[5]; H5.H5Tget_fields(-1, fields); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_fields_invalid() throws Throwable { + public void testH5Tset_fields_invalid() throws Throwable + { H5.H5Tset_fields(-1, -1, -1, -1, -1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_ebias_invalid() throws Throwable { + public void testH5Tget_ebias_invalid() throws Throwable + { H5.H5Tget_ebias(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_ebias_long_invalid() throws Throwable { + public void testH5Tget_ebias_long_invalid() throws Throwable + { H5.H5Tget_ebias_long(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_ebias_invalid() throws Throwable { + public void testH5Tset_ebias_invalid() throws Throwable + { H5.H5Tset_ebias(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_norm_invalid() throws Throwable { + public void testH5Tget_norm_invalid() throws Throwable + { H5.H5Tget_norm(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_norm_invalid() throws Throwable { + public void testH5Tset_norm_invalid() throws Throwable + { H5.H5Tset_norm(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_inpad_invalid() throws Throwable { + public void testH5Tget_inpad_invalid() throws Throwable + { H5.H5Tget_inpad(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_inpad_invalid() throws Throwable { + public void testH5Tset_inpad_invalid() throws Throwable + { H5.H5Tset_inpad(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_cset_invalid() throws Throwable { + public void testH5Tget_cset_invalid() throws Throwable + { H5.H5Tget_cset(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_cset_invalid() throws Throwable { + public void testH5Tset_cset_invalid() throws Throwable + { H5.H5Tset_cset(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_strpad_invalid() throws Throwable { + public void testH5Tget_strpad_invalid() throws Throwable + { H5.H5Tget_strpad(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_strpad_invalid() throws Throwable { + public void testH5Tset_strpad_invalid() throws Throwable + { H5.H5Tset_strpad(-1, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_nmembers_invalid() throws Throwable { + public void testH5Tget_nmembers_invalid() throws Throwable + { H5.H5Tget_nmembers(-1); } @Test(expected = NullPointerException.class) - public void testH5Tget_member_index_null() throws Throwable { + public void testH5Tget_member_index_null() throws Throwable + { H5.H5Tget_member_index(-1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_member_index_invalid() throws Throwable { + public void testH5Tget_member_index_invalid() throws Throwable + { H5.H5Tget_member_index(-1, "Bogus"); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_member_type_invalid() throws Throwable { + public void testH5Tget_member_type_invalid() throws Throwable + { H5.H5Tget_member_type(-1, -1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_member_class_invalid() throws Throwable { + public void testH5Tget_member_class_invalid() throws Throwable + { H5.H5Tget_member_class(-1, -1); } @Test(expected = NullPointerException.class) - public void testH5Tinsert_null() throws Throwable { + public void testH5Tinsert_null() throws Throwable + { H5.H5Tinsert(-1, null, 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tinsert_invalid() throws Throwable { + public void testH5Tinsert_invalid() throws Throwable + { H5.H5Tinsert(-1, "Bogus", 0, 0); } @Test(expected = HDF5LibraryException.class) - public void testH5Tpack_invalid() throws Throwable { + public void testH5Tpack_invalid() throws Throwable + { H5.H5Tpack(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Treclaim_invalid() throws Throwable { + public void testH5Treclaim_invalid() throws Throwable + { byte[] buf = new byte[2]; H5.H5Treclaim(-1, -1, -1, buf); } @Test(expected = NullPointerException.class) - public void testH5Treclaim_null() throws Throwable { + public void testH5Treclaim_null() throws Throwable + { H5.H5Treclaim(-1, -1, -1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tvlen_create_invalid() throws Throwable { + public void testH5Tvlen_create_invalid() throws Throwable + { H5.H5Tvlen_create(-1); } @Test(expected = NullPointerException.class) - public void testH5Tset_tag_null() throws Throwable { + public void testH5Tset_tag_null() throws Throwable + { H5.H5Tset_tag(-1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tset_tag_invalid() throws Throwable { + public void testH5Tset_tag_invalid() throws Throwable + { H5.H5Tset_tag(-1, "Bogus"); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_super_invalid() throws Throwable { + public void testH5Tget_super_invalid() throws Throwable + { H5.H5Tget_super(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tenum_create_invalid() throws Throwable { + public void testH5Tenum_create_invalid() throws Throwable + { H5.H5Tenum_create(-1); } @Test(expected = NullPointerException.class) - public void testH5Tenum_insert_name_null() throws Throwable { + public void testH5Tenum_insert_name_null() throws Throwable + { H5.H5Tenum_insert(-1, null, (byte[])null); } @Test(expected = NullPointerException.class) - public void testH5Tenum_insert_null() throws Throwable { + public void testH5Tenum_insert_null() throws Throwable + { H5.H5Tenum_insert(-1, "bogus", (byte[])null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tenum_insert_invalid() throws Throwable { + public void testH5Tenum_insert_invalid() throws Throwable + { byte[] enumtype = new byte[2]; H5.H5Tenum_insert(-1, "bogus", enumtype); } @Test(expected = IllegalArgumentException.class) - public void testH5Tenum_nameof_invalid_size() throws Throwable { + public void testH5Tenum_nameof_invalid_size() throws Throwable + { H5.H5Tenum_nameof(-1, null, -1); } @Test(expected = NullPointerException.class) - public void testH5Tenum_nameof_value_null() throws Throwable { + public void testH5Tenum_nameof_value_null() throws Throwable + { H5.H5Tenum_nameof(-1, null, 1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tenum_nameof_invalid() throws Throwable { + public void testH5Tenum_nameof_invalid() throws Throwable + { byte[] btype = new byte[2]; H5.H5Tenum_nameof(-1, btype, 1); } @Test(expected = NullPointerException.class) - public void testH5Tenum_valueof_name_null() throws Throwable { + public void testH5Tenum_valueof_name_null() throws Throwable + { H5.H5Tenum_valueof(-1, null, (byte[])null); } @Test(expected = NullPointerException.class) - public void testH5Tenum_valueof_null() throws Throwable { + public void testH5Tenum_valueof_null() throws Throwable + { H5.H5Tenum_valueof(-1, "bogus", (byte[])null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tenum_valueof_invalid() throws Throwable { + public void testH5Tenum_valueof_invalid() throws Throwable + { byte[] btype = new byte[2]; H5.H5Tenum_valueof(-1, "bogus", btype); } @Test(expected = NullPointerException.class) - public void testH5Tget_member_value_null() throws Throwable { + public void testH5Tget_member_value_null() throws Throwable + { H5.H5Tget_member_value(-1, -1, (byte[])null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_member_value_invalid() throws Throwable { + public void testH5Tget_member_value_invalid() throws Throwable + { byte[] btype = new byte[2]; H5.H5Tget_member_value(-1, -1, btype); } @Test(expected = IllegalArgumentException.class) - public void testH5Tarray_create_invalid() throws Throwable { + public void testH5Tarray_create_invalid() throws Throwable + { H5.H5Tarray_create(-1, -1, null); } @Test(expected = NullPointerException.class) - public void testH5Tarray_create_value_null() throws Throwable { + public void testH5Tarray_create_value_null() throws Throwable + { H5.H5Tarray_create(-1, 1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_array_ndims_invalid() throws Throwable { + public void testH5Tget_array_ndims_invalid() throws Throwable + { H5.H5Tget_array_ndims(-1); } @Test(expected = NullPointerException.class) - public void testH5Tget_array_dims_null() throws Throwable { + public void testH5Tget_array_dims_null() throws Throwable + { H5.H5Tget_array_dims(-1, null); } @Test(expected = HDF5LibraryException.class) - public void testH5Tget_native_type_invalid() throws Throwable { + public void testH5Tget_native_type_invalid() throws Throwable + { H5.H5Tget_native_type(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Tflush_invalid() throws Throwable { + public void testH5Tflush_invalid() throws Throwable + { H5.H5Tflush(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5Trefresh_invalid() throws Throwable { + public void testH5Trefresh_invalid() throws Throwable + { H5.H5Trefresh(-1); } - } diff --git a/java/test/TestH5VL.java b/java/test/TestH5VL.java index 4253d20..99505ae 100644 --- a/java/test/TestH5VL.java +++ b/java/test/TestH5VL.java @@ -16,12 +16,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + +import java.io.File; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; -import java.io.File; - import org.junit.After; import org.junit.Before; import org.junit.Rule; @@ -29,28 +30,37 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5VL { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); - private final void _deleteFile(String filename) { + private final void _deleteFile(String filename) + { File file = new File(filename); if (file.exists()) { - try {file.delete();} catch (SecurityException e) {} + try { + file.delete(); + } + catch (SecurityException e) { + } } } @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test - public void testH5VLnative_init() { + public void testH5VLnative_init() + { try { boolean is_registered; @@ -70,11 +80,12 @@ public class TestH5VL { } @Test - public void testH5VLget_connector_id() { + public void testH5VLget_connector_id() + { String H5_FILE = "testFvl.h5"; - long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); try { long native_id = H5.H5VLget_connector_id(H5fid); @@ -95,14 +106,19 @@ public class TestH5VL { } finally { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } _deleteFile(H5_FILE); } } @Test - public void testH5VLget_connector_id_by_name() { + public void testH5VLget_connector_id_by_name() + { try { long native_id = H5.H5VLget_connector_id_by_name(HDF5Constants.H5VL_NATIVE_NAME); assertTrue("H5.H5VLget_connector_id_by_name H5VL_NATIVE_NAME", native_id >= 0); @@ -115,7 +131,8 @@ public class TestH5VL { } @Test - public void testH5VLget_connector_id_by_value() { + public void testH5VLget_connector_id_by_value() + { try { long native_id = H5.H5VLget_connector_id_by_value(HDF5Constants.H5VL_NATIVE_VALUE); assertTrue("H5.H5VLget_connector_id_by_value H5VL_NATIVE_VALUE", native_id >= 0); @@ -128,11 +145,12 @@ public class TestH5VL { } @Test - public void testH5VLget_connector_name() { + public void testH5VLget_connector_name() + { String H5_FILE = "testFvl.h5"; - long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + long H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); try { @@ -145,7 +163,8 @@ public class TestH5VL { */ String connector = System.getenv("HDF5_VOL_CONNECTOR"); if (connector == null) - assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME)==0); + assertTrue("H5.H5VLget_connector_name H5VL_NATIVE", + native_name.compareToIgnoreCase(HDF5Constants.H5VL_NATIVE_NAME) == 0); } catch (Throwable err) { err.printStackTrace(); @@ -153,20 +172,25 @@ public class TestH5VL { } finally { if (H5fid > 0) { - try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + try { + H5.H5Fclose(H5fid); + } + catch (Exception ex) { + } } _deleteFile(H5_FILE); } } @Test(expected = HDF5LibraryException.class) - public void testH5VLclose_NegativeID() throws Throwable { + public void testH5VLclose_NegativeID() throws Throwable + { H5.H5VLclose(-1); } @Test(expected = HDF5LibraryException.class) - public void testH5VLunregister_connector_NegativeID() throws Throwable { + public void testH5VLunregister_connector_NegativeID() throws Throwable + { H5.H5VLunregister_connector(-1); } } - diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java index fde8f1a..bc6bfc0 100644 --- a/java/test/TestH5Z.java +++ b/java/test/TestH5Z.java @@ -14,6 +14,7 @@ package test; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; + import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5LibraryException; @@ -25,20 +26,24 @@ import org.junit.Test; import org.junit.rules.TestName; public class TestH5Z { - @Rule public TestName testname = new TestName(); + @Rule + public TestName testname = new TestName(); @Before - public void checkOpenIDs() { - assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + public void checkOpenIDs() + { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); System.out.print(testname.getMethodName()); } @After - public void nextTestName() { + public void nextTestName() + { System.out.println(); } @Test - public void testH5Zfilter_avail() { + public void testH5Zfilter_avail() + { try { int filter_found; @@ -64,34 +69,46 @@ public class TestH5Z { } @Test - public void testH5Zget_filter_info() { + public void testH5Zget_filter_info() + { try { int filter_flag; filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); - assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); - assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); - assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); - assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); - if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { + if (1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE)) { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); - assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); - assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); } - if(1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { + if (1 == H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP)) { filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); // Decode should always be available, but we have no way of determining // if encode is so don't assert on that. - assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", + (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); } } catch (Throwable err) { @@ -101,7 +118,8 @@ public class TestH5Z { } @Test(expected = HDF5LibraryException.class) - public void testH5Zunregister_predefined() throws Throwable { + public void testH5Zunregister_predefined() throws Throwable + { int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); assertTrue("H5.H5Zfilter_avail", filter_found > 0); |