本文整理汇总了Java中com.alibaba.fastjson.serializer.JSONSerializer.getWriter方法的典型用法代码示例。如果您正苦于以下问题:Java JSONSerializer.getWriter方法的具体用法?Java JSONSerializer.getWriter怎么用?Java JSONSerializer.getWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.alibaba.fastjson.serializer.JSONSerializer
的用法示例。
在下文中一共展示了JSONSerializer.getWriter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
MediaContent entity = (MediaContent) object;
SerializeWriter out = serializer.getWriter();
out.write('[');
mediaSerilaizer.write(serializer, entity.getMedia(), "media", Media.class, 0);
out.write(',');
out.write('[');
for (int i = 0; i < entity.getImages().size(); ++i) {
if (i != 0) {
out.write(',');
}
Image image = entity.getImages().get(i);
imageSerilaizer.write(serializer, image, i, fieldType, 0);
}
out.write(']');
out.write(']');
}
示例2: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
Image image = (Image) object;
SerializeWriter out = serializer.getWriter();
out.write('[');
out.writeInt(image.getHeight());
out.write(',');
out.writeInt(image.getWidth());
out.write(',');
out.writeString(image.getSize().name(), ',');
out.writeString(image.getTitle(), ',');
out.writeString(image.getUri());
out.write(']');
}
示例3: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, //
Object object, Object fieldName, Type fieldType, int features) throws IOException {
SerializeWriter out = serializer.getWriter();
Json json = (Json) object;
String value = json.value();
out.write(value);
}
示例4: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的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(), ']');
}
示例5: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
@Override
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
int features) throws IOException {
Model model = (Model) object;
SerializeWriter out = serializer.getWriter();
out.writeFieldValue('{', "ID", model.id);
out.write('}');
}
示例6: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
@Override
public void write(JSONSerializer serializer, Object object, Object o1, Type type, int i) throws IOException {
SerializeWriter out = serializer.getWriter();
if (object == null) {
out.writeNull();
return;
}
out.writeString(object.toString());
}
示例7: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object fieldName, Type fieldType) throws IOException {
SerializeWriter writer = serializer.getWriter();
writer.write(this.function);
writer.write('(');
for (int i = 0; i < this.parameters.size(); i++) {
if (i != 0) {
writer.write(',');
}
serializer.write(this.parameters.get(i));
}
writer.write(')');
}
示例8: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
SerializeWriter out = serializer.getWriter();
if (object == null) {
out.writeNull();
} else {
out.writeString(object.toString());
}
}
示例9: write
import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object fieldName, Type fieldType, int features) throws IOException {
SerializeWriter writer = serializer.getWriter();
writer.write(function);
writer.write('(');
for (int i = 0; i < parameters.size(); ++i) {
if (i != 0) {
writer.write(',');
}
serializer.write(parameters.get(i));
}
writer.write(')');
}