public void copyStream(InputStream is) throws IOException {
  super.setContentEncoding(null);
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  while (true) {
    int b=is.read();
    if (b == -1) {
      content=baos.toByteArray();
      is.close();
      return;
    }
  }
}

public void copyStream ( InputStream is ) throws IOException { super . setContentEncoding ( null ) ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; while ( true ) { int b = is . read ( ) ; if ( b == - 1 ) { content = baos . toByteArray ( ) ; is . close ( ) ; return ; } } }
set the content by copying the given stream . < p > note : do not use this when the content is character data since the encoding attribute will not be set .
