当前位置: 首页>>代码示例>>Java>>正文


Java Convert.parseLong方法代码示例

本文整理汇总了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;
	}
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:32,代码来源:BlockImpl.java

示例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();
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:8,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:9,代码来源:Attachment.java

示例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();
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:8,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:9,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Attachment.java

示例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;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:7,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:7,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Attachment.java

示例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"));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Attachment.java


注:本文中的nxt.util.Convert.parseLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。