Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.koushikdutta.ion.gson;
 
public class GsonBody<T extends JsonElementimplements AsyncHttpRequestBody<T> {
    byte[] mBodyBytes;
    T json;
    Gson gson;
    public GsonBody(Gson gson, T json) {
        this. = json;
        this. = gson;
    }
    @Override
    public void parse(DataEmitter emitterfinal CompletedCallback completed) {
        throw new AssertionError("not implemented");
    }
    @Override
    public void write(AsyncHttpRequest requestDataSink sinkfinal CompletedCallback completed) {
        if ( == null) {
            ByteArrayOutputStream bout = new ByteArrayOutputStream();
            OutputStreamWriter out = new OutputStreamWriter(bout);
            .toJson(out);
             = bout.toByteArray();
        }
        Util.writeAll(sinkcompleted);
    }
    @Override
    public String getContentType() {
        return ;
    }
    @Override
    public boolean readFullyOnRequest() {
        return true;
    }
    @Override
    public int length() {
        if ( == null)
             = .toString().getBytes();
        return .;
    }
    public static final String CONTENT_TYPE = .;
    @Override
    public T get() {
        return ;
    }
New to GrepCode? Check out our FAQ X