Package com.tomtom.ivi.platform.framework.api.common.parcelable

This package contains utilities to serialize various types to Android's Parcel type.

Types

Link copied to clipboard
class MarshalledTraceEvent : Parcelable

A marshalled ParcelableTraceEvent.

Link copied to clipboard
data class ParcelableBooleanList(val value: List<Boolean>) : Parcelable

Optimized parcelable wrapper for a list of booleans, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableDoubleList(val value: List<Double>) : Parcelable

Optimized parcelable wrapper for a list of doubles, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableEnum(className: String, ordinal: Int) : Parcelable

A Parcelable wrapper for enums, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableException : Parcelable

A parcelable variant of an Exception.

Link copied to clipboard
data class ParcelableFloatList(val value: List<Float>) : Parcelable

Optimized parcelable wrapper for a list of floats, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableIntList(val value: List<Int>) : Parcelable

Optimized parcelable wrapper for a list of integers, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableLongList(val value: List<Long>) : Parcelable

Optimized parcelable wrapper for a list of longs, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableStringList(val value: List<String>) : Parcelable

Optimized parcelable wrapper for a list of strings, suitable for Binder transactions.

Link copied to clipboard
data class ParcelableTraceEvent(val traceEvent: TraceEvent, val allArgumentsSupported: Boolean) : Parcelable

Parcelable TraceEvent.

Functions

Link copied to clipboard
inline fun <T : Enum<T>> Parcel.createEnumSetOptimized(elementReader: (Parcel) -> T): EnumSet<T>?

Creates and reads an EnumSet set with element type T from a Parcel, by invoking elementReader on each element of the EnumSet.

Link copied to clipboard
inline fun <T> Parcel.createListOptimized(elementReader: (Parcel) -> T): List<T>?

Creates and reads a list of elements of type T from a Parcel, by invoking elementReader on each element in the List.

Link copied to clipboard
inline fun <K, V> Parcel.createMapOptimized(entryReader: (Parcel) -> Pair<K, V>): Map<K, V>?

Creates and reads a map with key type K and value type V from a Parcel using entryReader.

Link copied to clipboard
inline fun <T> Parcel.createSetOptimized(elementReader: (Parcel) -> T): Set<T>?

Creates and reads a set with element type T from a Parcel, by invoking elementReader on each element in the Set.

Link copied to clipboard
inline fun <T> Parcel.createSparseArrayOptimized(elementReader: (Parcel) -> T): SparseArray<T>?

Same as Parcel.createListOptimized except for a SparseArray.

Link copied to clipboard
fun Parcel.readBooleanWrapper(): Boolean

Reads a Boolean from a Parcel. Same as Parcel.readBoolean, except this function also works on Android 8.1.

Link copied to clipboard
fun Parcel.readNullableInt(): Int?

Reads a nullable Int from the Parcel receiver.

Link copied to clipboard
fun <T : Parcelable, V : Parcelable> Parcel.readParcelableCustom(loader: ClassLoader?, kClass: KClass<V>): T?

Overload of Parcel.readParcelable to read Parcel objects, while allowing type flexibility.

fun <T : VersionedParcelable, V : VersionedParcelable> Parcel.readParcelableCustom(loader: ClassLoader?, kClass: KClass<V>): T?

Overload of Parcel.readParcelable to read VersionedParcelable objects, while allowing type flexibility.

Link copied to clipboard
fun TraceEvent.toMarshalled(): MarshalledTraceEvent

Converts this TraceEvent to a MarshalledTraceEvent.

Link copied to clipboard
fun TraceEvent.toParcelable(): ParcelableTraceEvent

Converts this TraceEvent to a ParcelableTraceEvent.

fun Exception.toParcelable(): ParcelableException

Converts this Exception to a ParcelableException.

Link copied to clipboard
fun Parcel.writeBooleanWrapper(value: Boolean)

Writes a Boolean to a Parcel. Same as Parcel.writeBoolean, except this function also works on Android 8.1.

Link copied to clipboard
inline fun <T> Parcel.writeCollectionOptimized(collection: Collection<T>?, elementWriter: (Parcel, T) -> Unit)

Optimized way to write a collection of T objects to a Parcel.

Link copied to clipboard
inline fun <K, V> Parcel.writeMapOptimized(map: Map<K, V>?, entryWriter: (Parcel, Map.Entry<K, V>) -> Unit)

Optimized and more feature rich way to write a map of K key-V value pairs to a Parcel.

Link copied to clipboard
fun Parcel.writeNullableInt(value: Int?)

Writes a nullable Int to the Parcel receiver.

Link copied to clipboard
fun Parcel.writeParcelableCustom(parcelable: Parcelable?, parcelableFlags: Int)

Overload of Parcel.readParcelable to read Parcel objects, while allowing type flexibility.

fun Parcel.writeParcelableCustom(versionedParcelable: VersionedParcelable?, parcelableFlags: Int): Boolean

Overload of Parcel.readParcelable to read VersionedParcelable objects, while allowing type flexibility.

Link copied to clipboard
inline fun <T> Parcel.writeSparseArrayOptimized(sparseArray: SparseArray<T>?, elementWriter: (Parcel, T) -> Unit)

Same as Parcel.writeCollectionOptimized except for a SparseArray.

Link copied to clipboard
fun Parcel.writeUnsafeArray(array: Array<Any?>?): Boolean

Writes array to the Parcel, like Parcel.writeArray. Except this function will not throw a RuntimeException when the array contains an element that is not supported by Parcel.writeValue.