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 .