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


Java JsonParser.getLong方法代码示例

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


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

示例1: testGetLong

import javax.json.stream.JsonParser; //导入方法依赖的package包/类
@Test
public void testGetLong () throws IOException
{
	File file = new File ("../tests/data/types.json".replace ('/', File.separatorChar));
	JsonParser p = getJsonParser (file, 0);
	long[] longs = new long[9];
	int count = 0;
	while (p.hasNext ())
	{
		if (p.next () == Event.VALUE_NUMBER)
		{
			longs[count++] = p.getLong ();
		}
	}
	p.close ();
	Assert.assertArrayEquals (new long[]
	{ 1234, 12345678901234L, 7888426545362939890L, 12345, 1234, 12345678901234L, 7888426545362939890L, 12345, 1 },
			longs);
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:20,代码来源:UTF8TextJsonParserTest.java

示例2: testGetLong_2

import javax.json.stream.JsonParser; //导入方法依赖的package包/类
@Test
public void testGetLong_2 () throws IOException
{
	File file = new File ("../tests/data/types.json".replace ('/', File.separatorChar));
	JsonParser p = getJsonParser (file, 1);
	long[] longs = new long[9];
	int count = 0;
	while (p.hasNext ())
	{
		if (p.next () == Event.VALUE_NUMBER)
		{
			longs[count++] = p.getLong ();
		}
	}
	p.close ();
	Assert.assertArrayEquals (new long[]
	{ 1234, 12345678901234L, 7888426545362939890L, 12345, 1234, 12345678901234L, 7888426545362939890L, 12345, 1 },
			longs);
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:20,代码来源:UTF8TextJsonParserTest.java

示例3: testGetLong

import javax.json.stream.JsonParser; //导入方法依赖的package包/类
@Test
public void testGetLong () throws IOException
{
	File file = new File ("../tests/data/types.json".replace ('/', File.separatorChar));
	JsonParser p = getJsonParser (file, 0);
	long[] longs = new long[9];
	int count = 0;
	while (p.hasNext ())
	{
		if (p.next () == Event.VALUE_NUMBER)
		{
			longs[count++] = p.getLong ();
		}
	}
	p.close ();
	Assert.assertArrayEquals (new long[]{ 1234, 12345678901234L, 7888426545362939890L, 12345, 1234, 12345678901234L, 7888426545362939890L, 12345, 1 }, longs);
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:18,代码来源:TextJsonParserTest.java

示例4: testGetLong_2

import javax.json.stream.JsonParser; //导入方法依赖的package包/类
@Test
public void testGetLong_2 () throws IOException
{
	File file = new File ("../tests/data/types.json".replace ('/', File.separatorChar));
	JsonParser p = getJsonParser (file, 1);
	long[] longs = new long[9];
	int count = 0;
	while (p.hasNext ())
	{
		if (p.next () == Event.VALUE_NUMBER)
		{
			longs[count++] = p.getLong ();
		}
	}
	p.close ();
	Assert.assertArrayEquals (new long[]{ 1234, 12345678901234L, 7888426545362939890L, 12345, 1234, 12345678901234L, 7888426545362939890L, 12345, 1 }, longs);
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:18,代码来源:TextJsonParserTest.java

示例5: testGetLong

import javax.json.stream.JsonParser; //导入方法依赖的package包/类
@Test
public void testGetLong () throws IOException
{
	File file = new File ("../tests/data/types.bson".replace ('/', File.separatorChar));
	JsonParser p = new BsonParser (new FileInputStream (file));
	long[] longs = new long[9];
	int count = 0;
	while (p.hasNext ())
	{
		if (p.next () == Event.VALUE_NUMBER)
		{
			longs[count++] = p.getLong ();
		}
	}
	p.close ();
	Assert.assertArrayEquals (new long[]{ 1234, 12345678901234L, 9223372036854775807L, 12345, 1234, 12345678901234L, 9223372036854775807L, 12345, 1 }, longs);
}
 
开发者ID:coconut2015,项目名称:cookjson,代码行数:18,代码来源:BsonParserTest.java


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