title: Reading/Writing multiple datasets to a single HDF5 file
body: <p>How can we write multiple datasets to a single HDF5 file?
  Similarly, how could these datasets be re-read from the same file?</p>
  
  <p>I was thinking of creating multiple datasets using groups.. The code below is attempting to <strong>create an opaque datatype using ScalarDS under a group</strong>, but it is throwing exceptions.</p>
  
  <pre><code>      public static void createFile(Message message)throws Exception{  
        // retrieve an instance of H5File
        FileFormat fileFormat = FileFormat.getFileFormat(FileFormat.FILE_TYPE_HDF5); 
        if (fileFormat == null){
        System.err.println("Cannot find HDF5 FileFormat.");
        return;
        }   
        // create a new file with a given file name.
        H5File testFile = (H5File)fileFormat.create(fname);    
        if (testFile == null){
        System.err.println("Failed to create file:"+fname);
         return;
          }   
        // open the file and retrieve the root group    
          testFile.open();
          Group root = (Group)((javax.swing.tree.DefaultMutableTreeNode)testFile.getRootNode()).getUserObject();
          Group g1 = testFile.createGroup("byte arrays", root);        
      // obtaining the serialized object   
         byte[] b =serializer.serialize(message);  
         int len=b.length;
         byte[] dset_data = new byte[len+1];
     // Initialize data.
         int indx=0;
         for (int jndx = 0; jndx &lt; len ; jndx++)
         dset_data[jndx] = b[jndx];
         dset_data[len] = (byte)(indx) ;
     // create opaque dataset ---- error here…
         Datatype dtype = testFile.createDatatype(
         Datatype.CLASS_OPAQUE, (len*4), Datatype.NATIVE, Datatype.NATIVE);
         Dataset dataset = testFile.createScalarDS
         ("byte array", g1, dtype, dims1D, null, null, 0, dset_data);//error shown in this line
    // close file resource
       testFile.close();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I fail to understand why is it giving me HDF5 Library Exceptions and points at the createScalarDS line. Why is it unable to create an opaque dataset under the group?</p>