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/examples/datatypes/H5Ex_T_VLString.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/examples/datatypes/H5Ex_T_VLString.java')
-rw-r--r-- | java/examples/datatypes/H5Ex_T_VLString.java | 50 |
1 files changed, 26 insertions, 24 deletions
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(); } - } |