diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-04-22 15:24:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 15:24:27 (GMT) |
commit | 974aefb8416d78b0687a54e5f72f21d0ca72ae2d (patch) | |
tree | 0fe4e4327b95c38f362ceace220d59cb08aa88a3 /java/examples/intro | |
parent | f5042fd4d3549e9e3453ab99d81bb46f1688b240 (diff) | |
download | hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.zip hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.gz hdf5-974aefb8416d78b0687a54e5f72f21d0ca72ae2d.tar.bz2 |
Add java clang-format (#1672)
Diffstat (limited to 'java/examples/intro')
-rw-r--r-- | java/examples/intro/CMakeLists.txt | 7 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateAttribute.java | 38 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateDataset.java | 28 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateFile.java | 11 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateGroup.java | 19 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateGroupAbsoluteRelative.java | 27 | ||||
-rw-r--r-- | java/examples/intro/H5_CreateGroupDataset.java | 68 | ||||
-rw-r--r-- | java/examples/intro/H5_ReadWrite.java | 35 |
8 files changed, 117 insertions, 116 deletions
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(); } } |