code: protected IOException copyRange(InputStream istream, ServletOutputStream ostream) {
  
          // Copy the input stream to the output stream
          IOException exception = null;
          byte[] buffer = new byte[m_input];
          int len = buffer.length;
          while (true) {
              try {
                  len = istream.read(buffer);
                  if (len == -1) {
                      break;
                  }
                  ostream.write(buffer, 0, len);
              } catch (IOException e) {
                  exception = e;
                  len = -1;
                  break;
              }
          }
          return exception;
      }
docs: Copy the contents of the specified input stream to the specified
  output stream, and ensure that both streams are closed before returning
  (even in the face of an exception).<p>
  
  @param istream the input stream to read from
  @param ostream the output stream to write to
  
  @return the exception which occurred during processing