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


Java JsonArray.toString方法代码示例

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


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

示例1: isSendingOperationComplete

import com.eclipsesource.json.JsonArray; //导入方法依赖的package包/类
public synchronized boolean isSendingOperationComplete(String opID)
    throws WalletCallException, IOException, InterruptedException
{
	JsonArray response = this.executeCommandAndGetJsonArray(
		"z_getoperationstatus", wrapStringParameter("[\"" + opID + "\"]"));
	JsonObject jsonStatus = response.get(0).asObject();

	String status = jsonStatus.getString("status", "ERROR");

	Log.info("Operation " + opID + " status is " + response + ".");

	if (status.equalsIgnoreCase("success") ||
		status.equalsIgnoreCase("error") ||
		status.equalsIgnoreCase("failed"))
	{
		return true;
	} else if (status.equalsIgnoreCase("executing") || status.equalsIgnoreCase("queued"))
	{
		return false;
	} else
	{
		throw new WalletCallException("Unexpected status response from wallet: " + response.toString());
	}
}
 
开发者ID:ZencashOfficial,项目名称:zencash-swing-wallet-ui,代码行数:25,代码来源:ZCashClientCaller.java

示例2: isCompletedOperationSuccessful

import com.eclipsesource.json.JsonArray; //导入方法依赖的package包/类
public synchronized boolean isCompletedOperationSuccessful(String opID)
    throws WalletCallException, IOException, InterruptedException
{
	JsonArray response = this.executeCommandAndGetJsonArray(
		"z_getoperationstatus", wrapStringParameter("[\"" + opID + "\"]"));
	JsonObject jsonStatus = response.get(0).asObject();

	String status = jsonStatus.getString("status", "ERROR");

	Log.info("Operation " + opID + " status is " + response + ".");

	if (status.equalsIgnoreCase("success"))
	{
		return true;
	} else if (status.equalsIgnoreCase("error") || status.equalsIgnoreCase("failed"))
	{
		return false;
	} else
	{
		throw new WalletCallException("Unexpected final operation status response from wallet: " + response.toString());
	}
}
 
开发者ID:ZencashOfficial,项目名称:zencash-swing-wallet-ui,代码行数:23,代码来源:ZCashClientCaller.java

示例3: isSendingOperationComplete

import com.eclipsesource.json.JsonArray; //导入方法依赖的package包/类
public synchronized boolean isSendingOperationComplete(String opID)
    throws WalletCallException, IOException, InterruptedException
{
	JsonArray response = this.executeCommandAndGetJsonArray(
		"z_getoperationstatus", wrapStringParameter("[\"" + opID + "\"]"));
	JsonObject jsonStatus = response.get(0).asObject();

	String status = jsonStatus.getString("status", "ERROR");

	System.out.println("Operation " + opID + " status is " + response + ".");

	if (status.equalsIgnoreCase("success") ||
		status.equalsIgnoreCase("error") ||
		status.equalsIgnoreCase("failed"))
	{
		return true;
	} else if (status.equalsIgnoreCase("executing") || status.equalsIgnoreCase("queued"))
	{
		return false;
	} else
	{
		throw new WalletCallException("Unexpected status response from wallet: " + response.toString());
	}
}
 
开发者ID:ca333,项目名称:komodoGUI,代码行数:25,代码来源:ZCashClientCaller.java

示例4: isCompletedOperationSuccessful

import com.eclipsesource.json.JsonArray; //导入方法依赖的package包/类
public synchronized boolean isCompletedOperationSuccessful(String opID)
    throws WalletCallException, IOException, InterruptedException
{
	JsonArray response = this.executeCommandAndGetJsonArray(
		"z_getoperationstatus", wrapStringParameter("[\"" + opID + "\"]"));
	JsonObject jsonStatus = response.get(0).asObject();

	String status = jsonStatus.getString("status", "ERROR");

	System.out.println("Operation " + opID + " status is " + response + ".");

	if (status.equalsIgnoreCase("success"))
	{
		return true;
	} else if (status.equalsIgnoreCase("error") || status.equalsIgnoreCase("failed"))
	{
		return false;
	} else
	{
		throw new WalletCallException("Unexpected final operation status response from wallet: " + response.toString());
	}
}
 
开发者ID:ca333,项目名称:komodoGUI,代码行数:23,代码来源:ZCashClientCaller.java

示例5: sendMessage

import com.eclipsesource.json.JsonArray; //导入方法依赖的package包/类
public synchronized String sendMessage(String from, String to, double amount, double fee, String memo)
	throws WalletCallException, IOException, InterruptedException
{
	String hexMemo = Util.encodeHexString(memo);
	JsonObject toArgument = new JsonObject();
	toArgument.set("address", to);
	if (hexMemo.length() >= 2)
	{
		toArgument.set("memo", hexMemo.toString());
	}
	
	DecimalFormatSymbols decSymbols = new DecimalFormatSymbols(Locale.ROOT);

	// TODO: The JSON Builder has a problem with double values that have no fractional part
	// it serializes them as integers that ZCash does not accept. This will work with the 
	// fractional amounts always used for messaging
	toArgument.set("amount", new DecimalFormat("########0.00######", decSymbols).format(amount));

	JsonArray toMany = new JsonArray();
	toMany.add(toArgument);
	
	String toManyArrayStr =	toMany.toString();		
	String[] sendCashParameters = new String[]
    {
	    this.zcashcli.getCanonicalPath(), "z_sendmany", wrapStringParameter(from),
	    wrapStringParameter(toManyArrayStr),
	    // Default min confirmations for the input transactions is 1
	    "1",
	    // transaction fee
	    new DecimalFormat("########0.00######", decSymbols).format(fee)
	};
			
	// Create caller to send cash
    CommandExecutor caller = new CommandExecutor(sendCashParameters);
    String strResponse = caller.execute();

	if (strResponse.trim().toLowerCase(Locale.ROOT).startsWith("error:") ||
		strResponse.trim().toLowerCase(Locale.ROOT).startsWith("error code:"))
	{
	  	throw new WalletCallException("Error response from wallet: " + strResponse);
	}

	Log.info("Sending cash message with the following command: " +
               sendCashParameters[0] + " " + sendCashParameters[1] + " " +
               sendCashParameters[2] + " " + sendCashParameters[3] + " " +
               sendCashParameters[4] + " " + sendCashParameters[5] + "." +
               " Got result: [" + strResponse + "]");

	return strResponse.trim();
}
 
开发者ID:ZencashOfficial,项目名称:zencash-swing-wallet-ui,代码行数:51,代码来源:ZCashClientCaller.java


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