1 / 24

HDF-Java Products

Learn about HDF-Java products, including Viewer, Editor, and Wrapper, at the HDF and HDF-EOS Workshop XII. Explore the pros and cons of using the pure Java library versus the Java Native Interface (JNI) for HDF file manipulation. Find out how to read datasets using the HDF-Java Java Wrapper. Discover the different levels of objects in the HDF4 and HDF5 implementations. Get an overview of HDFView and its GUI components. This report is based on work supported by NASA.

Download Presentation

HDF-Java Products

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. What are the HDF-Java products? HDF-Java HDF Java Wrapper Object Package Viewer Editor HDF and HDF-EOS Workshop XII

  3. Java Wrapper HDF HDF and HDF-EOS Workshop XII

  4. Java Wrapper 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 HDF HDF and HDF-EOS Workshop XII

  5. Pure Java Library • Pros: • True platform independence • Direct access to file (no data conversion between C and Java) Pure Java Library • Cons: • Substantial amount of work to implement • Hard to maintain (new features or format changes) HDF HDF and HDF-EOS Workshop XII

  6. 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 HDF HDF and HDF-EOS Workshop XII

  7. Java Wrapper HDF Java Native Interface libjhdf.so (or dll) libjhdf5.so (or dll) HDFLibrary.java H5.java HDF4 library HDF5 library HDF and HDF-EOS Workshop XII

  8. Java Wrapper: C versus Java 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); C Java HDF and HDF-EOS Workshop XII

  9. Object Package HDF-Java HDF Java Wrapper Object Package Viewer Editor HDF and HDF-EOS Workshop XII

  10. Java Wrapper: simple dataset read 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); HDF and HDF-EOS Workshop XII

  11. Object Package: the easy way theData = Dataset.read(); HDF and HDF-EOS Workshop XII

  12. Object Package: main purposes • Simplifies access to HDF files • Separates applications from libraries • Modular design • Client server model • Makes testing and maintenance easy HDF and HDF-EOS Workshop XII

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

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

  15. Object Package: HDF4 implementation ScalarDS CompounDS Group H4Vdata H4Group H4SDS H4GRImage H4File FileFormat October 15-17, 2008 HDF and HDF-EOS Workshop XII 15

  16. Object Package: HDF5 implementation ScalarDS CompounDS Group H5Group H5ScalarDS H5CompoundDS H5File FileFormat October 15-17, 2008 HDF and HDF-EOS Workshop XII 16

  17. Object Package: file create 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); } } HDF and HDF-EOS Workshop XII

  18. HDFView HDF-Java HDF Java Wrapper Object Package Viewer Editor HDF and HDF-EOS Workshop XII

  19. HDFView: basic components HDF and HDF-EOS Workshop XII

  20. HDFView: GUI components HDFView (GUI) MetaDataView TreeView UserImp UserImp TableView TextView ImageView UserImp UserImp UserImp HDF and HDF-EOS Workshop XII

  21. HDFView: all together HDF and HDF-EOS Workshop XII

  22. What are the HDF-Java products? HDF-Java HDF Java Wrapper Object Package Viewer Editor HDF and HDF-EOS Workshop XII

  23. Thank You! 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. HDF and HDF-EOS Workshop XII

  24. Questions/comments? HDF and HDF-EOS Workshop XII

More Related