[svn-r3562] Add to tutorial

Purpose:
    [is this a bug fix? feature? ...]
Description:
    [describe the bug, or describe the new feature, etc]
Solution:
    [details about the changes, algorithm, etc...]
    [Please as detail as you can since your own explanation is
    better than others guessing it from the code.]
Platforms tested:
    [machines you have tested the changed version.  This is absolute
    important.  Test it out on at least two or three different platforms
    such as Big-endian-32bit (SUN/IRIX), little-endian-32(LINUX) and
    64-bit (IRIX64/UNICOS/DEC-ALPHA) would be good.]
This commit is contained in:
Barbara Jones 2001-03-08 11:37:14 -05:00
parent 70cc09f8b6
commit d8c843156a
37 changed files with 3993 additions and 17 deletions

View File

@ -0,0 +1,540 @@
/******************************************************************
* Compound.java (for HDF5 tutorial lesson 11)
*
* -- Creating a compound data type
* (a java conversion from compound.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class Compound
{
public static void main (String []argv)
{
final String FILE = "SDScompound.h5";
final String DATASETNAME = "ArrayOfStructures";
final int LENGTH = 10;
final int RANK = 1;
/* First structure and dataset */
/* an array of LENGTH 'complex' numbers */
byte[] data1 = new byte[LENGTH * 16];
int[] AR = new int[1];
float[] BR = new float[1];
double[] CR = new double[1];
byte [] ARec = new byte[4];
byte [] BRec = new byte[4];
byte [] CRec = new byte[8];
int s1_tid; /* File datatype identifier */
/* Second structure (subset of s1_t) and dataset*/
byte[] data2 = new byte[LENGTH * 12];
int s2_tid; /* Memory datatype handle */
/* Third "structure" ( will be used to read float field of s1) */
int s3_tid; /* Memory datatype handle */
float[] s3 = new float[LENGTH];
int i;
int file, dataset, space; /* Handles */
int status;
long[] dim = new long[1]; /* Dataspace dimensions */
dim[0] = LENGTH;
/*
* Initialize the data
*/
for (i = 0; i < LENGTH; i++)
{
AR[0] = (int) i;
BR[0] = (float) i * i;
CR[0] = (double) 1. / (i + 1);
ARec = HDFNativeData.intToByte (0, 1, AR);
BRec = HDFNativeData.floatToByte (0, 1, BR);
CRec = HDFNativeData.doubleToByte (0, 1, CR);
System.arraycopy (ARec, 0, data1, (i * 16), 4);
System.arraycopy (BRec, 0, data1, (i * 16) + 4, 4);
System.arraycopy (CRec, 0, data1, (i * 16) + 8, 8);
}
/*
* Create the data space.
*/
space = H5Screate_simple_wrap (RANK, dim, null);
/*
* Create the file.
*/
file = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
/*
* Create the memory data type.
*/
s1_tid = H5Tcreate_wrap (HDF5Constants.H5T_COMPOUND, 16);
H5Tinsert_wrap (s1_tid, "a_name", 0,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT));
H5Tinsert_wrap (s1_tid, "b_name", 4,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_FLOAT));
H5Tinsert_wrap (s1_tid, "c_name", 8,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_DOUBLE));
/*
* Create the dataset.
*/
dataset = H5Dcreate_wrap (file, DATASETNAME, s1_tid,
space, HDF5Constants.H5P_DEFAULT);
/*
* Wtite data to the dataset;
*/
status = H5Dwrite_wrap (dataset, s1_tid,
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, data1);
/*
* Release resources
*/
H5Tclose_wrap (s1_tid);
H5Sclose_wrap (space);
H5Dclose_wrap (dataset);
H5Fclose_wrap (file);
/*
* Open the file and the dataset.
*/
file = H5Fopen_wrap (FILE, HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5P_DEFAULT);
dataset = H5Dopen_wrap (file, DATASETNAME);
/*
* Create a data type for s2
*/
s2_tid = H5Tcreate_wrap (HDF5Constants.H5T_COMPOUND, 12);
H5Tinsert_wrap (s2_tid, "c_name", 0,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_DOUBLE));
H5Tinsert_wrap (s2_tid, "a_name", 8,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT));
/*
* Read two fields c and a from s1 dataset. Fields in the file
* are found by their names "c_name" and "a_name".
*/
status = H5Dread_wrap (dataset, s2_tid, HDF5Constants.H5S_ALL,
HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, data2);
/*
* Display the fields. Convert from bytes into numbers.
*/
System.out.println ("\nField c : ");
for( i = 0; i < LENGTH; i++) {
System.arraycopy (data2, (i*12), CRec, 0, 8);
CR = HDFNativeData.byteToDouble(0, 1, CRec);
System.out.print (CR[0]+" ");
}
System.out.println ();
System.out.println("\nField a :");
for( i = 0; i < LENGTH; i++) {
System.arraycopy (data2, (i*12)+8, ARec, 0, 4);
AR = HDFNativeData.byteToInt(0, 1, ARec);
System.out.print (AR[0]+" ");
}
System.out.println ();
/*
* Create a data type for s3.
*/
s3_tid = H5Tcreate_wrap (HDF5Constants.H5T_COMPOUND, 4);
status =
H5Tinsert_wrap (s3_tid, "b_name", 0,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_FLOAT));
/*
* Read field b from s1 dataset. Field in the file is found by its name.
*/
status = H5Dread_wrap (dataset, s3_tid, HDF5Constants.H5S_ALL,
HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, s3);
/*
* Display the field. Data is read directly into array of 'float'.
*/
System.out.println ();
System.out.println ("Field b :");
for( i = 0; i < LENGTH; i++) {
System.out.print (s3[i]+" ");
}
System.out.println ();
/*
* Release resources
*/
H5Tclose_wrap (s2_tid);
H5Tclose_wrap (s3_tid);
H5Dclose_wrap (dataset);
H5Fclose_wrap (file);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for adding another member to the compound
// datatype datatype_id.
public static int H5Tinsert_wrap (int type_id, String name,
long offset, int field_id)
{
int status = -1;
try
{
// Adding another member to the compound datatype datatype_id.
status = H5.H5Tinsert (type_id, name, offset, field_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Tinsert_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Tinsert_wrap() with HDF5Exception: "
+ e.getMessage());
}
return status;
}
// Help function for creating the memory data type.
public static int H5Tcreate_wrap (int dclass, int size)
{
int datatype_id = -1; // memory data type identifier
try
{
// Create the memory data type.
datatype_id = H5.H5Tcreate (dclass, size);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Tcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Tcreate_wrap() with other Exception: "
+ e.getMessage());
}
return datatype_id;
}
// Help function for opening an existing file
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
("Compound.H5Fopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Fopen_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing dataset
public static int H5Dopen_wrap (int loc_id, String name)
{
int dataset_id = -1; // dataset identifier
try
{
// Opening an existing dataset
dataset_id = H5.H5Dopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Dopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Dopen_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for creating a new simple dataspace and opening it
// for access
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for creating a dataset
public static int H5Dcreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist_id)
{
int dataset_id = -1; // dataset identifier
try
{
// Create the dataset
dataset_id = H5.H5Dcreate (loc_id, name, type_id, space_id,
create_plist_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Dcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Dcreate_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for writing the dataset
public static int H5Dwrite_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object buf)
{
int status = -1;
try
{
// Write the dataset.
status = H5.H5Dwrite (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Dwrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Dwrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for reading the dataset
public static int H5Dread_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object obj)
{
int status = -1;
try
{
// Read the dataset.
status = H5.H5Dread (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, obj);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Dread_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Dread_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the data space.
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for releasing a datatype.
public static int H5Tclose_wrap (int type_id)
{
int status = -1;
try
{
// Releasing a datatype.
status = H5.H5Tclose (type_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Tclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Tclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Compound.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Compound.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,541 @@
/******************************************************************
* Copy.java (for HDF5 tutorial lesson 13)
*
* -- Showing how to use the H5SCOPY function.
* (a java conversion from h5_copy.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class Copy
{
public static void main (String []argv)
{
final String FILE1 = "copy1.h5";
final String FILE2 = "copy2.h5";
final int RANK = 2;
final int DIM1 = 3;
final int DIM2 = 4;
final int NUMP = 2;
int file1, file2, dataset1, dataset2;
int mid1, mid2, fid1, fid2;
long[] fdim = new long[2];
fdim[0] = DIM1;
fdim[1] = DIM2;
long[] mdim = new long[2];
fdim[0] = DIM1;
fdim[1] = DIM2;
long[] start = new long[2];
long[] stride = new long[2];
long[] count = new long[2];
long[] block = new long[2];
int[][] buf1 = new int[DIM1][DIM2];
int[][] buf2 = new int[DIM1][DIM2];
int[][] bufnew = new int[DIM1][DIM2];
int[] val = new int[2];
val[0] = 53;
val[1] = 59;
long[] marray = {2};
long[][] coord = new long[NUMP][RANK];
int ret;
int i, j;
/***********************************************************************/
/* */
/* Create two files containing identical datasets. Write 0's to one */
/* and 1's to the other. */
/* */
/***********************************************************************/
for ( i = 0; i < DIM1; i++ )
for ( j = 0; j < DIM2; j++ )
buf1[i][j] = 0;
for ( i = 0; i < DIM1; i++ )
for ( j = 0; j < DIM2; j++ )
buf2[i][j] = 1;
file1 = H5Fcreate_wrap (FILE1, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
file2 = H5Fcreate_wrap (FILE2, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
fid1 = H5Screate_simple_wrap (RANK, fdim, null);
fid2 = H5Screate_simple_wrap (RANK, fdim, null);
dataset1 = H5Dcreate_wrap
(file1, "Copy1", H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT), fid1,
HDF5Constants.H5P_DEFAULT);
dataset2 = H5Dcreate_wrap
(file2, "Copy2", H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT), fid2,
HDF5Constants.H5P_DEFAULT);
ret = H5Dwrite_wrap (dataset1, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, buf1);
ret = H5Dwrite_wrap (dataset2, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, buf2);
ret = H5Dclose_wrap (dataset1);
ret = H5Dclose_wrap (dataset2);
ret = H5Sclose_wrap (fid1);
ret = H5Sclose_wrap (fid2);
ret = H5Fclose_wrap (file1);
ret = H5Fclose_wrap (file2);
/***********************************************************************/
/* */
/* Open the two files. Select two points in one file, write values to */
/* those point locations, then do H5Scopy and write the values to the */
/* other file. Close files. */
/* */
/***********************************************************************/
file1 = H5Fopen_wrap (FILE1, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
file2 = H5Fopen_wrap (FILE2, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
dataset1 = H5Dopen_wrap (file1, "Copy1");
dataset2 = H5Dopen_wrap (file2, "Copy2");
fid1 = H5Dget_space_wrap (dataset1);
mid1 = H5Screate_simple_wrap (1, marray, null);
coord[0][0] = 0; coord[0][1] = 3;
coord[1][0] = 0; coord[1][1] = 1;
ret = H5Sselect_elements_wrap (fid1, HDF5Constants.H5S_SELECT_SET,
NUMP, coord);
ret = H5Dwrite_wrap (dataset1, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
mid1, fid1, HDF5Constants.H5P_DEFAULT, val);
fid2 = H5Scopy_wrap (fid1);
ret = H5Dwrite_wrap (dataset2, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
mid1, fid2, HDF5Constants.H5P_DEFAULT, val);
ret = H5Dclose_wrap (dataset1);
ret = H5Dclose_wrap (dataset2);
ret = H5Sclose_wrap (fid1);
ret = H5Sclose_wrap (fid2);
ret = H5Fclose_wrap (file1);
ret = H5Fclose_wrap (file2);
ret = H5Sclose_wrap (mid1);
/***********************************************************************/
/* */
/* Open both files and print the contents of the datasets. */
/* */
/***********************************************************************/
file1 = H5Fopen_wrap (FILE1, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
file2 = H5Fopen_wrap (FILE2, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
dataset1 = H5Dopen_wrap (file1, "Copy1");
dataset2 = H5Dopen_wrap (file2, "Copy2");
ret = H5Dread_wrap (dataset1, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, bufnew);
System.out.println ("\nDataset 'Copy1' in file 'copy1.h5' contains: ");
for (i = 0;i < DIM1; i++)
{
for (j = 0;j < DIM2; j++)
System.out.print (bufnew[i][j]);
System.out.println ();
}
System.out.println ("\nDataset 'Copy2' in file 'copy2.h5' contains: ");
ret = H5Dread_wrap (dataset2, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, bufnew);
for (i = 0;i < DIM1; i++)
{
for (j = 0;j < DIM2; j++)
System.out.print (bufnew[i][j]);
System.out.println ();
}
ret = H5Dclose_wrap (dataset1);
ret = H5Dclose_wrap (dataset2);
ret = H5Fclose_wrap (file1);
ret = H5Fclose_wrap (file2);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing file
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
("Copy.H5Fopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Fopen_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing dataset
public static int H5Dopen_wrap (int loc_id, String name)
{
int dataset_id = -1; // dataset identifier
try
{
// Opening an existing dataset
dataset_id = H5.H5Dopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dopen_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for creating a new simple dataspace and opening it
// for access
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for getting an identifier for a copy of
// the dataspace for a dataset
public static int H5Dget_space_wrap (int dataset_id)
{
int dataspace_id = -1;
try
{
// Returning an identifier for a copy of the dataspace for a dataset
dataspace_id = H5.H5Dget_space (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dget_space_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dget_space_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for selecting array elements to be included in
// the selection for the space_id dataspace.
public static int H5Sselect_elements_wrap (int space_id, int op,
int num_elements,
long coord2D[][])
{
int status = -1;
try
{
status = H5.H5Sselect_elements (space_id, op, num_elements,
coord2D);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Sselect_elements_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Sselect_elements_wrap() with other Exception: "
+ e.getMessage());
}
return status;
}
// Help function for creating a new dataspace which is an exact
// copy of the dataspace identified by space_id.
public static int H5Scopy_wrap (int space_id)
{
int dataspace_id = -1;
try
{
dataspace_id = H5.H5Scopy(space_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println ("Copy.H5Scopy_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println ("Copy.H5Scopy_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for creating a dataset
public static int H5Dcreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist_id)
{
int dataset_id = -1; // dataset identifier
try
{
// Create the dataset
dataset_id = H5.H5Dcreate (loc_id, name, type_id, space_id,
create_plist_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dcreate_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for writing the dataset
public static int H5Dwrite_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object buf)
{
int status = -1;
try
{
// Write the dataset.
status = H5.H5Dwrite (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dwrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dwrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for reading the dataset
public static int H5Dread_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object obj)
{
int status = -1;
try
{
// Read the dataset.
status = H5.H5Dread (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, obj);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dread_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dread_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the data space.
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("Copy.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("Copy.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,302 @@
/******************************************************************
* CreateAttribute.java (for HDF5 tutorial lesson 7)
*
* -- Creating and Writing a dataset attribute
* (a java conversion from h5_crtatt.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateAttribute
{
public static void main(String []argv)
{
final String FILE = "dset.h5";
int file_id = -1; // file identifier
int dataset_id = -1; // dataset identifier
int attribute_id = -1;
int dataspace_id = -1; // dataspace identifier
long[] dims = new long[1];
int[] attr_data = new int[2];
int status = -1;
// Initialize the attribute data.
attr_data[0] = 100;
attr_data[1] = 200;
// Open an existing file.
file_id = H5Fopen_wrap (FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
// Open an existing dataset.
dataset_id = H5Dopen_wrap (file_id, "/dset");
// Create the data space for the attribute.
dims[0] = 2;
dataspace_id = H5Screate_simple_wrap (1, dims, null);
// Create a dataset attribute.
attribute_id = H5Acreate_wrap
(dataset_id, "attr",
H5.J2C (HDF5CDataTypes.JH5T_STD_I32BE),
dataspace_id, HDF5Constants.H5P_DEFAULT);
// Write the attribute data.
status = H5Awrite_wrap
(attribute_id,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
attr_data);
// Close the attribute.
status = H5Aclose_wrap (attribute_id);
// Close the dataspace.
status = H5Sclose_wrap (dataspace_id);
// Close to the dataset.
status = H5Dclose_wrap (dataset_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for opening an existing file
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
("CreateAttribute.H5Fopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Fopen_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing dataset
public static int H5Dopen_wrap (int loc_id, String name)
{
int dataset_id = -1; // dataset identifier
try
{
// Opening an existing dataset
dataset_id = H5.H5Dopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Dopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Dopen_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Create the data space for the attribute.
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for creating a dataset attribute.
public static int H5Acreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist)
{
int attribute_id = -1; // attribute identifier
try
{
// Create the dataset
attribute_id = H5.H5Acreate (loc_id, name, type_id, space_id,
create_plist);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Acreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Acreate_wrap() with other Exception: "
+ e.getMessage());
}
return attribute_id;
}
// Help function for writing the attribute data.
public static int H5Awrite_wrap (int attr_id, int mem_type_id,
Object buf)
{
int status = -1;
try
{
// Write the attribute data.
status = H5.H5Awrite (attr_id, mem_type_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Awrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Awrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for closing the attribute
public static int H5Aclose_wrap (int attribute_id)
{
int status = -1;
try
{
// Close the dataset
status = H5.H5Aclose (attribute_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Aclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Aclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for closing the dataset
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// Close the dataset
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for closing the dataspace
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateAttribute.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateAttribute.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,210 @@
/******************************************************************
* CreateDataset.java (for HDF5 tutorial lesson 5)
*
* -- Creating a HDF5 Dataset
* (a java conversion from h5_crtdat.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateDataset
{
public static void main(String []argv)
{
final String FILE = "dset.h5";
int file_id = -1; // file identifier
int dataset_id = -1; // dataset identifier
int dataspace_id = -1; // dataspace identifier
long[] dims = new long[2];
int status = -1;
// Create a new file using default properties.
file_id = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
// Create the data space for the dataset.
dims[0] = 4;
dims[1] = 6;
dataspace_id = H5Screate_simple_wrap (2, dims, null);
// Create the dataset.
dataset_id =
H5Dcreate_wrap (file_id, "/dset",
H5.J2C (HDF5CDataTypes.JH5T_STD_I32BE),
dataspace_id, HDF5Constants.H5P_DEFAULT);
// End access to the dataset and release resources used by it.
status = H5Dclose_wrap (dataset_id);
// Terminate access to the data space.
status = H5Sclose_wrap (dataspace_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for creating a new simple dataspace and opening it
// for access
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for creating a dataset
public static int H5Dcreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist_id)
{
int dataset_id = -1; // dataset identifier
try
{
// Create the dataset
dataset_id = H5.H5Dcreate (loc_id, name, type_id, space_id,
create_plist_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Dcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Dcreate_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the data space.
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateDataset.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateDataset.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,83 @@
/******************************************************************
* CreateFile.java (for HDF5 tutorial lesson 4)
*
* -- Creating a HDF5 file
* (a java conversion from h5_crtfile.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateFile
{
public static void main(String []argv)
{
final String FILE = "file.h5";
int file_id = -1; // file identifier
int status = -1;
file_id = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
status = H5Fclose_wrap (file_id);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateFile.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateFile.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
System.out.println ("\nThe file name is: " + name);
System.out.println ("The file ID is: " + file_id);
return file_id;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateFile.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateFile.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,118 @@
/******************************************************************
* CreateFileInput.java (for HDF5 tutorial Lesson 4)
*
* -- Creating a HDF5 file
* (another java conversion from h5_crtfile.c, give user two options:
* one for library path and one for file name, if user chooses
* nothing, then the default file name is used.)
*
******************************************************************/
import java.lang.System;
import java.util.*;
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateFileInput
{
// The run command should be like:
// "./runCreateFileInput -l /usr/lib/hdf5.dll -f ./open.h5"
public static void main(String []argv)
{
int file_id = -1; // file identifier
int status = -1;
String libpath = null;
String filename = null;
for (int i = 0; i < argv.length; i++)
{
if ("-l".equalsIgnoreCase (argv[i]))
libpath = argv[++i];
if ("-f".equalsIgnoreCase (argv[i]))
filename = argv[++i];
}
if (libpath != null)
{
Properties pros = System.getProperties ();
pros.put (H5.H5PATH_PROPERTY_KEY, libpath);
/*
this function call could be used in Java 1.2
System.setProperty (H5.H5PATH_PROPERTY_KEY, libpath);
*/
}
if (filename == null)
{
filename = "file.h5"; // if no input file name, use the default name
}
file_id = H5Fcreate_wrap (filename,
HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
status = H5Fclose_wrap (filename, file_id);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateFileInput.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateFileInput.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
System.out.println ("\nThe file name is: " + name);
System.out.println ("The file ID is: " + file_id);
return file_id;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (String name, int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateFileInput.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateFileInput.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,139 @@
/******************************************************************
* CreateGroup.java (for HDF5 tutorial lesson 8)
*
* -- Creating and closing a group
* (a java conversion from h5_crtgrp.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateGroup
{
public static void main(String []argv)
{
final String FILE = "group.h5";
int file_id = -1; // file identifier
int group_id = -1; // group identifier
int status = -1;
// Create a new file using default properties.
file_id = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
// Create a group named "/MyGroup" in the file.
group_id = H5Gcreate_wrap (file_id, "/MyGroup", 0);
// Close the group.
status = H5Gclose_wrap (group_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroup.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroup.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for creating a group named "/MyGroup" in the file.
public static int H5Gcreate_wrap (int loc_id, String name, int size_hint)
{
int group_id = -1; // group identifier
try
{
// Create a group
group_id = H5.H5Gcreate (loc_id, name, size_hint);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroup.H5Gcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroup.H5Gcreate_wrap() with other Exception: "
+ e.getMessage());
}
return group_id;
}
// Help function for closing the group
public static int H5Gclose_wrap (int group_id)
{
int status = -1;
try
{
// Close the group
status = H5.H5Gclose (group_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroup.H5Gclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroup.H5Gclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroup.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroup.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,152 @@
/******************************************************************
* CreateGroupAR.java (for HDF5 tutorial lesson 9)
*
* -- Creating groups using absolute and relative names.
* (a java conversion from h5_crtgrpar.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateGroupAR
{
public static void main(String []argv)
{
final String FILE = "groups.h5";
int file_id = -1; // file identifier
int group1_id = -1; // group identifier
int group2_id = -1;
int group3_id = -1;
int status = -1;
// Create a new file using default properties.
file_id = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
// Create group "MyGroup" in the root group using absolute name.
group1_id = H5Gcreate_wrap (file_id, "/MyGroup", 0);
// Create group "Group_A" in group "MyGroup" using absolute name.
group2_id = H5Gcreate_wrap (file_id, "/MyGroup/Group_A", 0);
// Create group "Group_B" in group "MyGroup" using relative name.
group3_id = H5Gcreate_wrap (group1_id, "Group_B", 0);
// Close groups.
status = H5Gclose_wrap (group1_id);
status = H5Gclose_wrap (group2_id);
status = H5Gclose_wrap (group3_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupAR.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupAR.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for creating a group named "/MyGroup" in the file.
public static int H5Gcreate_wrap (int loc_id, String name, int size_hint)
{
int group_id = -1; // group identifier
try
{
// Create a group
group_id = H5.H5Gcreate (loc_id, name, size_hint);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupAR.H5Gcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupAR.H5Gcreate_wrap() with other Exception: "
+ e.getMessage());
}
return group_id;
}
// Help function for closing the group
public static int H5Gclose_wrap (int group_id)
{
int status = -1;
try
{
// Close the group
status = H5.H5Gclose (group_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupAR.H5Gclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupAR.H5Gclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupAR.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupAR.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,340 @@
/******************************************************************
* CreateGroupDataset.java (for HDF5 tutorial lesson 10)
*
* -- Creating a dataset in a particular group
* (a java conversion from h5_crtgrpd.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class CreateGroupDataset
{
public static void main(String []argv)
{
final String FILE = "groups.h5";
int file_id = -1; // file identifier
int group_id = -1; // group identifier
int dataset_id;
int dataspace_id;
int status = -1;
long[] dims = new long[2];
int[][] dset1_data = new int[3][3];
int[][] dset2_data = new int[2][10];
int i = -1, j = -1;
// Initialize the first dataset.
for (i = 0; i < 3; i++)
for (j = 0; j < 3; j++)
dset1_data[i][j] = j + 1;
// Initialize the second dataset.
for (i = 0; i < 2; i++)
for (j = 0; j < 10; j++)
dset2_data[i][j] = j + 1;
// Open an existing file.
file_id = H5Fopen_wrap (FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
// Create the data space for the first dataset.
dims[0] = 3;
dims[1] = 3;
dataspace_id = H5Screate_simple_wrap (2, dims, null);
// Create a dataset in group "MyGroup".
dataset_id =
H5Dcreate_wrap (file_id, "/MyGroup/dset1",
H5.J2C (HDF5CDataTypes.JH5T_STD_I32BE),
dataspace_id, HDF5Constants.H5P_DEFAULT);
// Write the first dataset.
status = H5Dwrite_wrap
(dataset_id,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, dset1_data);
// Close the data space for the first dataset.
status = H5Sclose_wrap (dataspace_id);
// Close the first dataset.
status = H5Dclose_wrap (dataset_id);
// Open an existing group of the specified file.
group_id = H5Gopen_wrap (file_id, "/MyGroup/Group_A");
// Create the data space for the second dataset.
dims[0] = 2;
dims[1] = 10;
dataspace_id = H5Screate_simple_wrap (2, dims, null);
// Create the second dataset in group "Group_A".
dataset_id =
H5Dcreate_wrap (group_id, "dset2",
H5.J2C (HDF5CDataTypes.JH5T_STD_I32BE),
dataspace_id, HDF5Constants.H5P_DEFAULT);
// Write the second dataset.
status = H5Dwrite_wrap
(dataset_id,
H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, dset2_data);
// Close the data space for the second dataset.
status = H5Sclose_wrap (dataspace_id);
// Close the second dataset
status = H5Dclose_wrap (dataset_id);
// Close the group.
status = H5Gclose_wrap (group_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for opening an existing file
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
("CreateGroupDataset.H5Fopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Fopen_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for creating a new simple dataspace and opening it
// for access
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for creating a dataset
public static int H5Dcreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist_id)
{
int dataset_id = -1; // dataset identifier
try
{
// Create the dataset
dataset_id = H5.H5Dcreate (loc_id, name, type_id, space_id,
create_plist_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Dcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Dcreate_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for writing the dataset
public static int H5Dwrite_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object buf)
{
int status = -1;
try
{
// Write the dataset.
status = H5.H5Dwrite (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Dwrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Dwrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the data space.
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for opening a group
public static int H5Gopen_wrap (int loc_id, String name)
{
int group_id = -1; // group identifier
try
{
// Create a group
group_id = H5.H5Gopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Gopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Gopen_wrap() with other Exception: "
+ e.getMessage());
}
return group_id;
}
// Help function for closing the group
public static int H5Gclose_wrap (int group_id)
{
int status = -1;
try
{
// Close the group
status = H5.H5Gclose (group_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Gclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Gclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("CreateGroupDataset.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("CreateGroupDataset.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,213 @@
/******************************************************************
* DatasetRdWt.java (for HDF5 tutorial lesson 6)
*
* -- Reading and Writing an existing Dataset
* (a java conversion from h5_rdwt.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class DatasetRdWt
{
public static void main(String []argv)
{
final String FILE = "dset.h5";
int file_id = -1; // file identifier
int dataset_id = -1; // dataset identifier
int status = -1;
int[][] dset_data = new int[4][6];
// Initialize the dataset.
for (int i = 0; i < 4; i++)
for (int j = 0; j < 6; j++)
dset_data[i][j] = i * 6 + j + 1;
// Open an existing file
file_id = H5Fopen_wrap (FILE, HDF5Constants.H5F_ACC_RDWR,
HDF5Constants.H5P_DEFAULT);
// Open an existing dataset.
dataset_id = H5Dopen_wrap (file_id, "/dset");
// Write the dataset.
status = H5Dwrite_wrap
(dataset_id, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, dset_data);
status = H5Dread_wrap
(dataset_id, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, dset_data);
// Close the dataset.
status = H5Dclose_wrap (dataset_id);
// Close the file.
status = H5Fclose_wrap (file_id);
}
// Help function for opening an existing file
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;
}
// Help function for opening an existing dataset
public static int H5Dopen_wrap (int loc_id, String name)
{
int dataset_id = -1; // dataset identifier
try
{
// Opening an existing dataset
dataset_id = H5.H5Dopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("DatasetRdWt.H5Dopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("DatasetRdWt.H5Dopen_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for writing the dataset
public static int H5Dwrite_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object buf)
{
int status = -1;
try
{
// Write the dataset.
status = H5.H5Dwrite (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("DatasetRdWt.H5Dwrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("DatasetRdWt.H5Dwrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for reading the dataset
public static int H5Dread_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object obj)
{
int status = -1;
try
{
// Read the dataset.
status = H5.H5Dread (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, obj);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("DatasetRdWt.H5Dread_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("DatasetRdWt.H5Dread_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("DatasetRdWt.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("DatasetRdWt.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("DatasetRdWt.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("DatasetRdWt.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,590 @@
/******************************************************************
* HyperSlab.java (for HDF5 tutorial lesson 12)
*
* -- Writing and reading a hyperslab
* (a java conversion from h5_hyperslab.c)
*
******************************************************************/
import ncsa.hdf.hdf5lib.*;
import ncsa.hdf.hdf5lib.exceptions.*;
public class HyperSlab
{
public static void main (String []argv)
{
final String FILE = "sds.h5";
final String DATASETNAME = "IntArray";
final int NX_SUB = 3; /* hyperslab dimensions */
final int NY_SUB = 4;
final int NX = 7; /* output buffer dimensions */
final int NY = 7;
final int NZ = 3;
final int RANK = 2;
final int RANK_OUT = 3;
final int X = 5; /* dataset dimensions */
final int Y = 6;
long[] dimsf = new long[2]; /* dataset dimensions */
int[][] data = new int[X][Y]; /* data to write */
/*
* Data and output buffer initialization.
*/
int file, dataset; /* handles */
int dataspace;
int memspace;
long[] dimsm = new long[3]; /* memory space dimensions */
long[] dims_out = new long[2]; /* dataset dimensions */
int status;
int[][][] data_out = new int[NX][NY][NZ]; /* output buffer */
long[] count = new long[2]; /* size of the hyperslab in the file */
long[] offset = new long[2]; /* hyperslab offset in the file */
long[] count_out = new long[3]; /* size of the hyperslab in memory */
long[] offset_out = new long[3]; /* hyperslab offset in memory */
int i, j, k, status_n, rank;
/*********************************************************
This writes data to the HDF5 file.
*********************************************************/
/*
* Data and output buffer initialization.
*/
for (j = 0; j < X; j++)
{
for (i = 0; i < Y; i++)
data[j][i] = i + j;
}
/*
* 0 1 2 3 4 5
* 1 2 3 4 5 6
* 2 3 4 5 6 7
* 3 4 5 6 7 8
* 4 5 6 7 8 9
*/
/*
* Create a new file using H5F_ACC_TRUNC access,
* the default file creation properties, and the default file
* access properties.
*/
file = H5Fcreate_wrap (FILE, HDF5Constants.H5F_ACC_TRUNC,
HDF5Constants.H5P_DEFAULT,
HDF5Constants.H5P_DEFAULT);
/*
* Describe the size of the array and create the data space for fixed
* size dataset.
*/
dimsf[0] = X;
dimsf[1] = Y;
dataspace = H5Screate_simple_wrap (RANK, dimsf, null);
/*
* Create a new dataset within the file using defined dataspace and
* default dataset creation properties.
*/
dataset = H5Dcreate_wrap
(file, DATASETNAME, H5.J2C (HDF5CDataTypes.JH5T_STD_I32BE),
dataspace, HDF5Constants.H5P_DEFAULT);
/*
* Write the data to the dataset using default transfer properties.
*/
status = H5Dwrite_wrap
(dataset, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL,
HDF5Constants.H5P_DEFAULT, data);
/*
* Close/release resources.
*/
H5Sclose_wrap (dataspace);
H5Dclose_wrap (dataset);
H5Fclose_wrap (file);
/*************************************************************
This reads the hyperslab from the sds.h5 file just
created, into a 2-dimensional plane of the 3-dimensional
array.
************************************************************/
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
{
for (k = 0; k < NZ ; k++)
data_out[j][i][k] = 0;
}
}
/*
* Open the file and the dataset.
*/
file = H5Fopen_wrap (FILE, HDF5Constants.H5F_ACC_RDONLY,
HDF5Constants.H5P_DEFAULT);
dataset = H5Dopen_wrap (file, DATASETNAME);
dataspace = H5Dget_space_wrap (dataset); /* dataspace handle */
rank = H5Sget_simple_extent_ndims_wrap (dataspace);
status_n = H5Sget_simple_extent_dims_wrap (dataspace, dims_out, null);
System.out.println ("Rank: " + rank);
System.out.println ("Dimensions: "+ dims_out[0] + " x " + dims_out[1]);
/*
* Define hyperslab in the dataset.
*/
offset[0] = 1;
offset[1] = 2;
count[0] = NX_SUB;
count[1] = NY_SUB;
status = H5Sselect_hyperslab_wrap (dataspace,
HDF5Constants.H5S_SELECT_SET,
offset, null, count, null);
/*
* Define the memory dataspace.
*/
dimsm[0] = NX;
dimsm[1] = NY;
dimsm[2] = NZ;
memspace = H5Screate_simple_wrap (RANK_OUT, dimsm, null);
/*
* Define memory hyperslab.
*/
offset_out[0] = 3;
offset_out[1] = 0;
offset_out[2] = 0;
count_out[0] = NX_SUB;
count_out[1] = NY_SUB;
count_out[2] = 1;
status = H5Sselect_hyperslab_wrap (memspace,
HDF5Constants.H5S_SELECT_SET,
offset_out, null, count_out, null);
/*
* Read data from hyperslab in the file into the hyperslab in
* memory and display.
*/
status =
H5Dread_wrap (dataset, H5.J2C (HDF5CDataTypes.JH5T_NATIVE_INT),
memspace, dataspace, HDF5Constants.H5P_DEFAULT,
data_out);
System.out.println ("Data:");
for (j = 0; j < NX; j++)
{
for (i = 0; i < NY; i++)
System.out.print (data_out[j][i][0]);
System.out.println ();
}
System.out.println ();
/*
* 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0
* 0 0 0 0 0 0 0
* 3 4 5 6 0 0 0
* 4 5 6 7 0 0 0
* 5 6 7 8 0 0 0
* 0 0 0 0 0 0 0
*/
/*
* Close and release resources.
*/
H5Dclose_wrap (dataset);
H5Sclose_wrap (dataspace);
H5Sclose_wrap (memspace);
H5Fclose_wrap (file);
}
// Help function for creating a new file
public static int H5Fcreate_wrap (String name, int flags,
int create_id, int access_id)
{
int file_id = -1; // file identifier
try
{
// Create a new file using default file properties.
file_id = H5.H5Fcreate (name, flags, create_id, access_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Fcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Fcreate_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing file
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
("HyperSlab.H5Fopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Fopen_wrap() with other Exception: "
+ e.getMessage());
}
return file_id;
}
// Help function for opening an existing dataset
public static int H5Dopen_wrap (int loc_id, String name)
{
int dataset_id = -1; // dataset identifier
try
{
// Opening an existing dataset
dataset_id = H5.H5Dopen (loc_id, name);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dopen_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dopen_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for creating a new simple dataspace and opening it
// for access
public static int H5Screate_simple_wrap (int rank, long dims[],
long maxdims[])
{
int dataspace_id = -1; // dataspace identifier
try
{
// Create the data space for the dataset.
dataspace_id = H5.H5Screate_simple (rank, dims, maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Screate_simple_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Screate_simple_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for getting an identifier for a copy of
// the dataspace for a dataset
public static int H5Dget_space_wrap (int dataset_id)
{
int dataspace_id = -1;
try
{
// Returning an identifier for a copy of the dataspace for a dataset
dataspace_id = H5.H5Dget_space (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dget_space_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dget_space_wrap() with other Exception: "
+ e.getMessage());
}
return dataspace_id;
}
// Help function for determining the dimensionality (or rank) of
// a dataspace
public static int H5Sget_simple_extent_ndims_wrap (int space_id)
{
int rank = -1;
try
{
// Determine the dimensionality (or rank) of a dataspace.
rank = H5.H5Sget_simple_extent_ndims (space_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Sget_simple_extent_ndims_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Sget_simple_extent_ndims_wrap() with other Exception: "
+ e.getMessage());
}
return rank;
}
// Help function for returning the size and maximum sizes of each
// dimension of a dataspace through the dims and maxdims parameters.
public static int H5Sget_simple_extent_dims_wrap (int space_id,
long dims[],
long maxdims[])
{
int dimension_number = -1;
try
{
dimension_number = H5.H5Sget_simple_extent_dims (space_id, dims,
maxdims);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Sget_simple_extent_dims_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Sget_simple_extent_dims_wrap() with other Exception: "
+ e.getMessage());
}
return dimension_number;
}
// Help function for selecting a hyperslab region to add to the
// current selected region for the dataspace specified by space_id.
public static int H5Sselect_hyperslab_wrap (int space_id, int op,
long start[], long stride[],
long count[], long block[])
{
int status = -1;
try
{
status = H5.H5Sselect_hyperslab (space_id, op, start, stride,
count, block);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Sselect_hyperslab_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Sselect_hyperslab_wrap() with other Exception: "
+ e.getMessage());
}
return status;
}
// Help function for creating a dataset
public static int H5Dcreate_wrap (int loc_id, String name, int type_id,
int space_id, int create_plist_id)
{
int dataset_id = -1; // dataset identifier
try
{
// Create the dataset
dataset_id = H5.H5Dcreate (loc_id, name, type_id, space_id,
create_plist_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dcreate_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dcreate_wrap() with other Exception: "
+ e.getMessage());
}
return dataset_id;
}
// Help function for writing the dataset
public static int H5Dwrite_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object buf)
{
int status = -1;
try
{
// Write the dataset.
status = H5.H5Dwrite (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, buf);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dwrite_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dwrite_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for reading the dataset
public static int H5Dread_wrap (int dataset_id, int mem_type_id,
int mem_space_id, int file_space_id,
int xfer_plist_id, Object obj)
{
int status = -1;
try
{
// Read the dataset.
status = H5.H5Dread (dataset_id, mem_type_id, mem_space_id,
file_space_id, xfer_plist_id, obj);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dread_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dread_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the data space.
public static int H5Sclose_wrap (int dataspace_id)
{
int status = -1;
try
{
// Terminate access to the data space.
status = H5.H5Sclose (dataspace_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Sclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Sclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for ending access to the dataset and releasing
// resources used by it.
public static int H5Dclose_wrap (int dataset_id)
{
int status = -1;
try
{
// End access to the dataset and release resources used by it.
status = H5.H5Dclose (dataset_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Dclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Dclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
// Help function for terminating access to the file.
public static int H5Fclose_wrap (int file_id)
{
int status = -1;
try
{
// Terminate access to the file.
status = H5.H5Fclose (file_id);
}
catch (HDF5Exception hdf5e)
{
System.out.println
("HyperSlab.H5Fclose_wrap() with HDF5Exception: "
+ hdf5e.getMessage());
}
catch (Exception e)
{
System.out.println
("HyperSlab.H5Fclose_wrap() with other exception: "
+ e.getMessage());
}
return status;
}
}

View File

@ -0,0 +1,92 @@
# Generated automatically from Makefile.in by configure.
# /*=======================================================================
# UNIVERSITY OF ILLINOIS (UI), NATIONAL CENTER FOR SUPERCOMPUTING
# APPLICATIONS (NCSA), Software Distribution Policy for Public Domain
# Software
#
# NCSA HDF Version 5 source code and documentation are in the public
# domain, available without fee for education, research, non-commercial and
# commercial purposes. Users may distribute the binary or source code to
# third parties provided that this statement appears on all copies and that
# no charge is made for such copies.
#
# UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY
# PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. THE
# UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USER OF THIS
# SOFTWARE. The software may have been developed under agreements between
# the UI and the Federal Government which entitle the Government to certain
# rights.
#
# We ask, but do not require that the following message be include in all
# derived works:
#
# Portions developed at the National Center for Supercomputing Applications
# at the University of Illinois at Urbana-Champaign.
#
# By copying this program, you, the user, agree to abide by the conditions
# and understandings with respect to any software which is marked with a
# public domain notice.
#
# =======================================================================*/
#
JAVAC = /usr/java1.2/bin/javac
FIND = /bin/find
CLASSPATH=/usr/java1.2/jre/lib/rt.jar:/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
.SUFFIXES: .java .class
.java.class:
$(JAVAC) -classpath $(CLASSPATH) $<
tutorial: ./Compound.class \
./Copy.class \
./CreateAttribute.class \
./CreateDataset.class \
./CreateFile.class \
./CreateFileInput.class \
./CreateGroup.class \
./CreateGroupAR.class \
./CreateGroupDataset.class \
./DatasetRdWt.class \
./HyperSlab.class
chmod u+x *.sh
clean: clean-classes
distclean: clean-classes clean-data
rm config.cache config.status config.log
rm -rf ./Makefile
clean-classes:
$(FIND) . \( -name '#*' -o -name '*~' -o -name '*.class' \) -exec rm -f {} \; ;\
clean-data:
rm -rf *.h5
Compound: ./Compound.class
Copy: ./Copy.class
CreateAttribute: ./CreateAttribute.class
CreateDataset: ./CreateDataset.class
CreateFile: ./CreateFile.class
CreateFileInput: ./CreateFileInput.class
CreateGroup: ./CreateGroup.class
CreateGroupAR: ./CreateGroupAR.class
CreateGroupDataset: ./CreateGroupDataset.class
DatasetRdWt: ./DatasetRdWt.class
HyperSlab: ./HyperSlab.class
CLASSES= ./Compound.class \
./Copy.class \
./CreateAttribute.class \
./CreateDataset.class \
./CreateFileInput.class \
./CreateFile.class \
./CreateGroup.class \
./CreateGroupAR.class \
./CreateGroupDataset.class \
./DatasetRdWt.class \
./HyperSlab.class

View File

@ -1,22 +1,91 @@
# HDF5 Library Makefile(.in)
# /*=======================================================================
# UNIVERSITY OF ILLINOIS (UI), NATIONAL CENTER FOR SUPERCOMPUTING
# APPLICATIONS (NCSA), Software Distribution Policy for Public Domain
# Software
#
# Copyright (C) 2001 National Center for Supercomputing Applications.
# All rights reserved.
# NCSA HDF Version 5 source code and documentation are in the public
# domain, available without fee for education, research, non-commercial and
# commercial purposes. Users may distribute the binary or source code to
# third parties provided that this statement appears on all copies and that
# no charge is made for such copies.
#
# UI MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY
# PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. THE
# UI SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY THE USER OF THIS
# SOFTWARE. The software may have been developed under agreements between
# the UI and the Federal Government which entitle the Government to certain
# rights.
#
# We ask, but do not require that the following message be include in all
# derived works:
#
# Portions developed at the National Center for Supercomputing Applications
# at the University of Illinois at Urbana-Champaign.
#
# By copying this program, you, the user, agree to abide by the conditions
# and understandings with respect to any software which is marked with a
# public domain notice.
#
# =======================================================================*/
#
top_srcdir=@top_srcdir@
top_builddir=../../../../..
srcdir=@srcdir@
@COMMENCE@
# Subdirectories in build-order (not including `examples')
SUBDIRS=
DOCDIR=$(docdir)/hdf5/Tutor/examples
# Public doc files (to be installed)...
PUB_DOCS=
JAVAC = @JAVAC@
FIND = @FIND@
# Other doc files (not to be installed)...
PRIVATE_DOCS=
CLASSPATH=@CLASSPATH@
@CONCLUDE@
.SUFFIXES: .java .class
.java.class:
$(JAVAC) -classpath $(CLASSPATH) $<
tutorial: ./Compound.class \
./Copy.class \
./CreateAttribute.class \
./CreateDataset.class \
./CreateFile.class \
./CreateFileInput.class \
./CreateGroup.class \
./CreateGroupAR.class \
./CreateGroupDataset.class \
./DatasetRdWt.class \
./HyperSlab.class
chmod u+x *.sh
clean: clean-classes
distclean: clean-classes clean-data
rm config.cache config.status config.log
rm -rf ./Makefile
clean-classes:
$(FIND) . \( -name '#*' -o -name '*~' -o -name '*.class' \) -exec rm -f {} \; ;\
clean-data:
rm -rf *.h5
Compound: ./Compound.class
Copy: ./Copy.class
CreateAttribute: ./CreateAttribute.class
CreateDataset: ./CreateDataset.class
CreateFile: ./CreateFile.class
CreateFileInput: ./CreateFileInput.class
CreateGroup: ./CreateGroup.class
CreateGroupAR: ./CreateGroupAR.class
CreateGroupDataset: ./CreateGroupDataset.class
DatasetRdWt: ./DatasetRdWt.class
HyperSlab: ./HyperSlab.class
CLASSES= ./Compound.class \
./Copy.class \
./CreateAttribute.class \
./CreateDataset.class \
./CreateFileInput.class \
./CreateFile.class \
./CreateGroup.class \
./CreateGroupAR.class \
./CreateGroupDataset.class \
./DatasetRdWt.class \
./HyperSlab.class

View File

@ -0,0 +1,21 @@
These files are Java versions of the example programs used in
the HDF-5 tutoral:
http://hdf.ncsa.uiuc.edu/training/hdf5/
The examples here correspond to the examples explained in the first 13
sections of the tutorial.
Lesson C program Java program Topic
4 h5_crtfile.c CreateFile.java Create an HDF-5 file.
5 h5_crtdat.c CreateDataset.java Create a dataset.
6 h5_rdwt.c DatasetRdWt.java Write/Read a dataset.
7 h5_crtatt.c CreateAttribute.java Create an attribute.
8 h5_crtgrp.c CreateGroup.java Create a group.
9 h5_crtgrpar.c CreateGroupAR.java Abs. and Rel. paths.
10 h5_crtgrpd.c CreateGroupDataset.java Create dataset in grp.
11 h5_compound.c Compound.java Compound datatype
12 h5_hyperslab.c Hyperslab.java Selection of hyperslab
13 h5_copy.c Copy.java Selection of elements

View File

@ -0,0 +1,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>

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java Compound $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ Compound $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java Copy $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ Copy $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateAttribute $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateAttribute $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateDataset $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateDataset $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateFile $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateFile $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateFileInput $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateFileInput $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateGroup $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateGroup $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateGroupAR $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateGroupAR $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java CreateGroupDataset $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ CreateGroupDataset $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java DatasetRdWt $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ DatasetRdWt $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=/afs/ncsa/projects/hdf/java/java2/mcgrath/arabica/New5
HDF5LIB=/afs/ncsa/projects/hdf/release/prehdf5-1.2.1/SunOS_5.7/lib
#make this relative to the source root...
PWD=/afs/ncsa.uiuc.edu/projects/hdf/java/java2/mcgrath/arabica/java-hdf5
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/solaris"
export CLASSPATH
export LD_LIBRARY_PATH
/usr/java1.2/bin/java HyperSlab $*

View File

@ -0,0 +1,17 @@
#!/bin/sh
JH5INSTALLDIR=@JH5INST@
HDF5LIB=@HDF5LIB@
#make this relative to the source root...
PWD=@PWD@
LIBDIR=$JH5INSTALLDIR"/lib"
CLASSPATH=".:"$LIBDIR"/jhdf5.jar"
LD_LIBRARY_PATH=$HDF5LIB":"$LIBDIR"/@JAVATARG@"
export CLASSPATH
export LD_LIBRARY_PATH
@JAVA@ HyperSlab $*