本文整理汇总了Java中nxt.util.Convert.parseLong方法的典型用法代码示例。如果您正苦于以下问题:Java Convert.parseLong方法的具体用法?Java Convert.parseLong怎么用?Java Convert.parseLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxt.util.Convert
的用法示例。
在下文中一共展示了Convert.parseLong方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseBlock
import nxt.util.Convert; //导入方法依赖的package包/类
static BlockImpl parseBlock(JSONObject blockData) throws NxtException.ValidationException {
try {
int version = ((Long)blockData.get("version")).intValue();
int timestamp = ((Long)blockData.get("timestamp")).intValue();
Long previousBlock = Convert.parseUnsignedLong((String) blockData.get("previousBlock"));
long totalAmountNQT = Convert.parseLong(blockData.get("totalAmountNQT"));
long totalFeeNQT = Convert.parseLong(blockData.get("totalFeeNQT"));
int payloadLength = ((Long)blockData.get("payloadLength")).intValue();
byte[] payloadHash = Convert.parseHexString((String) blockData.get("payloadHash"));
byte[] generatorPublicKey = Convert.parseHexString((String) blockData.get("generatorPublicKey"));
byte[] generationSignature = Convert.parseHexString((String) blockData.get("generationSignature"));
byte[] blockSignature = Convert.parseHexString((String) blockData.get("blockSignature"));
byte[] previousBlockHash = version == 1 ? null : Convert.parseHexString((String) blockData.get("previousBlockHash"));
Long nonce = Convert.parseUnsignedLong((String)blockData.get("nonce"));
SortedMap<Long, TransactionImpl> blockTransactions = new TreeMap<>();
JSONArray transactionsData = (JSONArray)blockData.get("transactions");
for (Object transactionData : transactionsData) {
TransactionImpl transaction = TransactionImpl.parseTransaction((JSONObject) transactionData);
if (blockTransactions.put(transaction.getId(), transaction) != null) {
throw new NxtException.NotValidException("Block contains duplicate transactions: " + transaction.getStringId());
}
}
byte[] blockATs = Convert.parseHexString( (String) blockData.get("blockATs") );
return new BlockImpl(version, timestamp, previousBlock, totalAmountNQT, totalFeeNQT, payloadLength, payloadHash, generatorPublicKey,
generationSignature, blockSignature, previousBlockHash, new ArrayList<>(blockTransactions.values()), nonce , blockATs);
} catch (NxtException.ValidationException|RuntimeException e) {
Logger.logDebugMessage("Failed to parse block: " + blockData.toJSONString());
throw e;
}
}
示例2: ColoredCoinsAssetIssuance
import nxt.util.Convert; //导入方法依赖的package包/类
ColoredCoinsAssetIssuance(JSONObject attachmentData) {
super(attachmentData);
this.name = (String) attachmentData.get("name");
this.description = Convert.nullToEmpty((String) attachmentData.get("description"));
this.quantityQNT = Convert.parseLong(attachmentData.get("quantityQNT"));
this.decimals = ((Long) attachmentData.get("decimals")).byteValue();
}
示例3: DigitalGoodsListing
import nxt.util.Convert; //导入方法依赖的package包/类
DigitalGoodsListing(JSONObject attachmentData) {
super(attachmentData);
this.name = (String) attachmentData.get("name");
this.description = (String) attachmentData.get("description");
this.tags = (String) attachmentData.get("tags");
this.quantity = ((Long) attachmentData.get("quantity")).intValue();
this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT"));
}
示例4: DigitalGoodsPurchase
import nxt.util.Convert; //导入方法依赖的package包/类
DigitalGoodsPurchase(JSONObject attachmentData) {
super(attachmentData);
this.goodsId = Convert.parseUnsignedLong((String)attachmentData.get("goods"));
this.quantity = ((Long)attachmentData.get("quantity")).intValue();
this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT"));
this.deliveryDeadlineTimestamp = ((Long)attachmentData.get("deliveryDeadlineTimestamp")).intValue();
}
示例5: DigitalGoodsDelivery
import nxt.util.Convert; //导入方法依赖的package包/类
DigitalGoodsDelivery(JSONObject attachmentData) {
super(attachmentData);
this.purchaseId = Convert.parseUnsignedLong((String)attachmentData.get("purchase"));
this.goods = new EncryptedData(Convert.parseHexString((String)attachmentData.get("goodsData")),
Convert.parseHexString((String)attachmentData.get("goodsNonce")));
this.discountNQT = Convert.parseLong(attachmentData.get("discountNQT"));
this.goodsIsText = Boolean.TRUE.equals(attachmentData.get("goodsIsText"));
}
示例6: MessagingAliasSell
import nxt.util.Convert; //导入方法依赖的package包/类
MessagingAliasSell(JSONObject attachmentData) {
super(attachmentData);
this.aliasName = Convert.nullToEmpty((String) attachmentData.get("alias"));
this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT"));
}
示例7: ColoredCoinsAssetTransfer
import nxt.util.Convert; //导入方法依赖的package包/类
ColoredCoinsAssetTransfer(JSONObject attachmentData) {
super(attachmentData);
this.assetId = Convert.parseUnsignedLong((String) attachmentData.get("asset"));
this.quantityQNT = Convert.parseLong(attachmentData.get("quantityQNT"));
this.comment = getVersion() == 0 ? Convert.nullToEmpty((String) attachmentData.get("comment")) : null;
}
示例8: ColoredCoinsOrderPlacement
import nxt.util.Convert; //导入方法依赖的package包/类
private ColoredCoinsOrderPlacement(JSONObject attachmentData) {
super(attachmentData);
this.assetId = Convert.parseUnsignedLong((String) attachmentData.get("asset"));
this.quantityQNT = Convert.parseLong(attachmentData.get("quantityQNT"));
this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT"));
}
示例9: DigitalGoodsPriceChange
import nxt.util.Convert; //导入方法依赖的package包/类
DigitalGoodsPriceChange(JSONObject attachmentData) {
super(attachmentData);
this.goodsId = Convert.parseUnsignedLong((String)attachmentData.get("goods"));
this.priceNQT = Convert.parseLong(attachmentData.get("priceNQT"));
}
示例10: DigitalGoodsRefund
import nxt.util.Convert; //导入方法依赖的package包/类
DigitalGoodsRefund(JSONObject attachmentData) {
super(attachmentData);
this.purchaseId = Convert.parseUnsignedLong((String)attachmentData.get("purchase"));
this.refundNQT = Convert.parseLong(attachmentData.get("refundNQT"));
}