diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2022-04-26 01:32:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-26 01:32:50 (GMT) |
commit | 41a36efde14a1db65cc8be0ef9de1ec41fe86ed6 (patch) | |
tree | 645c2a1b8d6eecc141cd0a063a3974bfdaaa8abe /java/examples/datatypes/H5Ex_T_Integer.java | |
parent | d19d9b4c8ace3c712cc8126e37f2a7e3ff68e8a9 (diff) | |
download | hdf5-41a36efde14a1db65cc8be0ef9de1ec41fe86ed6.zip hdf5-41a36efde14a1db65cc8be0ef9de1ec41fe86ed6.tar.gz hdf5-41a36efde14a1db65cc8be0ef9de1ec41fe86ed6.tar.bz2 |
Add java to format source (#1690)
Diffstat (limited to 'java/examples/datatypes/H5Ex_T_Integer.java')
-rw-r--r-- | java/examples/datatypes/H5Ex_T_Integer.java | 47 |
1 files changed, 24 insertions, 23 deletions
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(); } - } |