//Get the size of the InputStream object int size = inputStream.available();
//Create and populate a byte array byte[] data = new byte[size]; inputStream.read(data);
will not work all the time. the method .available() according to the JavaDoc: Returns the number of bytes that can be read (or skipped over) from this input stream without blocking ...
available() is being used as a method to return complete size of the data. For JDBC/Network inputStreams this can return 0 even though there is data available.
Comments
No screen name said on Oct 9, 2007 at 7:36 AM :