summaryrefslogtreecommitdiffstats
path: root/doc/html/Tutor/examples/java/readme.html
blob: ac960042a632a4f5002da4fce472085f058774ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
   <title>readme</title>
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">

<h3>
<b>HDF 5 Tutorial Examples in Java</b></h3>

<p><br>These files are Java versions of the example programs used in the
HDF-5 tutoral:
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://hdf.ncsa.uiuc.edu/training/hdf5/">http://hdf.ncsa.uiuc.edu/training/hdf5/</a>
<p>The examples here correspond to the examples explained in the first
13 sections of the tutorial.
<br>&nbsp;
<br>&nbsp;
<table BORDER CELLPADDING=2 WIDTH="100%" >
<tr>
<td>
<center><b>Lesson</b></center>
</td>

<td>
<center><b>Topic</b></center>
</td>

<td>
<center><b>C file</b></center>
</td>

<td>
<center><b>Java file</b></center>
</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtfile.html">Lesson
4</a></td>

<td>Create an HDF-5 file.</td>

<td>h5_crtfile.c</td>

<td>CreateFile.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtdat.html">Lesson
5</a></td>

<td>Create a Dataset in an HDF-5 file</td>

<td>h5_crtdat.c</td>

<td>CreateDataset.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/rdwt.html">Lesson 6</a></td>

<td>Write and Read data in a dataset</td>

<td>h5_rdwt.c</td>

<td>DatasetRdWt.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtatt.html">Lesson
7</a></td>

<td>Create an attribute.</td>

<td>h5_crtatt.c</td>

<td>CreateAttribute.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtgrp.html">Lesson
8</a></td>

<td>Create a group.</td>

<td>h5_crtgrp.c</td>

<td>CreateGroup.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtgrpar.html">Lesson
9</a></td>

<td>Using Absolute and relative paths</td>

<td>h5_crtgrpar.c</td>

<td>CreateGroupAR.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/crtgrpd.html">Lesson
10</a></td>

<td>Create a dataset in a group.</td>

<td>h5_crtgrpd.c</td>

<td>CreateGroupDataset.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/compound.html">Lesson
11</a></td>

<td>Using Compound Datatypes</td>

<td>h5_compound.c</td>

<td>Compound.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/select.html">Lesson
12</a></td>

<td>Selection of a hyperslab.</td>

<td>h5_hyperslab.c</td>

<td>Hyperslab.java</td>
</tr>

<tr>
<td><a href="http://hdf.ncsa.uiuc.edu/training/hdf5/selectc.html">Lesson
13</a></td>

<td>Selection of elements.</td>

<td>h5_copy.c</td>

<td>Copy.java</td>
</tr>
</table>

<p>
<hr><b>Some Explanation About Tutorial Examples</b>
<p>The Java tutorial programs try to stay close to the corresponding C
program. The main function's structure almost same as C program, with one
call for each HDF5 library function. For example, where the C program has
a call to <b>H5Fopen()</b>, the Java program has a call to <b>H5Fopen_wrap()</b>.
<p>The wrapper functions call the HDF-5 library using the Java HDF-5 Interface
(JHI5). The HDF-5 C interface returns error codes; these are represented
by Java Exceptions in the JHI5. The wrapper function catches the exception
and prints a message.
<p>For example, the <b>H5Fopen_wrap() </b>method calls the JHI5, and catches
any exceptions which may occur:
<pre>&nbsp;&nbsp; <b>public static int H5Fopen_wrap (String name, int flags, int access_id)
&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int file_id = -1;&nbsp;&nbsp;&nbsp; // file identifier&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Create a new file using default file properties.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file_id = H5.H5Fopen (name, flags, access_id);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (HDF5Exception hdf5e)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("DatasetRdWt.H5Fopen_wrap() with HDF5Exception: "
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + hdf5e.getMessage());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception e)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ("DatasetRdWt.H5Fopen_wrap() with other Exception: "&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + e.getMessage());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return file_id;
&nbsp;&nbsp; }</b></pre>

<p><br>
<hr noshade size=1><a href="http://www.ncsa.uiuc.edu/"><img SRC="http://www.ncsa.uiuc.edu/Images/NCSAhome/footerlogo.gif" ALT="NCSA" BORDER=0 ></a>
<br><font face="arial,helvetica"><font size=-1><a href="http://www.ncsa.uiuc.edu/">The
National Center for Supercomputing Applications</a></font></font>
<br><font face="arial,helvetica"><font size=-1><a href="http://www.uiuc.edu/">University
of Illinois at Urbana-Champaign</a></font></font>
<p><font face="arial,helvetica"><font size=-1><a href="mailto:hdfhelp@ncsa.uiuc.edu">hdfhelp@ncsa.uiuc.edu</a></font></font>
</body>
</html>