diff options
Diffstat (limited to 'java/examples/intro/H5_ReadWrite.java')
-rw-r--r-- | java/examples/intro/H5_ReadWrite.java | 35 |
1 files changed, 17 insertions, 18 deletions
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(); } } |