A common pattern I use when processing stream data is:

   InputStream data = ...;
   try {
       byte[] buffer = new byte[BUFFER_SIZE];
       for (int n = data.read(buffer); n != -1; n = data.read(buffer)) {
           // process n bytes of data in buffer
       }
   } finally {
       data.close();

}



When I do this, i need to know how large the buffer needs to be, but i don't
know how big it is.
Is there a way to go around that?

Ted

Reply via email to