/**
  * Helper method to create a LoadUrlParams object for an HTTP POST load.
  *
  * @param url URL of the load.
  * @param postData Post data of the load. Can be null.
  */
 public static LoadUrlParams createLoadHttpPostParams(String url, byte[] postData) {
   LoadUrlParams params = new LoadUrlParams(url);
   params.setLoadType(LOAD_TYPE_BROWSER_INITIATED_HTTP_POST);
   params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_TYPED);
   params.setPostData(postData);
   return params;
 }
  /**
   * Helper method to create a LoadUrlParams object for data url.
   *
   * @param data Data to be loaded.
   * @param mimeType Mime type of the data.
   * @param isBase64Encoded True if the data is encoded in Base 64 format.
   * @param charset The character set for the data. Pass null if the mime type does not require a
   *     special charset.
   */
  public static LoadUrlParams createLoadDataParams(
      String data, String mimeType, boolean isBase64Encoded, String charset) {
    StringBuilder dataUrl = new StringBuilder("data:");
    dataUrl.append(mimeType);
    if (charset != null && !charset.isEmpty()) {
      dataUrl.append(";charset=" + charset);
    }
    if (isBase64Encoded) {
      dataUrl.append(";base64");
    }
    dataUrl.append(",");
    dataUrl.append(data);

    LoadUrlParams params = new LoadUrlParams(dataUrl.toString());
    params.setLoadType(LoadUrlParams.LOAD_TYPE_DATA);
    params.setTransitionType(PageTransitionTypes.PAGE_TRANSITION_TYPED);
    return params;
  }