JsonCronetCallback

public abstract class JsonCronetCallback extends InMemoryTransformCronetCallback<JSONObject>

A specialization of InMemoryTransformCronetCallback that interprets the response body as JSON.

Public Constructor Summary

Public Method Summary

JsonCronetCallback
addCompletionListener(CronetRequestCompletionListener<? super JSONObject> listener)
Adds a completion listener.

Protected Method Summary

JSONObject
transformBodyBytes(UrlResponseInfo info, byte[] bodyBytes)
Transforms (deserializes) the plain full body into a user-defined object.

Inherited Method Summary

Public Constructors

public JsonCronetCallback ()

Public Methods

public JsonCronetCallback addCompletionListener (CronetRequestCompletionListener<? super JSONObject> listener)

Adds a completion listener. All listeners are informed when the request reaches a terminal state, in order of addition. If a listener is added multiple times, it will only be called once according to the first time it was added.

Parameters
listener

Protected Methods

protected JSONObject transformBodyBytes (UrlResponseInfo info, byte[] bodyBytes)

Transforms (deserializes) the plain full body into a user-defined object.

It is assumed that the implementing classes handle edge cases (such as empty and malformed bodies) appropriately. Cronet doesn't inspects the objects and passes them (or any exceptions) along to the issuer of the request.

Parameters
info
bodyBytes