本文整理汇总了Java中com.alibaba.fastjson.serializer.SerializerFeature.BrowserCompatible方法的典型用法代码示例。如果您正苦于以下问题:Java SerializerFeature.BrowserCompatible方法的具体用法?Java SerializerFeature.BrowserCompatible怎么用?Java SerializerFeature.BrowserCompatible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.serializer.SerializerFeature
的用法示例。
在下文中一共展示了SerializerFeature.BrowserCompatible方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test_6_s
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_6_s() throws Exception {
SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
ListSerializer listSerializer = new ListSerializer();
List<Object> list = new ArrayList<Object>();
list.add(1L);
list.add(1453964515792017682L);
listSerializer.write(new JSONSerializer(out), list, null, null, 0);
Assert.assertEquals("[1,\"1453964515792017682\"]", out.toString());
}
示例2: test_7_s
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_7_s() throws Exception {
SerializeWriter out = new SerializeWriter(
SerializerFeature.BrowserCompatible, SerializerFeature.WriteClassName
);
ListSerializer listSerializer = new ListSerializer();
List<Object> list = new ArrayList<Object>();
list.add(1L);
list.add(1453964515792017682L);
listSerializer.write(new JSONSerializer(out), list, null, null, 0);
Assert.assertEquals("[1L,1453964515792017682L]", out.toString());
}
示例3: test_13_long_browser
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_13_long_browser() throws Exception {
SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
out.writeLong(Long.MIN_VALUE + 1);
Assert.assertEquals("\"" + Long.toString(Long.MIN_VALUE + 1) + "\"", out.toString());
}
示例4: test_13_long_browser2
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_13_long_browser2() throws Exception {
SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
out.writeLong(Long.MIN_VALUE);
Assert.assertEquals("\"" + Long.toString(Long.MIN_VALUE) + "\"", out.toString());
}
示例5: test_16_long_browser
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_16_long_browser() throws Exception {
SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
out.writeLong(Long.MIN_VALUE + 1);
out.write(',');
Assert.assertEquals("\"" + Long.toString(Long.MIN_VALUE + 1) + "\",", out.toString());
}
示例6: test_16_long_browser2
import com.alibaba.fastjson.serializer.SerializerFeature; //导入方法依赖的package包/类
public void test_16_long_browser2() throws Exception {
SerializeWriter out = new SerializeWriter(SerializerFeature.BrowserCompatible);
out.writeLong(Long.MIN_VALUE);
out.write(',');
Assert.assertEquals("\"" + Long.toString(Long.MIN_VALUE) + "\",", out.toString());
}