public class**UrlRequestCallbacks** extends Object  
Utility class for creating simple, convenient`UrlRequest.Callback`implementations for reading common types of responses.

Note that the convenience callbacks store the entire response body in memory. We do not recommend using them if it's possible to stream the response body, or if the response body sizes can cause strain on the on-device resources.

The helper callbacks come in two flavors - either the caller provides a callback to be invoked when the request finishes (successfully or not), or the caller is given a[Future](https://developer.android.com/develop/connectivity/cronet/reference/java/util/concurrent/Future.html)which completes when Cronet finishes processing the request.  

### Nested Class Summary

|-------|---|---|---------------------------------------------------------------------------------------------|
| class | [UrlRequestCallbacks.CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<ResponseBodyT, CallbackT extends[InMemoryTransformCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/InMemoryTransformCronetCallback.html)\<ResponseBodyT\>\> || A named pair-like structure encapsulating Cronet callbacks and associated response futures. |

### Public Method Summary

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| static[ByteArrayCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/ByteArrayCronetCallback.html)                                                                                                                                                                                                     | [forByteArrayBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forByteArrayBody(org.chromium.net.apihelpers.RedirectHandler,%20org.chromium.net.apihelpers.CronetRequestCompletionListener<byte[]>))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<byte\[\]\> listener)      |
| static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<byte\[\],[ByteArrayCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/ByteArrayCronetCallback.html)\> | [forByteArrayBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forByteArrayBody(org.chromium.net.apihelpers.RedirectHandler))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)                                                                                                                                                                                                                                                                          |
| static[JsonCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/JsonCronetCallback.html)                                                                                                                                                                                                               | [forJsonBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forJsonBody(org.chromium.net.apihelpers.RedirectHandler,%20org.chromium.net.apihelpers.CronetRequestCompletionListener<org.json.JSONObject>))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<JSONObject\> listener) |
| static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<JSONObject,[JsonCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/JsonCronetCallback.html)\>         | [forJsonBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forJsonBody(org.chromium.net.apihelpers.RedirectHandler))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)                                                                                                                                                                                                                                                                                    |
| static[StringCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/StringCronetCallback.html)                                                                                                                                                                                                           | [forStringBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forStringBody(org.chromium.net.apihelpers.RedirectHandler,%20org.chromium.net.apihelpers.CronetRequestCompletionListener<java.lang.String>))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<String\> listener)    |
| static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<String,[StringCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/StringCronetCallback.html)\>         | [forStringBody](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.html#forStringBody(org.chromium.net.apihelpers.RedirectHandler))([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)                                                                                                                                                                                                                                                                                |

### Inherited Method Summary

From class java.lang.Object  

|------------------|---------------------------|
| Object           | clone()                   |
| boolean          | equals(Object arg0)       |
| void             | finalize()                |
| final Class\<?\> | getClass()                |
| int              | hashCode()                |
| final void       | notify()                  |
| final void       | notifyAll()               |
| String           | toString()                |
| final void       | wait(long arg0, int arg1) |
| final void       | wait(long arg0)           |
| final void       | wait()                    |

## Public Methods

#### public static[ByteArrayCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/ByteArrayCronetCallback.html)**forByteArrayBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<byte\[\]\> listener)

<br />

##### Parameters

| redirectHandler |   |
|    listener     |   |
|-----------------|---|

#### public static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<byte\[\],[ByteArrayCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/ByteArrayCronetCallback.html)\>**forByteArrayBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)

<br />

##### Parameters

| redirectHandler |   |
|-----------------|---|

#### public static[JsonCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/JsonCronetCallback.html)**forJsonBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<JSONObject\> listener)

<br />

##### Parameters

| redirectHandler |   |
|    listener     |   |
|-----------------|---|

#### public static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<JSONObject,[JsonCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/JsonCronetCallback.html)\>**forJsonBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)

<br />

##### Parameters

| redirectHandler |   |
|-----------------|---|

#### public static[StringCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/StringCronetCallback.html)**forStringBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler,[CronetRequestCompletionListener](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/CronetRequestCompletionListener.html)\<String\> listener)

<br />

##### Parameters

| redirectHandler |   |
|    listener     |   |
|-----------------|---|

#### public static[CallbackAndResponseFuturePair](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/UrlRequestCallbacks.CallbackAndResponseFuturePair.html)\<String,[StringCronetCallback](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/StringCronetCallback.html)\>**forStringBody**([RedirectHandler](https://developer.android.com/develop/connectivity/cronet/reference/org/chromium/net/apihelpers/RedirectHandler.html)redirectHandler)

<br />

##### Parameters

| redirectHandler |   |
|-----------------|---|