Esempio n. 1
0
  /** 获取license */
  private static boolean getLicense() {
    boolean result = false;
    try {
      String str =
          "<License>"
              + "<Data>"
              + "<Products>"
              + "<Product>Aspose.Total for Java</Product>"
              + "<Product>Aspose.Words for Java</Product>"
              + "</Products>"
              + "<EditionType>Enterprise</EditionType>"
              + "<SubscriptionExpiry>20991231</SubscriptionExpiry>"
              + "<LicenseExpiry>20991231</LicenseExpiry>"
              + "<SerialNumber>23dcc79f-44ec-4a23-be3a-03c1632404e9</SerialNumber>"
              + "</Data>"
              + "<Signature>2sNLLKGMUdF0r8O1kKilWAGdgfs2BvJb/2Xp8p5iuDVfZXmhppo+d0Ran1P9TKdjV4ABwAgKXxJ3jcQTqE/2IRfqwnPf8itN8aFZlV3TJPYeD3yWE7IT55Gz6EijUpC7aKeoohTb4w2fpox58wWoF3SNp6sK6jDfiAUGEHYJ9pjU=</Signature>"
              + "</License>";

      byte[] buf = str.getBytes();

      InputStream inputStream = new ByteArrayInputStream(buf);
      License aposeLic = new License();
      aposeLic.setLicense(inputStream);

      result = true;
    } catch (Exception e) {
      e.printStackTrace();
    }
    return result;
  }
 void applyAsposeLicense() {
   License license = new License();
   InputStream i = null;
   try {
     i = getResources().getAssets().open(getString(R.string.aspose_license_asset_file));
     license.setLicense(i);
     closeStream(i);
   } catch (Exception x) {
     Log.e(App.class.getName(), Log.getStackTraceString(x));
   } finally {
     closeStream(i);
   }
 }