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/datasets/H5Ex_D_Transform.java | |
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/datasets/H5Ex_D_Transform.java')
-rw-r--r-- | java/examples/datasets/H5Ex_D_Transform.java | 55 |
1 files changed, 29 insertions, 26 deletions
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(); } - } |