code: private byte[] getBytesFromStream(final InputStream dstream)
  			throws IOException {
  		final ByteArrayOutputStream baos = new ByteArrayOutputStream();
  		final byte[] buffer = new byte[1024];
  		int read;
  		while ((read = dstream.read(buffer)) > 0) {
  			baos.write(buffer, 0, read);
  		}
  		return baos.toByteArray();
  	}
docs: Reads the bytes from the stream to a byte array.
  
  @param dstream The stream to be read from.
  @return An array of bytes.
  @throws IOException If the stream cannot be read properly.