import java.io.InputStream;
public class AppLicense {
com.aspose.slides.License slidesLicense;
com.aspose.words.License wordsLicense;
public AppLicense(InputStream inputStream) throws Exception {
setSlidesLicense(inputStream);
setCellsLicense(inputStream);
setPDFLicense(inputStream);
setWordsLicense(inputStream);
}
private void setPDFLicense(InputStream inputStream) throws Exception {
com.aspose.pdf.License pdfLicense = new com.aspose.pdf.License();
pdfLicense.setLicense(inputStream);
}
private void setCellsLicense(InputStream inputStream) throws Exception {
com.aspose.cells.License cellsLicense = new com.aspose.cells.License();
cellsLicense.setLicense(inputStream);
}
private void setSlidesLicense(InputStream inputStream) throws Exception {
slidesLicense = new com.aspose.slides.License();
slidesLicense.setLicense(inputStream);
}
private void setWordsLicense(InputStream inputStream) throws Exception {
wordsLicense = new com.aspose.words.License();
wordsLicense.setLicense(inputStream);
}
public boolean isPDFLicensed(){
return com.aspose.pdf.Document.isLicensed();
}
public boolean isCellsLicensed(){
return com.aspose.cells.License.isLicenseSet();
}
public boolean isSlidesLicensed(){
return slidesLicense.isLicensed();
}
public boolean isWordsLicensed(){
return wordsLicense.isLicensed();
}
}
When I call AppLicense(getResources().openRawResource(R.raw.license)) method, I get various types of errors which i am trying to explain using following cases:-
1st Case
setWordsLicense(inputStream);
setPDFLicense(inputStream); //Error in this line
setCellsLicense(inputStream);
setSlidesLicense(inputStream);
Error - java.lang.NullPointerException: asset
2nd Case
setPDFLicense(inputStream);
setWordsLicense(inputStream); //Error in this line
setCellsLicense(inputStream);
setSlidesLicense(inputStream);
Error - org.xml.sax.SAXParseException: Unexpected end of document
3rd Case
setCellsLicense(inputStream);
setPDFLicense(inputStream); //Error in this line
setWordsLicense(inputStream);
setSlidesLicense(inputStream);
Error - java.lang.NullPointerException: asset