code: private InputStream dumpInputStream(InputStream is) {
          ByteArrayOutputStream baos = new ByteArrayOutputStream();
          InputStream copiedStream = null;
          try {
  
              byte buf[] = new byte[2048];
              int len;
              while ((len = is.read(buf)) > 0) {
                  baos.write(buf, 0, len);
              }
              byte[] streamBytes = baos.toByteArray();
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, " InputStream dump ", baos.toString());
              }
  
              copiedStream = new ByteArrayInputStream(streamBytes);
  
              is.close();
          } catch (IOException e) {
              // an IOException here will mean that we screwed up the original stream
              // we'll need to return null and the caller will need to attempt to
              // re-obtain the stream
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                  Tr.debug(tc, " InputStream dump failed ", e);
              }
              FFDCFilter.processException(e, CLASS_NAME + ".dumpInputStream", "630");
  
          } finally {
              try {
                  baos.close();
              } catch (IOException e) {
                  //AutoFFDC
              }
          }
          return copiedStream;
  
      }
docs: /*
  This routine is only called during debugging.