# DataBufferUtils


```
public final class DataBufferUtils
```

<br />

*** ** * ** ***

Utilities for working with `DataBuffer` objects.

## Summary

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/java/util/ArrayList.html<T>` | `<T, E extends https://developers.google.com/android/reference/com/google/android/gms/common/data/Freezable<T>> https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBufferUtils#freezeAndClose(com.google.android.gms.common.data.DataBuffer<E>)(https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<E> buffer)` Utility helper method to freeze a DataBuffer into a list of concrete entities. |
| `static boolean` | `https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBufferUtils#hasData(com.google.android.gms.common.data.DataBuffer<?>)(https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<https://developer.android.com/reference/java/lang/Object.html> buffer)` Utility function to determine whether a data buffer has data or not. |
| `static boolean` | `https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBufferUtils#hasNextPage(com.google.android.gms.common.data.DataBuffer<?>)(https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<https://developer.android.com/reference/java/lang/Object.html> buffer)` Utility function to get the "next page" pagination token from a data buffer. |
| `static boolean` | `https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBufferUtils#hasPrevPage(com.google.android.gms.common.data.DataBuffer<?>)(https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<https://developer.android.com/reference/java/lang/Object.html> buffer)` Utility function to get the "prev page" pagination token from a data buffer. |

## Public methods

### freezeAndClose

```
public static ArrayList<T> <T, E extends Freezable<T>> freezeAndClose(DataBuffer<E> buffer)
```

Utility helper method to freeze a DataBuffer into a list of concrete entities. The DataBuffer provided here must contain elements that implement the `https://developers.google.com/android/reference/com/google/android/gms/common/data/Freezable` interface.

Note that this will close the buffer, so do not attempt to use it afterwards.

Type T is the type of object returned by freezing an element of the DataBuffer. In most cases, this will be the same as `E`.

Type E is the type of object contained by the DataBuffer. Must implement `https://developers.google.com/android/reference/com/google/android/gms/common/data/Freezable`.

| Parameters |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<E> buffer` | `DataBuffer` to freeze contents from. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/ArrayList.html<T>` | ArrayList of objects represented by the buffer. |

### hasData

```
public static boolean hasData(DataBuffer<Object> buffer)
```

Utility function to determine whether a data buffer has data or not.

| Parameters |
|---|---|
| `https://developers.google.com/android/reference/com/google/android/gms/common/data/DataBuffer<https://developer.android.com/reference/java/lang/Object.html> buffer` | The data buffer to check. |

| Returns |
|---|---|
| `boolean` | Whether the data buffer has data or not. |

### hasNextPage

```
public static boolean hasNextPage(DataBuffer<Object> buffer)
```

Utility function to get the "next page" pagination token from a data buffer.

### hasPrevPage

```
public static boolean hasPrevPage(DataBuffer<Object> buffer)
```

Utility function to get the "prev page" pagination token from a data buffer.