在使用本方法前，必须初始化AopClient且传入公私钥参数。
公钥是否是读取字符串还是读取文件，是根据初始化传入的值判断的。
2035
public function rsaEncrypt($data, $rsaPublicKeyPem, $charset) {
		if($this->checkEmpty($this->alipayPublicKey)){
			//读取字符串
			$pubKey= $this->alipayrsaPublicKey;
			$res = "-----BEGIN PUBLIC KEY-----\n" .
				wordwrap($pubKey, 64, "\n", true) .
				"\n-----END PUBLIC KEY-----";
		}else {
			//读取公钥文件
			$pubKey = file_get_contents($rsaPublicKeyFilePath);
			//转换为openssl格式密钥
			$res = openssl_get_publickey($pubKey);
		}

		($res) or die('支付宝RSA公钥错误。请检查公钥文件格式是否正确'); 
		$blocks = $this->splitCN($data, 0, 30, $charset);
		$chrtext  = null;
		$encodes  = array();
		foreach ($blocks as $n => $block) {
			if (!openssl_public_encrypt($block, $chrtext , $res)) {
				echo "<br/>" . openssl_error_string() . "<br/>";
			}
			$encodes[] = $chrtext ;
		}
		$chrtext = implode(",", $encodes);

		return base64_encode($chrtext);
	}
444442
@Override
    public void onConnect(int rst, HuaweiApiClient client) {

        HMSAgentLog.d("onConnect:" + rst);

        if (client == null || !ApiClientMgr.INST.isConnect(client)) {
            HMSAgentLog.e("client not connted");
            onLoginResult(rst, null);
            return;
        }

        Activity curActivity = ActivityMgr.INST.getLastActivity();
        if (curActivity == null) {
            HMSAgentLog.e("activity is null");
            onLoginResult(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE, null);
            return;
        }

        /**
         * 调用login接口，传入成功回调。 此回调仅在成功时回调。
         */
        HMSAgentLog.d("begin login by HMS-SDK");
        PendingResult<GameLoginResult> loginPending = HuaweiGame.HuaweiGameApi.login(client, curActivity, forceLogin, new GameLoginHandler(){

            @Override
            public void onResult(int retCode, GameUserData userData) {
                HMSAgentLog.d("onResult:retCode=" + retCode + "  userData=" + StrUtils.objDesc(userData));
                onLoginResult(retCode, userData);
            }

            @Override
            public void onChange() {
                HMSAgentLog.d("onChange");

                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public void run() {
                        if (handler != null) {
                            handler.onChange();
                        }
                    }
                });
            }
        });

        loginPending.setResultCallback(new ResultCallback<GameLoginResult>() {
            @Override
            public void onResult(GameLoginResult result) {

                if (result == null) {
                    HMSAgentLog.e("result is null");
                    onLoginResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
                    return;
                }

                Status status = result.getStatus();
                if (status == null) {
                    HMSAgentLog.e("status is null");
                    onLoginResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
                    return;
                }

                int rstCode = status.getStatusCode();
                HMSAgentLog.d("status=" + status);

                if (!result.getStatus().isSuccess()) {
                    // 需要重试的错误码，并且可以重试
                    if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
                            || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
                        retryTimes--;
                        connect();
                    } else {
                        onLoginResult(rstCode, null);
                    }
                } else {
                    // 经确认，成功的情况下会走上面handler里面的2个回调,
                    // 这边不需要任何处理
                }
            }
        });
    }
821921
private String doPostByUrl(String uri, String param) throws IOException {
        HttpURLConnection connection;
        URL url = new URL(uri);

        connection = (HttpURLConnection)url.openConnection();           // 新建连接实例
        connection.setConnectTimeout(Constant.DEFAULT_CONN_TIMEOUT);    // 设置连接超时时间，单位毫秒
        connection.setReadTimeout(Constant.DEFAULT_READ_TIMEOUT);       // 设置读取数据超时时间，单位毫秒
        connection.setDoInput(true);                                    // 是否打开输出流 true|false
        connection.setDoOutput(true);                                   // 是否打开输入流true|false
        connection.setRequestMethod(Constant.RequestMethodPost);        // 提交方法POST|GET
        connection.setUseCaches(false);                                 // 是否缓存true|false
        connection.connect();                                           // 打开连接端口

         out = new (connection.getOutputStream());
        out.writeBytes(param);
        out.flush();
        out.close();

        BufferedReader reader
                = new BufferedReader(
                        new InputStreamReader(connection.getInputStream(),
                                                Constant.DEFAULT_CHARSET));
        StringBuilder buffer = new StringBuilder();
        String line;
        while ((line = reader.readLine())!= null) {
            buffer.append(line);
        }

        // 关闭连接
        reader.close();
        connection.disconnect();

        return buffer.toString();
    }
