當前位置: 首頁>>代碼示例>>Java>>正文


Java JSONSerializer.getWriter方法代碼示例

本文整理匯總了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(']');
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:MediaContentSerializer.java

示例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(']');
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:ImageSerializer.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:SwaggerJsonSerializer.java

示例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(), ']');
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:MediaSerializer.java

示例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('}');
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:CustomSerializerTest.java

示例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());
}
 
開發者ID:okingjerryo,項目名稱:WeiMusicCommunity-server,代碼行數:10,代碼來源:JodaTimeDeserializer.java

示例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(')');
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:13,代碼來源:JSONPObject.java

示例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());
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:9,代碼來源:Jdk8DateCodec.java

示例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(')');
}
 
開發者ID:uavorg,項目名稱:uavstack,代碼行數:13,代碼來源:JSONPObject.java


注:本文中的com.alibaba.fastjson.serializer.JSONSerializer.getWriter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。