opendap/src/main/java/opendap/dap/DataDDS.java
public void readData(InputStream is, StatusUI statusUI)
            throws IOException, EOFException, DAP2Exception {

      /* ByteArrayOutputStream bout = new ByteArrayOutputStream(50 * 1000);
      copy(is, bout);
      LogStream.dbg.printf(" readData size=%d %n",bout.size());
      LogStream.dbg.logflush();
      ByteArrayInputStream bufferedIS = new ByteArrayInputStream( bout.toByteArray());  */
      //statusUI = new Counter();

        // Buffer the input stream for better performance
        BufferedInputStream bufferedIS = new BufferedInputStream(is);
        // Use a DataInputStream for deserialize
        DataInputStream dataIS = new DataInputStream(bufferedIS);

        for (Enumeration e = getVariables(); e.hasMoreElements();) {
            if (statusUI != null && statusUI.userCancelled()) throw new DataReadException("User cancelled");
            ClientIO bt = (ClientIO) e.nextElement();

          /* if (true) {
            BaseType btt = (BaseType) bt;
            System.out.printf("Deserializing: %s (%s) %n", btt.getEncodedName(), ((BaseType) bt).getTypeName());
          } */
            bt.deserialize(dataIS, ver, statusUI);
        }
        //LogStream.out.printf("Deserializing: total size = %s %n", counter);

        // notify GUI of finished download
        if (statusUI != null)
            statusUI.finished();
    }
public void readData(InputStream is, StatusUI statusUI)
            throws IOException, EOFException, DAP2Exception {

      /* ByteArrayOutputStream bout = new ByteArrayOutputStream(50 * 1000);
      copy(is, bout);
      LogStream.dbg.printf(" readData size=%d %n",bout.size());
      LogStream.dbg.logflush();
      ByteArrayInputStream bufferedIS = new ByteArrayInputStream( bout.toByteArray());  */
      //statusUI = new Counter();

        // Buffer the input stream for better performance
        BufferedInputStream bufferedIS = new BufferedInputStream(is);
        // Use a DataInputStream for deserialize
        DataInputStream dataIS = new DataInputStream(bufferedIS);

        for (Enumeration e = getVariables(); e.hasMoreElements();) {
            if (statusUI != null && statusUI.userCancelled()) throw new DataReadException("User cancelled");
            ClientIO bt = (ClientIO) e.nextElement();

          /* if (true) {
            BaseType btt = (BaseType) bt;
            System.out.printf("Deserializing: %s (%s) %n", btt.getEncodedName(), ((BaseType) bt).getTypeName());
          } */
            bt.deserialize(dataIS, ver, statusUI);
        }
        //LogStream.out.printf("Deserializing: total size = %s %n", counter);

        // notify GUI of finished download
        if (statusUI != null)
            statusUI.finished();
    }
Read the data stream from the given InputStream.  In the C++ version,
this code was in Connect.

@param is       the InputStream to read from
@param statusUI the StatusUI object to use, or null
@throws EOFException      if EOF is found before the variable is completely
deserialized.
@throws IOException       thrown on any other InputStream exception.
@throws DataReadException when invalid data is read, or if the user
cancels the download.
@throws DAP2Exception     if the OPeNDAP server returned an error.