資源簡介
全套aspose版資源,該資源僅用作學習交流使用,請勿用作商業用途,如有需要請購買正版。
代碼片段和文件信息
package?org.wgz.test;
import?java.io.FileInputStream;
import?java.io.IOException;
import?java.io.InputStream;
import?org.apache.log4j.Logger;
/**
?*?Aspose注冊工具
?*
?*?@author?
?*?@version?1.0.0
?*??????????2019年04月16日?15:58
?*?@since?Jdk1.8
?*/
public?class?AsposeLicenseUtil?{
????private?static?InputStream?inputStream?=?null;
????private?static?Logger?logger?=?Logger.getLogger(AsposeLicenseUtil.class);
????/**
?????*?獲取License的輸入流
?????*
?????*?@return
?????*/
????private?static?InputStream?getLicenseInput()?{
????????ClassLoader?contextClassLoader?=?Thread.currentThread().getContextClassLoader();
????????try?{
????????????String?path?=?contextClassLoader.getResource(“license.xml“).toURI().getPath();
????????????inputStream?=?new?FileInputStream(path);
????????}?catch?(Exception?e)?{
????????????logger.error(“license?not?found!“?e);
????????}
????????return?inputStream;
????}
????/**
?????*?設置License
?????*
?????*?@return?true表示已成功設置License?false表示失敗
?????*/
????public?static?boolean?setWordsLicense()?{
????????InputStream?licenseInput?=?getLicenseInput();
????????if?(licenseInput?!=?null)?{
????????????try?{
????????????????com.aspose.words.License?aposeLic?=?new?com.aspose.words.License();
????????????????aposeLic.setLicense(licenseInput);
????????????????return?aposeLic.getIsLicensed();
????????????}?catch?(Exception?e)?{
????????????????logger.error(“set?words?license?error!“?e);
????????????}finally?{
???????????? try?{
licenseInput.close();
}?catch?(IOException?e)?{
//?TODO?自動生成的?catch?塊
e.printStackTrace();
}
}
????????}
????????return?false;
????}
????/**
?????*?設置License
?????*
?????*?@return?true表示已成功設置License?false表示失敗
?????*/
????public?static?boolean?setCellsLicense()?{
????????InputStream?licenseInput?=?getLicenseInput();
????????if?(licenseInput?!=?null)?{
????????????try?{
????????????????com.aspose.cells.License?aposeLic?=?new?com.aspose.cells.License();
????????????????aposeLic.setLicense(licenseInput);
????????????????return?true;
????????????}?catch?(Exception?e)?{
????????????????logger.error(“set?cells?license?error!“?e);
????????????}finally?{
???????????? try?{
licenseInput.close();
}?catch?(IOException?e)?{
//?TODO?自動生成的?catch?塊
e.printStackTrace();
}
}
????????}
????????return?false;
????}
????
????
????/**
?????*?設置License
?????*
?????*?@return?true表示已成功設置License?false表示失敗
?????*/
????/**/public?static?boolean?setSlidesLicense()?{
????????InputStream?licenseInput?=?getLicenseInput();
????????if?(licenseInput?!=?null)?{
????????????try?{
????????????????com.aspose.slides.License?aposeLic?=?new?com.aspose.slides.License();
????????????????aposeLic.setLicense(licenseInput);
????????????????return?aposeLic.isLicensed();
????????????}?catch?(Exception?e)?{
????????????????logger.error(“set?ppt?license?error!“?e);
????????????}?finally?{
?????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-04-12?15:57??aspose\
?????文件?????6062936??2019-04-12?14:50??aspose\aspose-cells-8.5.2.jar
?????文件????12752053??2018-12-20?10:29??aspose\aspose-words-18.10-jdk16.jar
?????文件????31070096??2019-04-12?15:21??aspose\aspose.pdf-11.0.0.jar
?????文件????31562496??2019-04-12?10:21??aspose\aspose.slides-15.9.0.jar
?????文件????????4096??2019-04-12?15:33??aspose\AsposeLicenseUtil.java
?????文件????????3401??2019-04-12?16:04??aspose\AsposeUtil.java
?????文件?????????584??2019-04-12?15:19??aspose\license.xm
評論
共有 條評論