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


Java Base64.decodeFast方法代码示例

本文整理汇总了Java中com.alibaba.fastjson.util.Base64.decodeFast方法的典型用法代码示例。如果您正苦于以下问题:Java Base64.decodeFast方法的具体用法?Java Base64.decodeFast怎么用?Java Base64.decodeFast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.fastjson.util.Base64的用法示例。


在下文中一共展示了Base64.decodeFast方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bytesValue

import com.alibaba.fastjson.util.Base64; //导入方法依赖的package包/类
public byte[] bytesValue() {
    return Base64.decodeFast(this.buf, this.np + 1, this.sp);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:JSONReaderScanner.java

示例2: bytesValue

import com.alibaba.fastjson.util.Base64; //导入方法依赖的package包/类
public byte[] bytesValue() {
    return Base64.decodeFast(this.text, this.np + 1, this.sp);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:JSONScanner.java

示例3: bytesValue

import com.alibaba.fastjson.util.Base64; //导入方法依赖的package包/类
public byte[] bytesValue() {
    return Base64.decodeFast(buf, np + 1, sp);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:4,代码来源:JSONReaderScanner.java

示例4: bytesValue

import com.alibaba.fastjson.util.Base64; //导入方法依赖的package包/类
public byte[] bytesValue() {
    return Base64.decodeFast(text, np + 1, sp);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:4,代码来源:JSONScanner.java

示例5: checkIAPReceipt

import com.alibaba.fastjson.util.Base64; //导入方法依赖的package包/类
/**
	 * Check if the receipt sent by client is for us and valid.
	 * 
	 * @param json
	 * @return
	 */
	public static boolean checkIAPReceipt(User user, String productId, String json) {
		try {
			String roleName = Constant.EMPTY;
			if ( user != null ) {
				roleName = user.getRoleName();
			}
			String decodeJson = new String(Base64.decodeFast(json));

			decodeJson = decodeJson.replaceAll("=", ":");
			decodeJson = decodeJson.replaceAll(";", ",");
			Object obj = com.alibaba.fastjson.JSON.parse(decodeJson);
//			String receipt = ((Map)obj).get("receipt-data").toString();
//			/**
//			 * receipt:
//			 * {
//					"signature" = "ApdxJdtNwPU2rA5/cn3kIO1OTk25feDKa0aagyyRveWlcFlglv6RF6znkiBS3um9Uc7pVob+PqZR2T8wyVrHNplof3DX3IqDOlWq+90a7Yl+qrR7A7jWwviw708PS+67PyHRnhO/G7bVqgRpEr6EuFybiU1FXAiXJc6ls1YAssQxAAADVzCCA1MwggI7oAMCAQICCGUUkU3ZWAS1MA0GCSqGSIb3DQEBBQUAMH8xCzAJBgNVBAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSYwJAYDVQQLDB1BcHBsZSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEzMDEGA1UEAwwqQXBwbGUgaVR1bmVzIFN0b3JlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA5MDYxNTIyMDU1NloXDTE0MDYxNDIyMDU1NlowZDEjMCEGA1UEAwwaUHVyY2hhc2VSZWNlaXB0Q2VydGlmaWNhdGUxGzAZBgNVBAsMEkFwcGxlIGlUdW5lcyBTdG9yZTETMBEGA1UECgwKQXBwbGUgSW5jLjELMAkGA1UEBhMCVVMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMrRjF2ct4IrSdiTChaI0g8pwv/cmHs8p/RwV/rt/91XKVhNl4XIBimKjQQNfgHsDs6yju++DrKJE7uKsphMddKYfFE5rGXsAdBEjBwRIxexTevx3HLEFGAt1moKx509dhxtiIdDgJv2YaVs49B0uJvNdy6SMqNNLHsDLzDS9oZHAgMBAAGjcjBwMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUNh3o4p2C0gEYtTJrDtdDC5FYQzowDgYDVR0PAQH/BAQDAgeAMB0GA1UdDgQWBBSpg4PyGUjFP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gRXRjL0dNVCI7Cgkib3JpZ2luYWwtcHVyY2hhc2UtZGF0ZSIgPSAiMjAxMi0wNy0xMiAxMjo1NDozNSBFdGMvR01UIjsKCSJiaWQiID0gImNvbS56ZXB0b2xhYi5jdHJleHBlcmltZW50cyI7CgkicHVyY2hhc2UtZGF0ZS1wc3QiID0gIjIwMTItMDctMTIgMDU6NTQ6MzUgQW1lcmljYS9Mb3NfQW5nZWxlcyI7Cn0=";
//					"pod" = "17";
//					"signing-status" = "0";
//				}
//			 */
//			String decodeReceipt = new String(Base64.decodeFast(receipt));
//			decodeReceipt = decodeReceipt.replaceAll("=", ":");
//			decodeReceipt = decodeReceipt.replaceAll(";", ",");
//			obj = com.alibaba.fastjson.JSON.parse(decodeReceipt);
			String purchaseInfo = ((Map)obj).get("purchase-info").toString();
			
			String decodePurchaseInfo = new String(Base64.decodeFast(purchaseInfo));
			/*
				{
					"original-purchase-date-pst" = "2012-07-12 05:54:35 America/Los_Angeles";
					"purchase-date-ms" = "1342097675882";
					"original-transaction-id" = "170000029449420";
					"bvrs" = "1.4";
					"app-item-id" = "450542233";
					"transaction-id" = "170000029449420";
					"quantity" = "1";
					"original-purchase-date-ms" = "1342097675882";
					"item-id" = "534185042";
					"version-external-identifier" = "9051236";
					"product-id" = "com.zeptolab.ctrbonus.superpower1";
					"purchase-date" = "2012-07-12 12:54:35 Etc/GMT";
					"original-purchase-date" = "2012-07-12 12:54:35 Etc/GMT";
					"bid" = "com.zeptolab.ctrexperiments";
					"purchase-date-pst" = "2012-07-12 05:54:35 America/Los_Angeles";
				}
			 */
			decodePurchaseInfo = decodePurchaseInfo.replaceAll("=", ":");
			decodePurchaseInfo = decodePurchaseInfo.replaceAll(";", ",");
			logger.info("User {} decode purchase-info: {}", roleName, decodePurchaseInfo);
			obj = com.alibaba.fastjson.JSON.parse(decodePurchaseInfo);
			String pid = ((Map)obj).get("product-id").toString();
			String purchaseDate = ((Map)obj).get("purchase-date-pst").toString();
			Date date = DateUtil.parseApplePurchaseDate(purchaseDate);
			if ( productId.equals(pid) ) {
				long currentMillis = System.currentTimeMillis();
				int timeDiff = (int)(currentMillis - date.getTime());
				if ( timeDiff > 0 && timeDiff < 86400000 ) {
					return true;
				} else {
					logger.info("The {} use a fake purchaseDate:{}", roleName, purchaseDate);
				}
			} else {
				logger.info("The {} use a fake productId:{}", roleName, pid);
			}
		} catch (Exception e) {
			logger.warn("Failed to check IAP receipt json:{}, exception:{}", json, e.getMessage());
			logger.info("Parse IAP receipt exception: ", e);
		}
		return false;
	}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:78,代码来源:Apple.java


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