use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class JSONReaderTest_object_int method test_read_1.
public void test_read_1() throws Exception {
String text = "[{},{},{},{},{} ,{},{},{},{},{}]";
JSONReader reader = new JSONReader(new JSONScanner(text));
reader.startArray();
int count = 0;
while (reader.hasNext()) {
reader.readObject();
count++;
}
Assert.assertEquals(10, count);
reader.endArray();
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class JSONReaderTest_object_int_unquote method test_read.
public void test_read() throws Exception {
JSONReader reader = new JSONReader(new StringReader(text));
reader.startObject();
int count = 0;
while (reader.hasNext()) {
String key = (String) reader.readObject();
Integer value = reader.readInteger();
count++;
}
Assert.assertEquals(10, count);
reader.endObject();
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class JSONReaderTest_object_long method test_read.
public void test_read() throws Exception {
JSONReader reader = new JSONReader(new StringReader(text));
reader.startObject();
int count = 0;
while (reader.hasNext()) {
String key = (String) reader.readObject();
Long value = reader.readLong();
count++;
}
Assert.assertEquals(10, count);
reader.endObject();
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class JSONReaderTest_object_long method test_read_1.
public void test_read_1() throws Exception {
JSONReader reader = new JSONReader(new JSONScanner(text));
reader.startObject();
int count = 0;
while (reader.hasNext()) {
String key = (String) reader.readObject();
Long value = reader.readLong();
count++;
}
Assert.assertEquals(10, count);
reader.endObject();
reader.close();
}
use of com.alibaba.fastjson.JSONReader in project fastjson by alibaba.
the class JSONReaderTest_object_string method test_read.
public void test_read() throws Exception {
JSONReader reader = new JSONReader(new StringReader(text));
reader.startObject();
int count = 0;
while (reader.hasNext()) {
String key = (String) reader.readObject();
String value = reader.readString();
count++;
}
Assert.assertEquals(10, count);
reader.endObject();
reader.close();
}
Aggregations