summaryrefslogtreecommitdiffstats
path: root/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2022-04-19 18:08:09 (GMT)
committerGitHub <noreply@github.com>2022-04-19 18:08:09 (GMT)
commit03c3a5469542688a52d5a20242d2334408f8ba33 (patch)
tree46e30ea4aa99b68279fe80c9ad56b1a6bbfcfe7c /java/examples/datatypes/H5Ex_T_ArrayAttribute.java
parent32ef796e470da3e4de364d8dc469b03f5f6fafdc (diff)
downloadhdf5-03c3a5469542688a52d5a20242d2334408f8ba33.zip
hdf5-03c3a5469542688a52d5a20242d2334408f8ba33.tar.gz
hdf5-03c3a5469542688a52d5a20242d2334408f8ba33.tar.bz2
Develop clang format java (#1653)
Diffstat (limited to 'java/examples/datatypes/H5Ex_T_ArrayAttribute.java')
-rw-r--r--java/examples/datatypes/H5Ex_T_ArrayAttribute.java67
1 files changed, 34 insertions, 33 deletions
diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
index c4c4bc4..45b44c1 100644
--- a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
+++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java
@@ -24,24 +24,25 @@ import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
public class H5Ex_T_ArrayAttribute {
- private static String FILENAME = "H5Ex_T_ArrayAttribute.h5";
- private static String DATASETNAME = "DS1";
+ private static String FILENAME = "H5Ex_T_ArrayAttribute.h5";
+ private static String DATASETNAME = "DS1";
private static String ATTRIBUTENAME = "A1";
- private static final int DIM0 = 4;
- private static final int ADIM0 = 3;
- private static final int ADIM1 = 5;
- private static final int RANK = 1;
- private static final int NDIMS = 2;
-
- private static void CreateDataset() {
- long file_id = HDF5Constants.H5I_INVALID_HID;
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- long memtype_id = HDF5Constants.H5I_INVALID_HID;
- long dataspace_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
- long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long[] dims = { DIM0 };
- long[] adims = { ADIM0, ADIM1 };
+ private static final int DIM0 = 4;
+ private static final int ADIM0 = 3;
+ private static final int ADIM1 = 5;
+ private static final int RANK = 1;
+ private static final int NDIMS = 2;
+
+ private static void CreateDataset()
+ {
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataspace_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ long attribute_id = HDF5Constants.H5I_INVALID_HID;
+ long[] dims = {DIM0};
+ long[] adims = {ADIM0, ADIM1};
int[][][] dset_data = new int[DIM0][ADIM0][ADIM1];
// Initialize data. indx is the element in the dataspace, jndx and kndx the
@@ -54,7 +55,7 @@ public class H5Ex_T_ArrayAttribute {
// 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();
@@ -81,7 +82,8 @@ public class H5Ex_T_ArrayAttribute {
dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR);
if (dataspace_id >= 0) {
dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT,
+ HDF5Constants.H5P_DEFAULT);
H5.H5Sclose(dataspace_id);
dataspace_id = HDF5Constants.H5I_INVALID_HID;
}
@@ -103,7 +105,7 @@ public class H5Ex_T_ArrayAttribute {
try {
if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0))
attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id,
- HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
}
catch (Exception e) {
e.printStackTrace();
@@ -170,17 +172,17 @@ public class H5Ex_T_ArrayAttribute {
catch (Exception e) {
e.printStackTrace();
}
-
}
- private static void ReadDataset() {
- long file_id = HDF5Constants.H5I_INVALID_HID;
- long filetype_id = HDF5Constants.H5I_INVALID_HID;
- long memtype_id = HDF5Constants.H5I_INVALID_HID;
- long dataset_id = HDF5Constants.H5I_INVALID_HID;
+ private static void ReadDataset()
+ {
+ long file_id = HDF5Constants.H5I_INVALID_HID;
+ long filetype_id = HDF5Constants.H5I_INVALID_HID;
+ long memtype_id = HDF5Constants.H5I_INVALID_HID;
+ long dataset_id = HDF5Constants.H5I_INVALID_HID;
long attribute_id = HDF5Constants.H5I_INVALID_HID;
- long[] dims = { DIM0 };
- long[] adims = { ADIM0, ADIM1 };
+ long[] dims = {DIM0};
+ long[] adims = {ADIM0, ADIM1};
int[][][] dset_data;
// Open an existing file.
@@ -203,7 +205,7 @@ public class H5Ex_T_ArrayAttribute {
try {
if (dataset_id >= 0)
attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT,
- HDF5Constants.H5P_DEFAULT);
+ HDF5Constants.H5P_DEFAULT);
}
catch (Exception e) {
e.printStackTrace();
@@ -229,7 +231,7 @@ public class H5Ex_T_ArrayAttribute {
// Allocate array of pointers to two-dimensional arrays (the
// elements of the dataset.
- dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])];
+ dset_data = new int[(int)dims[0]][(int)(adims[0])][(int)(adims[1])];
// Create array datatypes for memory.
try {
@@ -304,10 +306,10 @@ public class H5Ex_T_ArrayAttribute {
catch (Exception e) {
e.printStackTrace();
}
-
}
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
H5Ex_T_ArrayAttribute.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
@@ -315,5 +317,4 @@ public class H5Ex_T_ArrayAttribute {
// data using malloc().
H5Ex_T_ArrayAttribute.ReadDataset();
}
-
}