public class Metered
extends java.lang.Object
Examples:
In this example, an attempt will be made to set metered public and private key the component jar file:
Metered matered = new Metered();
matered.setMeteredKey("PublicKey", "PrivateKey");
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
| Constructor and Description |
|---|
Metered()
Initializes a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
static java.math.BigDecimal |
getConsumptionCredit()
Gets consumption credit
|
static java.math.BigDecimal |
getConsumptionQuantity()
Gets consumption file size
|
java.lang.String |
getProductName()
Returns Product name
|
static boolean |
isMeteredLicensed()
Check whether metered is licensed
|
void |
setMeteredKey(java.lang.String publicKey,
java.lang.String privateKey)
Sets metered public and private key.
|
public Metered()
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public void setMeteredKey(java.lang.String publicKey,
java.lang.String privateKey)
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
publicKey - public keyprivateKey - private keypublic static java.math.BigDecimal getConsumptionQuantity()
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public static java.math.BigDecimal getConsumptionCredit()
throws java.lang.Exception
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
java.lang.Exceptionpublic java.lang.String getProductName()
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
public static boolean isMeteredLicensed()
Examples:
Shows how to activate a Metered license and track credit/consumption.
// Create a new Metered license, and then print its usage statistics.
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
System.out.println("Is metered license accepted: {Metered.IsMeteredLicensed()}");
System.out.println("Product name: {metered.GetProductName()}");
System.out.println("Credit before operation: {Metered.GetConsumptionCredit()}");
System.out.println("Consumption quantity before operation: {Metered.GetConsumptionQuantity()}");
// Operate using Aspose.Words, and then print our metered stats again to see how much we spent.
Document doc = new Document(getMyDir() + "Document.docx");
doc.save(getArtifactsDir() + "Metered.Usage.pdf");
// Aspose Metered Licensing mechanism does not send the usage data to purchase server every time,
// you need to use waiting.
Thread.sleep(10000);
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));