<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_121) on Tue Mar 14 11:36:17 CDT 2017 -->
<title>Overview (HDF\ Java)</title>
<meta name="date" content="2017-03-14">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
    try {
        if (location.href.indexOf('is-external=true') == -1) {
            parent.document.title="Overview (HDF\\ Java)";
        }
    }
    catch(err) {
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li><a href="hdf/hdflib/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip.navbar.top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 class="title"><h1>HDF\ Java\ Wrapper</h1></h1>
</div>
<div class="header">
<div class="subTitle">
<div class="block">Java HDF Interface (JHI4)</div>
</div>
<p>See: <a href="#overview.description">Description</a></p>
</div>
<div class="contentContainer">
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Packages table, listing packages, and an explanation">
<caption><span>Packages</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Package</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="hdf/hdflib/package-summary.html">hdf.hdflib</a></td>
<td class="colLast">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<div class="contentContainer"><a name="overview.description">
<!--   -->
</a>
<div class="block"><h1>Java HDF Interface (JHI4)</h1>
<h2><u>What it is</u></h2>
The <b>Java HDF Interface (JHI4)</b> is a Java package
(<a href="../../hdf-java-html/javadocs/hdf/hdflib/package-summary.html">hdf.hdflib</a>)
that ``wraps around'' the HDF library.
<p />There are a large number of functions in the HDF
library (version 4.2). Some of the functions are not supported in JHI4.
<center><table BORDER=1 COLS=1 WIDTH="71%" BGCOLOR="#dbeaf5" >
<tr>
<td>
<center>Note: The JHI4 only supports HDF4.</center>
</td>
</tr>
</table></center>
<p>The JHI4 may be used by any Java application that needs to access HDF
files. It is extremely important to emphasize that <i>this package is not
a pure Java implementation of the HDF library.</i> The JHI4 calls the
same HDF library that is used by C or FORTRAN programs. (Note that this
product cannot be used in most network browsers because it accesses the
local disk using native code.)
<p>The Java HDF Interface consists of Java classes and a dynamically
linked native library. The Java classes declare native methods, and the
library contains C functions which implement the native methods. The C
functions call the standard HDF library, which is linked as part of the
same library on most platforms.
<p>The central part of the JHI4 is the Java class <i>
<a href="../../hdf-java-html/javadocs/hdf/hdflib/HDFLibrary.html">hdf.hdflib.HDFLibrary</a></i>.
The <i>HDFLibrary</i> class calls the standard (<i>i.e.</i>, `native' code) HDF
library, with native methods for most of the HDF4functions.
<h3>
<u>How to use it</u></h3>
The JHI4 is used by Java classes to call the HDF library, in order to
create HDF files, and read and write data in existing HDF files.
<p>For example, the HDF library has the function <b>Hopen</b> to open
an HDF file. The Java interface is the class <i>
<a href="../../hdf-java-html/javadocs/hdf/hdflib/HDFLibrary.html">hdf.hdflib.HDFLibrary</a></i>,
which has a method:
<pre><b>static native int Hopen(String filename, int flags, int access );</b></pre>
The native method is implemented in C using the
<a href="http://java.sun.com/javase/6/docs/technotes/guides/jni/index.html">Java
Native Method Interface </a>(JNI). This is written something like the following:
<pre><b>JNIEXPORT jint
JNICALL Java_hdf_hdflib_HDFLibrary_Hopen
(
&nbsp;JNIEnv *env,
&nbsp;jclass class,
&nbsp;jstring hdfFile,
&nbsp;jint flags,
&nbsp;jint access)
&nbsp;{
&nbsp;/* ...convert Java String to (char *) */
&nbsp;/* call the HDF library */
&nbsp;retVal = Hopen((char *)file, (unsigned)flags, (hid_t)access );
&nbsp;/* ... */
}</b></pre>
This C function calls the HDF library and returns the result appropriately.
<p>There is one native method for each HDF entry point (several hundred
in all), which are compiled with the HDF library into a dynamically loaded
library (<i>libhdf_java</i>). Note that this library must be built for each
platform.
<p>To call the HDF `<b><i>Hopen</i></b>' function, a Java program would
import the package '<i><b>hdf.hdflib.*</b>'</i>, and invoke the method
on the class '<b><i>HDFLibrary</i></b>'. The Java program would look something
like this:
<pre><b>import hdf.hdflib.*;
{
&nbsp;/* ... */
&nbsp;try {
&nbsp;file = HDFLibrary.Hopen("myFile.hdf", flags, access );
&nbsp;} catch (HDFException ex) {
&nbsp;//...
&nbsp;}
&nbsp;/* ... */
}</b></pre>
The <i><b>HDFLibrary</b> </i>class automatically loads the native method implementations
and the HDF library.
<h3>
<a NAME="DOWNLOAD"></a>To Obtain</h3>
The JHI4 is included with the <a href="http://www.hdfgroup.org/HDF/index.html">HDF</a> library.</div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!--   -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li class="navBarCell1Rev">Overview</li>
<li><a href="hdf/hdflib/package-summary.html">Package</a></li>
<li>Class</li>
<li>Use</li>
<li><a href="overview-tree.html">Tree</a></li>
<li><a href="deprecated-list.html">Deprecated</a></li>
<li><a href="index-all.html">Index</a></li>
<li><a href="help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>Prev</li>
<li>Next</li>
</ul>
<ul class="navList">
<li><a href="index.html?overview-summary.html" target="_top">Frames</a></li>
<li><a href="overview-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip.navbar.bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>