609850
private static Object invoke(Class target, Object o, String methodName, Object[] paras)
			throws IllegalAccessException, IllegalArgumentException, InvocationTargetException
	{

		ObjectInfo info = getObjectInfo(target);
		Class[] parameterType = new Class[paras.length];
		int i = 0;
		for (Object para : paras)
		{
			parameterType[i++] = para == null ? null : para.getClass();
		}
		ObjectMethodMatchConf mf = findMethod(target, methodName, parameterType);
		if (mf == null)
		{
			throw new BeetlParserException(BeetlParserException.NATIVE_CALL_INVALID, "根据参数未找到匹配的方法"+methodName+BeetlUtil.getParameterDescription(parameterType));
		}
		Object result = invoke(o, mf, paras);
		return result;

	}
95194
public Ftp init(String host, int port, String user, String password, FtpMode mode) {
		final FTPClient client = new FTPClient();
		client.setControlEncoding(this.charset.toString());
		try {
			// 连接ftp服务器
			client.connect(host, port);
			// 登录ftp服务器
			client.login(user, password);
		} catch (IOException e) {
			throw new FtpException(e);
		}
		final int replyCode = client.getReplyCode(); // 是否成功登录服务器
		if (false == FTPReply.isPositiveCompletion(replyCode)) {
			try {
				client.disconnect();
			} catch (IOException e) {
				// ignore
			}
			throw new FtpException("Login failed for user [{}], reply code is: [{}]", user, replyCode);
		}
		this.client = client;
		if (mode != null ) {
			setMode(mode);
		}
		return this;
	}
592820
function TransmitOralProcessWithInit(client, req) {
    return new Promise(function (resolve, reject) {
        // 通过client对象调用想要访问的接口，需要传入请求对象以及响应回调函数
        client.TransmitOralProcessWithInit(req, function (err, response) {
            if (err) {
                reject(err)
                return;
            }
            // 请求正常返回，打印response对象
            resolve(response)
        });
    })
}
841652
@Override
	public boolean permit(String resourceId, Class c, Object target, String method) {
		if (c.isArray()) {
			// 允许调用，但实际上会在在其后调用中报错。不归此处管理
			return true;
		}
		String name = c.getName();
		String className = null;
		String pkgName = null;
		int i = name.lastIndexOf('.');
		if (i != -1) {
			pkgName = name.substring(0, i);
			className = name.substring(i + 1);

		} else {
			// 无包名，允许调用
			return true;
		}

		if (pkgName.startsWith("java.lang")) {
			if (className.equals("Runtime") || className.equals("Process") || className.equals("ProcessBuilder")
					|| className.equals("System")) {
				return false;
			}
		}

		return true;
	}
927697
@Override
    public boolean checkMgtKeyInUse(String CorpNum, MgtKeyType KeyType,
                                    String MgtKey) throws PopbillException {

        if (KeyType == null)
            throw new PopbillException(-99999999, "관리번호형태가 입력되지 않았습니다.");
        if (MgtKey == null || MgtKey.isEmpty())
            throw new PopbillException(-99999999, "관리번호가 입력되지 않았습니다.");

        try {
            TaxinvoiceInfo info = httpget("/Taxinvoice/" + KeyType.name() + "/"
                    + MgtKey, CorpNum, null, TaxinvoiceInfo.class);

            return (info.getItemKey() == null || info.getItemKey().isEmpty()) == false;
        } catch (PopbillException PE) {
            if (PE.getCode() == -11000005)
                return false;
            throw PE;
        }
    }
167405
@Override
    public void onConnect(int rst, HuaweiApiClient client) {

        HMSAgentLog.d("onConnect:" + rst);

        if (client == null || !ApiClientMgr.INST.isConnect(client)) {
            HMSAgentLog.e("client not connted");
            onProductDetailResult(rst, null);
            return;
        }

        // 调用HMS-SDK getOrderDetail 接口
        PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq);
        checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() {
            @Override
            public void onResult(ProductDetailResult result) {

                if (result == null) {
                    HMSAgentLog.e("result is null");
                    onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
                    return;
                }

                Status status = result.getStatus();
                if (status == null) {
                    HMSAgentLog.e("status is null");
                    onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
                    return;
                }

                int rstCode = status.getStatusCode();
                HMSAgentLog.d("status=" + status);
                // 需要重试的错误码，并且可以重试
                if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
                        || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
                    retryTimes--;
                    connect();
                } else {
                    onProductDetailResult(rstCode, result);
                }
            }
        });
    }
448000
private AFTPClient actionCreateDir() throws IOException, PageException {
	required("directory", directory);

	AFTPClient client = getClient();
	client.makeDirectory(directory);
	writeCfftp(client);
	return client;
    }
