Presentation is loading. Please wait.

Presentation is loading. Please wait.

October 15-17, 2008HDF and HDF-EOS Workshop XII1 HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008.

Similar presentations


Presentation on theme: "October 15-17, 2008HDF and HDF-EOS Workshop XII1 HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008."— Presentation transcript:

1 October 15-17, 2008HDF and HDF-EOS Workshop XII1 HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008

2 October 15-17, 2008HDF and HDF-EOS Workshop XII2 What are the HDF-Java products? HDF-Java HDF Java Wrapper Object Package Viewer Editor

3 October 15-17, 2008HDF and HDF-EOS Workshop XII3 Java Wrapper HDF

4 October 15-17, 2008HDF and HDF-EOS Workshop XII4 Java Wrapper HDF Pure Java Library HDF Java Native Interface a programming framework that allows Java code to call and be called by applications and libraries written in other languages

5 October 15-17, 2008HDF and HDF-EOS Workshop XII5 Pure Java Library Pros:  True platform independence  Direct access to file (no data conversion between C and Java) HDF Pure Java Library Cons:  Substantial amount of work to implement  Hard to maintain (new features or format changes)

6 October 15-17, 2008HDF and HDF-EOS Workshop XII6 HDF JNI Pros:  Easy to implement  Easy to maintain HDF Java Native Interface Cons:  Requires data conversion between C and Java  HDF JNI is platform dependent

7 Java Wrapper October 15-17, 2008HDF and HDF-EOS Workshop XII7 HDF Java Native Interface HDFLibrary.java H5.java libjhdf.so (or dll) libjhdf5.so (or dll) HDF4 library HDF5 library

8 Java Wrapper: C versus Java October 15-17, 2008HDF and HDF-EOS Workshop XII8 hid_t H5Fcreate ( const char *name, unsigned flags, hid_t create_id, hid_t access_id ); hid_t H5Fopen ( const char *name, unsigned flags, hid_t access_id ); herr_t H5Fclose ( hid_t file_id ); public static native int H5Fcreate ( String name, int flags, int create_id, int access_id); public static native int H5Fopen ( String name, int flags, int access_id); public static native int H5Fclose ( int file_id); CJava

9 October 15-17, 2008HDF and HDF-EOS Workshop XII9 Object Package HDF-Java HDF Java Wrapper Object Package Viewer Editor

10 Java Wrapper: simple dataset read October 15-17, 2008HDF and HDF-EOS Workshop XII10 int fid, did, sid, tid, rank; long dims[], maxDims[]; Object theData; fid = H5.H5Fopen( fname, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT ); did = H5.H5Dopen(fid, dname); sid = H5.H5Dget_space(did); tid = H5.H5Dget_type(did); rank = H5.H5Sget_simple_extent_ndims(sid); dims = new long[rank]; maxDims = new long[rank]; H5.H5Sget_simple_extent_dims(sid, dims, maxDims); theData = allocateArray(tid, dims); H5.H5Dread( did, tid, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, theData ); H5.H5Sclose(sid); H5.H5Tclose(tid); H5.H5Dclose(did); H5.H5Fclose(fid);

11 Object Package: the easy way October 15-17, 2008HDF and HDF-EOS Workshop XII11 theData = Dataset.read();

12 Object Package: main purposes October 15-17, 2008HDF and HDF-EOS Workshop XII12 Simplifies access to HDF files Separates applications from libraries  Modular design  Client server model Makes testing and maintenance easy

13 Object Package: levels of objects October 15-17, 2008HDF and HDF-EOS Workshop XII13 Common Objects ncsa.hdf.object jhdfobj.jar HDF4 ncsa.hdf.object.h4 jhdf4obj.jar HDF5 ncsa.hdf.object.h5 jhdf5obj.jar Abstract classes Implementation

14 Object Package: abstract classes October 15-17, 2008HDF and HDF-EOS Workshop XII14 HObject CompoundDS ScalarDS Dataset Group FileFormat

15 Object Package: HDF4 implementation October 15-17, 2008HDF and HDF-EOS Workshop XII15 H4GroupH4GRImageH4SDS H4Vdata Group ScalarDSCompounDS FileFormat H4File

16 Object Package: HDF5 implementation October 15-17, 2008HDF and HDF-EOS Workshop XII16 H5Group H5ScalarDSH5CompoundDS Group ScalarDSCompounDS FileFormat H5File

17 Object Package: file create October 15-17, 2008HDF and HDF-EOS Workshop XII17 import ncsa.hdf.object.*; public class H5FileCreate { private static String fname = "H5FileCreate.h5"; public static void main( String args[] ) throws Exception { FileFormat fileFormat = FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5); fileFormat.createFile(fname, FileFormat.FILE_CREATE); }

18 October 15-17, 2008HDF and HDF-EOS Workshop XII18 HDFView HDF-Java HDF Java Wrapper Object Package Viewer Editor

19 HDFView: basic components October 15-17, 2008HDF and HDF-EOS Workshop XII19

20 HDFView: GUI components October 15-17, 2008HDF and HDF-EOS Workshop XII20 HDFView (GUI) TreeView MetaDataView TableView ImageView TextView UserImp

21 HDFView: all together October 15-17, 2008HDF and HDF-EOS Workshop XII21

22 October 15-17, 2008HDF and HDF-EOS Workshop XII22 What are the HDF-Java products? HDF-Java HDF Java Wrapper Object Package Viewer Editor

23 October 15-17, 2008 HDF and HDF-EOS Workshop XII 23 This report is based upon work supported in part by a Cooperative Agreement with the National Aeronautics and Space Administration (NASA) under NASA Awards NNX06AC83A and NNX08AO77A. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Aeronautics and Space Administration. Thank You!

24 Questions/comments? October 15-17, 2008HDF and HDF-EOS Workshop XII24


Download ppt "October 15-17, 2008HDF and HDF-EOS Workshop XII1 HDF-Java Products Peter Cao The HDF Group HDF and HDF-EOS Workshop XII October 15, 2008."

Similar presentations


Ads by Google