本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}