use of com.koushikdutta.async.LineEmitter.StringCallback in project AndroidAsync by koush.
the class MultipartFormDataBody method onBoundaryStart.
@Override
protected void onBoundaryStart() {
final Headers headers = new Headers();
liner = new LineEmitter();
liner.setLineCallback(new StringCallback() {
@Override
public void onStringAvailable(String s) {
if (!"\r".equals(s)) {
headers.addLine(s);
} else {
handleLast();
liner = null;
setDataCallback(null);
Part part = new Part(headers);
if (mCallback != null)
mCallback.onPart(part);
if (getDataCallback() == null) {
if (part.isFile()) {
setDataCallback(new NullDataCallback());
return;
}
lastName = part.getName();
last = new ByteBufferList();
setDataCallback(new DataCallback() {
@Override
public void onDataAvailable(DataEmitter emitter, ByteBufferList bb) {
bb.get(last);
}
});
}
}
}
});
setDataCallback(liner);
}
Aggregations