/**
   * LEGACY METHOD to run older versions of Android Layoutlib. ==== DO NOT CHANGE ====
   *
   * <p>Loads a 9 patch or regular bitmap.
   *
   * @param stream the {@link InputStream} of the file to load.
   * @param is9Patch whether the file represents a 9-patch
   * @param convert if <code>true</code>, non 9-patch bitmap will be converted into a 9 patch. If
   *     <code>false</code> and the bitmap is not a 9 patch, the method will return <code>null
   *     </code>.
   * @return a {@link NinePatch} or <code>null</code>.
   * @throws IOException
   */
  public static NinePatch load(InputStream stream, boolean is9Patch, boolean convert)
      throws IOException {
    BufferedImage image = null;
    try {
      image = GraphicsUtilities.loadCompatibleImage(stream);
    } catch (MalformedURLException e) {
      // really this shouldn't be happening since we're not creating the URL manually.
      return null;
    }

    return load(image, is9Patch, convert);
  }
  /**
   * LEGACY METHOD to run older versions of Android Layoutlib. ==== DO NOT CHANGE ====
   *
   * <p>Loads a 9 patch or regular bitmap.
   *
   * @param fileUrl the URL of the file to load.
   * @param convert if <code>true</code>, non 9-patch bitmap will be converted into a 9 patch. If
   *     <code>false</code> and the bitmap is not a 9 patch, the method will return <code>null
   *     </code>.
   * @return a {@link NinePatch} or <code>null</code>.
   * @throws IOException
   */
  public static NinePatch load(URL fileUrl, boolean convert) throws IOException {
    BufferedImage image = null;
    try {
      image = GraphicsUtilities.loadCompatibleImage(fileUrl);
    } catch (MalformedURLException e) {
      // really this shouldn't be happening since we're not creating the URL manually.
      return null;
    }

    boolean is9Patch = fileUrl.getPath().toLowerCase(Locale.US).endsWith(EXTENSION_9PATCH);

    return load(image, is9Patch, convert);
  }