DataBufferUtils

Kotlin|Java

public final classDataBufferUtils


Utilities for working withDataBuffer objects.

Summary

Public methods

staticArrayList<T>
<T, E extends Freezable<T>>freezeAndClose(DataBuffer<E> buffer)

Utility helper method to freeze a DataBuffer into a list of concrete entities.

static boolean

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

static boolean

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

static boolean

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 theFreezable 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 asE.

Type E is the type of object contained by the DataBuffer. Must implementFreezable.

Parameters
DataBuffer<E> buffer

DataBuffer to freeze contents from.

Returns
ArrayList<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
DataBuffer<Object> 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.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.