protected static byte[] readAll(InputStream in) throws IOException {
  ByteArrayOutputStream outputStream=new ByteArrayOutputStream();
  byte[] buf=new byte[READ_BUFFER_LENGTH];
  int read;
  while ((read=in.read(buf,0,READ_BUFFER_LENGTH)) != -1) {
    outputStream.write(buf,0,read);
  }
  return outputStream.toByteArray();
}

protected static byte [ ] readAll ( InputStream in ) throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; byte [ ] buf = new byte [ READ_BUFFER_LENGTH ] ; int read ; while ( ( read = in . read ( buf , 0 , READ_BUFFER_LENGTH ) ) != - 1 ) { outputStream . write ( buf , 0 , read ) ; } return outputStream . toByteArray ( ) ; }
reads all bytes from an inputstream and stores them in an array , up to a maximum count .
