本文整理汇总了Java中com.alibaba.fastjson.parser.JSONScanner.scanNumber方法的典型用法代码示例。如果您正苦于以下问题:Java JSONScanner.scanNumber方法的具体用法?Java JSONScanner.scanNumber怎么用?Java JSONScanner.scanNumber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.parser.JSONScanner
的用法示例。
在下文中一共展示了JSONScanner.scanNumber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ftest_parse_long
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846476");
lexer.scanNumber();
Assert.assertEquals(new Long(1293770846476L), (Long) lexer.integerValue());
Assert.assertEquals(1293770846476L, lexer.longValue());
}
示例2: ftest_parse_long_1
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MAX_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MAX_VALUE, lexer.longValue());
}
示例3: test_parse_long_2
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Long.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Long(Long.MIN_VALUE), (Long) lexer.integerValue());
Assert.assertEquals(Long.MIN_VALUE, lexer.longValue());
}
示例4: test_error_0
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_0() {
Exception error = null;
try {
JSONScanner lexer = new JSONScanner("--");
lexer.scanNumber();
lexer.longValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例5: test_error_1
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_1() {
Exception error = null;
try {
String text = Long.MAX_VALUE + "1234";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.longValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例6: test_error_2
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_2() {
Exception error = null;
try {
String text = Long.MIN_VALUE + "1234";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.longValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例7: test_error_3
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_3() {
Exception error = null;
try {
String text = "9223372036854775809";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.longValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例8: ftest_parse_long
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void ftest_parse_long() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner("1293770846");
lexer.scanNumber();
Assert.assertEquals(new Integer(1293770846), (Integer) lexer.integerValue());
Assert.assertEquals(1293770846, lexer.intValue());
}
示例9: ftest_parse_long_1
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void ftest_parse_long_1() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Integer.toString(Integer.MAX_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MAX_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MAX_VALUE, lexer.intValue());
}
示例10: test_parse_long_2
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_parse_long_2() throws Exception {
System.out.println(System.currentTimeMillis());
JSONScanner lexer = new JSONScanner(Long.toString(Integer.MIN_VALUE));
lexer.scanNumber();
Assert.assertEquals(new Integer(Integer.MIN_VALUE), (Integer) lexer.integerValue());
Assert.assertEquals(Integer.MIN_VALUE, lexer.intValue());
}
示例11: test_error_0
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_0() {
Exception error = null;
try {
JSONScanner lexer = new JSONScanner("--");
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例12: test_error_1
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_1() {
Exception error = null;
try {
String text = Integer.MAX_VALUE + "1234";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例13: test_error_2
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_2() {
Exception error = null;
try {
String text = Integer.MIN_VALUE + "1234";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例14: test_error_3
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_error_3() {
Exception error = null;
try {
String text = "2147483648";
JSONScanner lexer = new JSONScanner(text);
lexer.scanNumber();
lexer.intValue();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
示例15: test_for_issue
import com.alibaba.fastjson.parser.JSONScanner; //导入方法依赖的package包/类
public void test_for_issue() throws Exception {
JSONScanner lexer = new JSONScanner("-100S");
lexer.resetStringPosition();
lexer.scanNumber();
Assert.assertEquals(Short.class, lexer.integerValue().getClass());
Assert.assertEquals(-100, lexer.integerValue().shortValue());
lexer.close();
}