本文整理汇总了Java中com.alibaba.fastjson.serializer.SerializeWriter.writeLong方法的典型用法代码示例。如果您正苦于以下问题:Java SerializeWriter.writeLong方法的具体用法?Java SerializeWriter.writeLong怎么用?Java SerializeWriter.writeLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.serializer.SerializeWriter
的用法示例。
在下文中一共展示了SerializeWriter.writeLong方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
Media media = (Media) object;
SerializeWriter out = serializer.getWriter();
out.write('[');
out.writeInt(media.getBitrate());
out.write(',');
out.writeInt(media.getHeight());
out.write(',');
out.writeInt(media.getWidth());
out.write(',');
out.writeString(media.getCopyright(), ',');
out.writeLong(media.getDuration());
out.write(',');
out.writeString(media.getFormat(), ',');
out.write('[');
for (int i = 0; i < media.getPersons().size(); ++i) {
if(i != 0) {
out.write(',');
}
out.writeString(media.getPersons().get(i));
}
out.write("],");
out.writeString(media.getPlayer().name(), ',');
out.writeLong(media.getSize());
out.write(',');
out.writeString(media.getTitle(), ',');
out.writeString(media.getUri(), ']');
}
示例2: test_0
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
SerializeWriter writer = new SerializeWriter();
writer.append('A');
writer.writeInt(156);
Assert.assertEquals("A156", writer.toString());
writer.writeLong(345);
Assert.assertEquals("A156345", writer.toString());
}
示例3: test_0
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
StringWriter out = new StringWriter();
SerializeWriter writer = new SerializeWriter(out, 10);
Assert.assertEquals(10, writer.getBufferLength());
writer.write("abcde");
writer.writeLong(12345678L);
writer.close();
String text = out.toString();
Assert.assertEquals("abcde12345678", text);
}
示例4: test_0
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
StringWriter out = new StringWriter();
SerializeWriter writer = new SerializeWriter(out, 10);
Assert.assertEquals(10, writer.getBufferLength());
writer.write("abcde");
writer.writeLong(12345678L);
writer.write(',');
writer.close();
String text = out.toString();
Assert.assertEquals("abcde12345678,", text);
}
示例5: test_5
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_5() throws Exception {
SerializeWriter writer = new SerializeWriter();
writer.writeLong(-1L);
Assert.assertEquals("-1", writer.toString());
}
示例6: test_6
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_6() throws Exception {
SerializeWriter writer = new SerializeWriter();
writer.writeLong(-1L);
writer.write(',');
Assert.assertEquals("-1,", writer.toString());
}
示例7: test_13_long
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_13_long() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeLong(Long.MIN_VALUE);
Assert.assertEquals(Long.toString(Long.MIN_VALUE), out.toString());
}
示例8: test_13_long_browser
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的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());
}
示例9: test_13_long_browser2
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的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());
}
示例10: test_14_long
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_14_long() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeLong(Long.MAX_VALUE);
Assert.assertEquals(Long.toString(Long.MAX_VALUE), out.toString());
}
示例11: test_15_long
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_15_long() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeLong(Long.MAX_VALUE);
out.write(',');
Assert.assertEquals(Long.toString(Long.MAX_VALUE) + ",", out.toString());
}
示例12: test_16_long
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_16_long() throws Exception {
SerializeWriter out = new SerializeWriter(1);
out.writeLong(Long.MIN_VALUE);
out.write(',');
Assert.assertEquals(Long.toString(Long.MIN_VALUE) + ",", out.toString());
}
示例13: test_16_long_browser
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的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());
}
示例14: test_16_long_browser2
import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的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());
}