Data
class Data
kotlin.Any | |
↳ | androidx.work.Data |
A persistable set of key/value pairs which are used as inputs and outputs for ListenableWorker
s. Keys are Strings, and values can be Strings, primitive types, or their array variants.
This is a lightweight container, and should not be considered your data store. As such, there is an enforced MAX_DATA_BYTES
limit on the serialized (byte array) size of the payloads. This class will throw IllegalStateException
s if you try to serialize or deserialize past this limit.
Summary
Nested classes | |
---|---|
A builder for |
Constants | |
---|---|
static Int |
The maximum number of bytes for Data when it is serialized (converted to a byte array). |
Public constructors | |
---|---|
Public methods | |
---|---|
Boolean | |
static Data |
fromByteArray(@NonNull bytes: ByteArray) Converts a byte array to |
Boolean |
getBoolean(@NonNull key: String, defaultValue: Boolean) Gets the boolean value for the given key. |
BooleanArray? |
getBooleanArray(@NonNull key: String) Gets the boolean array value for the given key. |
Byte |
Gets the byte value for the given key. |
ByteArray? |
getByteArray(@NonNull key: String) Gets the byte array value for the given key. |
Double |
Gets the double value for the given key. |
DoubleArray? |
getDoubleArray(@NonNull key: String) Gets the double array value for the given key. |
Float |
Gets the float value for the given key. |
FloatArray? |
getFloatArray(@NonNull key: String) Gets the float array value for the given key. |
Int |
Gets the integer value for the given key. |
IntArray? |
getIntArray(@NonNull key: String) Gets the integer array value for the given key. |
MutableMap<String!, Any!> |
Gets all the values in this Data object. |
Long |
Gets the long value for the given key. |
LongArray? |
getLongArray(@NonNull key: String) Gets the long array value for the given key. |
String? |
Gets the String value for the given key. |
Array<String!>? |
getStringArray(@NonNull key: String) Gets the String array value for the given key. |
Boolean |
hasKeyWithValueOfType(@NonNull key: String, @NonNull klass: Class<T>) Returns |
Int |
hashCode() |
ByteArray |
Converts this Data to a byte array suitable for sending to other processes in your application. |
String |
toString() |
Extension functions | ||
---|---|---|
From androidx.work
|
Properties | |
---|---|
static Data! |
An empty Data object with no elements. |
Constants
MAX_DATA_BYTES
static val MAX_DATA_BYTES: Int
The maximum number of bytes for Data when it is serialized (converted to a byte array). Please see the class-level Javadoc for more information.
Value: 10 * 1024
Public constructors
<init>
Data(@NonNull other: Data)