363121
public static String get(String host, String path, Map<String, String> headers, String param) {

        CloseableHttpClient httpClient = null;
        CloseableHttpResponse response = null;

        try {
            // host校验，一定不能为空，否则无法进行请求
            ExceptionUtil.notNull(host);

            // 创建HttpClient
            httpClient = wrapClient(host);

            // 创建HttpGet
            HttpGet request = new HttpGet(buildUrl(host, path, param));
            defaultHeader(request);

            // header处理
            if (MapUtil.isNotEmpty(headers)) {
                for (Map.Entry<String, String> e : headers.entrySet()) {
                    request.addHeader(e.getKey(), e.getValue());
                }
            }

            // 响应结果
            response = httpClient.execute(request);

            // 响应结果处理响应内容
            String result = null;

            if (response != null) {
                HttpEntity resEntity = response.getEntity();
                if (resEntity != null) {
                    result = EntityUtils.toString(resEntity, Charset.UTF_8);
                }
            }

            return result;
        } catch (IOException | ParseException e) {
            e.printStackTrace();
        } finally {
            close(httpClient, response);
        }
        return null;
    }
1134526
public void ack(String requestId, String resultMessage) throws TException
    {
        int index = this.requestedMap.remove(requestId);
        DRPCInvocationsClient client = this.clients.get(index);
        client.result(requestId, resultMessage);
    }
78524
@Override
    public void onConnect(int rst, HuaweiApiClient client) {

        HMSAgentLog.d("onConnect:" + rst);

        if (client == null || !ApiClientMgr.INST.isConnect(client)) {
            HMSAgentLog.e("client not connted");
            onPurchaseInfoResult(rst, null);
            return;
        }

        // 调用HMS-SDK getOrderDetail 接口
        PendingResult<PurchaseInfoResult> purchaseInfoPenddingResult = HuaweiPay.HuaweiPayApi.getPurchaseInfo(client, purchaseInfoReq);
        purchaseInfoPenddingResult.setResultCallback(new ResultCallback<PurchaseInfoResult>() {
            @Override
            public void onResult(PurchaseInfoResult result) {

                if (result == null) {
                    HMSAgentLog.e("result is null");
                    onPurchaseInfoResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null);
                    return;
                }

                Status status = result.getStatus();
                if (status == null) {
                    HMSAgentLog.e("status is null");
                    onPurchaseInfoResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null);
                    return;
                }

                int rstCode = status.getStatusCode();
                HMSAgentLog.d("status=" + status);
                // 需要重试的错误码，并且可以重试
                if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID
                        || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) {
                    retryTimes--;
                    connect();
                } else {
                    onPurchaseInfoResult(rstCode, result);
                }
            }
        });
    }
693556
function modCompletePreDefine(currentId) {
        // HACK: 这里在IE下有个性能陷阱，不能使用任何变量。
        //       否则貌似会形成变量引用和修改的读写锁，导致wait4PreDefine释放困难
        each(wait4PreDefine, function (mod) {
            modPreDefine(
                currentId,
                mod.deps,
                mod.factory
            );
        });

        wait4PreDefine.length = 0;
    }
993775
public static String decryptByPrivateKey(String data, String privateKey, String fillMode) throws Exception {
		byte[] encryptedData = base64.decode(data);
		byte[] keyBytes = base64.decode(privateKey);
		PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes);
		KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
		Key privateK = keyFactory.generatePrivate(pkcs8KeySpec);
		// Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm());
		Cipher cipher = Cipher.getInstance(fillMode);

		cipher.init(Cipher.DECRYPT_MODE, privateK);
		int inputLen = encryptedData.length;
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		int offSet = 0;
		byte[] cache;
		int i = 0;
		// 对数据分段解密
		while (inputLen - offSet > 0) {
			if (inputLen - offSet > MAX_DECRYPT_BLOCK) {
				cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK);
			} else {
				cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet);
			}
			out.write(cache, 0, cache.length);
			i++;
			offSet = i * MAX_DECRYPT_BLOCK;
		}
		byte[] decryptedData = out.toByteArray();
		out.close();
		return new String(decryptedData);
	}
1316627
private void onDelayModify(WatchEvent<?> event, Path currentPath) {
		Path eventPath = Paths.get(currentPath.toString(), event.context().toString());
		if(eventSet.contains(eventPath)) {
			//此事件已经被触发过，后续事件忽略，等待统一处理。
			return;
		}
		
		//事件第一次触发，此时标记事件，并启动处理线程延迟处理，处理结束后会删除标记
		eventSet.add(eventPath);
		startHandleModifyThread(event, currentPath);
	}
270778
private static void doCheck(String appId, String cpId, String privateKey, String publicKey, GameUserData userData, ICheckLoginSignHandler callback) {
        // 创建body参数
        byte[] body = getRequestBody(appId, cpId, privateKey, userData);

        // 发送请求
        sendRequest(URL, body, publicKey, callback);
    }