java.lang.Object
com.aspose.words.Metered
public class Metered
Example: Example:
Metered matered = new Metered();
matered.setMeteredKey("PublicKey", "PrivateKey");
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
// Print credit/usage
System.out.println(MessageFormat.format("Credit before operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity before operation: {0}", Metered.getConsumptionQuantity()));
// Do something
Document doc = new Document(getMyDir() + "Document.doc");
// Print credit/usage to see how much was spent
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));
| Constructor Summary |
|---|
Metered()
Initializes a new instance of this class. |
| Method Summary | ||
|---|---|---|
static java.math.BigDecimal | getConsumptionCredit() | |
| Gets consumption credit | ||
static java.math.BigDecimal | getConsumptionQuantity() | |
| Gets consumption file size | ||
void | setMeteredKey(java.lang.String publicKey, java.lang.String privateKey) | |
| Sets metered public and private key | ||
| Constructor Detail |
|---|
public Metered()
Example:
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
// Print credit/usage
System.out.println(MessageFormat.format("Credit before operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity before operation: {0}", Metered.getConsumptionQuantity()));
// Do something
Document doc = new Document(getMyDir() + "Document.doc");
// Print credit/usage to see how much was spent
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));| Method Detail |
|---|
getConsumptionCredit | |
public static java.math.BigDecimal getConsumptionCredit()
throws java.lang.Exception | |
Example:
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
// Print credit/usage
System.out.println(MessageFormat.format("Credit before operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity before operation: {0}", Metered.getConsumptionQuantity()));
// Do something
Document doc = new Document(getMyDir() + "Document.doc");
// Print credit/usage to see how much was spent
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));getConsumptionQuantity | |
public static java.math.BigDecimal getConsumptionQuantity() | |
Example:
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
// Print credit/usage
System.out.println(MessageFormat.format("Credit before operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity before operation: {0}", Metered.getConsumptionQuantity()));
// Do something
Document doc = new Document(getMyDir() + "Document.doc");
// Print credit/usage to see how much was spent
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));setMeteredKey | |
public void setMeteredKey(java.lang.String publicKey, java.lang.String privateKey) | |
publicKey - public keyprivateKey - private keyExample:
Shows how to activate a Metered license and track credit/consumption.
// Set a public and private key for a new Metered instance
Metered metered = new Metered();
metered.setMeteredKey("MyPublicKey", "MyPrivateKey");
// Print credit/usage
System.out.println(MessageFormat.format("Credit before operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity before operation: {0}", Metered.getConsumptionQuantity()));
// Do something
Document doc = new Document(getMyDir() + "Document.doc");
// Print credit/usage to see how much was spent
System.out.println(MessageFormat.format("Credit after operation: {0}", Metered.getConsumptionCredit()));
System.out.println(MessageFormat.format("Consumption quantity after operation: {0}", Metered.getConsumptionQuantity()));