193 lines
5.4 KiB
HTML
193 lines
5.4 KiB
HTML
<!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> <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>
|
|
<br>
|
|
<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> <b>public static int H5Fopen_wrap (String name, int flags, int access_id)
|
|
{
|
|
int file_id = -1; // file identifier
|
|
try
|
|
{
|
|
// Create a new file using default file properties.
|
|
file_id = H5.H5Fopen (name, flags, access_id);
|
|
}
|
|
catch (HDF5Exception hdf5e)
|
|
{
|
|
System.out.println
|
|
("DatasetRdWt.H5Fopen_wrap() with HDF5Exception: "
|
|
+ hdf5e.getMessage());
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
System.out.println
|
|
("DatasetRdWt.H5Fopen_wrap() with other Exception: "
|
|
+ e.getMessage());
|
|
}
|
|
return file_id;
|
|
}</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>
|