public final class

ParcelCompat

extends java.lang.Object

 java.lang.Object

↳androidx.core.os.ParcelCompat

Gradle dependencies

compile group: 'androidx.core', name: 'core', version: '1.15.0-alpha02'

  • groupId: androidx.core
  • artifactId: core
  • version: 1.15.0-alpha02

Artifact androidx.core:core:1.15.0-alpha02 it located at Google repository (https://maven.google.com/)

Androidx artifact mapping:

androidx.core:core com.android.support:support-compat

Androidx class mapping:

androidx.core.os.ParcelCompat android.support.v4.os.ParcelCompat

Overview

Helper for accessing features in .

Summary

Methods
public static java.lang.ObjectreadArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static java.util.ArrayList<java.lang.Object>readArrayList(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static booleanreadBoolean(Parcel in)

Read a boolean value from the parcel at the current .

public static java.util.HashMap<java.lang.Object, java.lang.Object>readHashMap(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazzKey, java.lang.Class<java.lang.Object> clazzValue)

Same as but accepts clazzKey and clazzValue parameter as the types required for each key and value pair.

public static voidreadList(Parcel in, java.util.List<java.lang.Object> outVal, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static voidreadMap(Parcel in, java.util.Map<java.lang.Object, java.lang.Object> outVal, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazzKey, java.lang.Class<java.lang.Object> clazzValue)

Same as but accepts clazzKey and clazzValue parameter as the types required for each key and value pair.

public static ParcelablereadParcelable(Parcel in, java.lang.ClassLoader loader, java.lang.Class<Parcelable> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static java.lang.ObjectreadParcelableArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static ParcelablereadParcelableArrayTyped(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static <any>readParcelableCreator(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the required type.

public static java.util.List<java.lang.Object>readParcelableList(Parcel in, java.util.List<java.lang.Object> list, java.lang.ClassLoader cl, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static java.io.SerializablereadSerializable(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.io.Serializable> clazz)

Same as but accepts loader parameter as the primary classLoader for resolving the Serializable class; and clazz parameter as the required type.

public static <any>readSparseArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item.

public static voidwriteBoolean(Parcel out, boolean value)

Write a boolean value into the parcel at the current f, growing if needed.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public static boolean readBoolean(Parcel in)

Read a boolean value from the parcel at the current .

public static void writeBoolean(Parcel out, boolean value)

Write a boolean value into the parcel at the current f, growing if needed.

public static void readList(Parcel in, java.util.List<java.lang.Object> outVal, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the list elements' types.

public static java.util.ArrayList<java.lang.Object> readArrayList(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the list elements' types.

public static java.lang.Object readArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the array elements' types.

public static <any> readSparseArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the array elements' types.

public static void readMap(Parcel in, java.util.Map<java.lang.Object, java.lang.Object> outVal, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazzKey, java.lang.Class<java.lang.Object> clazzValue)

Same as but accepts clazzKey and clazzValue parameter as the types required for each key and value pair. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the map entries' types.

public static java.util.HashMap<java.lang.Object, java.lang.Object> readHashMap(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazzKey, java.lang.Class<java.lang.Object> clazzValue)

Same as but accepts clazzKey and clazzValue parameter as the types required for each key and value pair. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the map entries' types.

public static Parcelable readParcelable(Parcel in, java.lang.ClassLoader loader, java.lang.Class<Parcelable> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, the object type is checked after deserialization.

public static <any> readParcelableCreator(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the required type. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the creator's type.

public static java.lang.Object readParcelableArray(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Deprecated: This method incurs a performance penalty on SDK 33 and below. Use ParcelCompat.readParcelableArrayTyped(Parcel, ClassLoader, Class) instead.

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the array elements' types.

public static Parcelable readParcelableArrayTyped(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the array elements' types.

public static java.util.List<java.lang.Object> readParcelableList(Parcel in, java.util.List<java.lang.Object> list, java.lang.ClassLoader cl, java.lang.Class<java.lang.Object> clazz)

Same as but accepts clazz parameter as the type required for each item. Compatibility behavior:

  • SDK 34 and later, this method matches platform behavior.
  • SDK 33 and below, this method will not check the list elements' types.

public static java.io.Serializable readSerializable(Parcel in, java.lang.ClassLoader loader, java.lang.Class<java.io.Serializable> clazz)

Same as but accepts loader parameter as the primary classLoader for resolving the Serializable class; and clazz parameter as the required type. Compatibility behavior:

  • SDK 33 and later, this method matches platform behavior.
  • SDK 32 and below, this method will not check the item's type.

Source

/*
 * Copyright 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package androidx.core.os;

import android.annotation.SuppressLint;
import android.os.BadParcelableException;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.SparseArray;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;

import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Helper for accessing features in {@link Parcel}.
 */
public final class ParcelCompat {

    /**
     * Read a boolean value from the parcel at the current {@link Parcel#dataPosition()}.
     */
    public static boolean readBoolean(@NonNull Parcel in) {
        return in.readInt() != 0;
    }

    /**
     * Write a boolean value into the parcel at the current f{@link Parcel#dataPosition()},
     * growing {@link Parcel#dataCapacity()} if needed.
     */
    public static void writeBoolean(@NonNull Parcel out, boolean value) {
        if (Build.VERSION.SDK_INT >= 29) {
            Api29Impl.writeBoolean(out, value);
        } else {
            out.writeInt(value ? 1 : 0);
        }
    }

    /**
     * Same as {@link Parcel#readList(List, ClassLoader)} but accepts {@code clazz} parameter as
     * the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the list elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressWarnings("deprecation")
    public static <T> void readList(@NonNull Parcel in, @NonNull List<? super T> outVal,
            @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            Api33Impl.readList(in, outVal, loader, clazz);
        } else {
            in.readList(outVal, loader);
        }
    }

    /**
     * Same as {@link Parcel#readArrayList(ClassLoader)} but accepts {@code clazz} parameter as
     * the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the list elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressLint({"ConcreteCollection", "NullableCollection"})
    @SuppressWarnings({"deprecation", "unchecked"})
    @Nullable
    public static <T> ArrayList<T> readArrayList(@NonNull Parcel in, @Nullable ClassLoader loader,
            @NonNull Class<? extends T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readArrayList(in, loader, clazz);
        } else {
            return in.readArrayList(loader);
        }
    }

    /**
     * Same as {@link Parcel#readArray(ClassLoader)} but accepts {@code clazz} parameter as
     * the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the array elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressWarnings({"deprecation", "unchecked"})
    @SuppressLint({"ArrayReturn", "NullableCollection"})
    @Nullable
    public static <T> Object[] readArray(@NonNull Parcel in, @Nullable ClassLoader loader,
            @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readArray(in, loader, clazz);
        } else {
            return in.readArray(loader);
        }
    }

    /**
     * Same as {@link Parcel#readSparseArray(ClassLoader)} but accepts {@code clazz} parameter as
     * the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the array elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressWarnings("deprecation")
    @Nullable
    public static <T> SparseArray<T> readSparseArray(@NonNull Parcel in,
            @Nullable ClassLoader loader, @NonNull Class<? extends T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readSparseArray(in, loader, clazz);
        } else {
            return in.readSparseArray(loader);
        }
    }

    /**
     * Same as {@link Parcel#readMap(Map, ClassLoader)} but accepts {@code clazzKey} and
     * {@code clazzValue} parameter as the types required for each key and value pair.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the map entries' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException If the item to be deserialized is not an
     * instance of that class or any of its children class.
     */
    @SuppressWarnings("deprecation")
    public static <K, V> void readMap(@NonNull Parcel in, @NonNull Map<? super K, ? super V> outVal,
            @Nullable ClassLoader loader, @NonNull Class<K> clazzKey,
            @NonNull Class<V> clazzValue) {
        if (Build.VERSION.SDK_INT >= 34) {
            Api33Impl.readMap(in, outVal, loader, clazzKey, clazzValue);
        } else {
            in.readMap(outVal, loader);
        }
    }

    /**
     * Same as {@link Parcel#readHashMap(ClassLoader)} but accepts {@code clazzKey} and
     * {@code clazzValue} parameter as the types required for each key and value pair.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the map entries' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException if the item to be deserialized is not an
     * instance of that class or any of its children class.
     */
    @SuppressLint({"ConcreteCollection", "NullableCollection"})
    @SuppressWarnings({"deprecation", "unchecked"})
    @Nullable
    public static <K, V> HashMap<K, V> readHashMap(@NonNull Parcel in, @Nullable ClassLoader loader,
            @NonNull Class<? extends K> clazzKey, @NonNull Class<? extends V> clazzValue) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readHashMap(in, loader, clazzKey, clazzValue);
        } else {
            return in.readHashMap(loader);
        }
    }

    /**
     * Same as {@link Parcel#readParcelable(ClassLoader)} but accepts {@code clazz} parameter as
     * the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, the object type is checked after deserialization.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressWarnings("deprecation")
    @Nullable
    public static <T extends Parcelable> T readParcelable(@NonNull Parcel in,
            @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readParcelable(in, loader, clazz);
        } else {
            T parcelable = in.readParcelable(loader);
            if (parcelable != null && !clazz.isInstance(parcelable)) {
                throw new BadParcelableException("Parcelable " + parcelable.getClass() + " is not "
                        + "a subclass of required class " + clazz.getName()
                        + " provided in the parameter");
            }
            return parcelable;
        }
    }

    /**
     * Same as {@link Parcel#readParcelableCreator(ClassLoader)} but accepts {@code clazz} parameter
     * as the required type.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the creator's type.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there
     * there was an error trying to read the {@link Parcelable.Creator}.
     */
    @SuppressWarnings({"deprecation", "unchecked"})
    @Nullable
    @RequiresApi(30)
    public static <T> Parcelable.Creator<T> readParcelableCreator(@NonNull Parcel in,
            @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readParcelableCreator(in, loader, clazz);
        } else {
            return (Parcelable.Creator<T>) Api30Impl.readParcelableCreator(in, loader);
        }
    }

    /**
     * Same as {@link Parcel#readParcelableArray(ClassLoader)}  but accepts {@code clazz} parameter
     * as the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the array elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     *
     * @deprecated This method incurs a performance penalty on SDK 33 and below. Use
     * {@link #readParcelableArrayTyped} instead.
     */
    @SuppressWarnings({"deprecation", "unchecked"})
    @SuppressLint({"ArrayReturn", "NullableCollection"})
    @Nullable
    @Deprecated
    public static <T> T[] readParcelableArray(@NonNull Parcel in, @Nullable ClassLoader loader,
            @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readParcelableArray(in, loader, clazz);
        } else {
            // The array type is always Parcelable[]. Cast to clazz[] for compatibility if needed.
            Parcelable[] parcelables = in.readParcelableArray(loader);
            if (clazz.isAssignableFrom(Parcelable.class)) {
                return (T[]) parcelables;
            }

            T[] typedParcelables = (T[]) Array.newInstance(clazz, parcelables.length);
            for (int i = 0; i < parcelables.length; i++) {
                try {
                    typedParcelables[i] = clazz.cast(parcelables[i]);
                } catch (ClassCastException e) {
                    throw new BadParcelableException("Parcelable at index " + i + " is not "
                            + "a subclass of required class " + clazz.getName()
                            + " provided in the parameter");
                }
            }

            return typedParcelables;
        }
    }

    /**
     * Same as {@link Parcel#readParcelableArray(ClassLoader)}  but accepts {@code clazz} parameter
     * as the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the array elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @SuppressWarnings({"deprecation"})
    @SuppressLint({"ArrayReturn", "NullableCollection"})
    @Nullable
    public static <T> Parcelable[] readParcelableArrayTyped(@NonNull Parcel in,
            @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return (Parcelable[]) Api33Impl.readParcelableArray(in, loader, clazz);
        } else {
            return in.readParcelableArray(loader);
        }
    }

    /**
     * Same as {@link Parcel#readParcelableList(List, ClassLoader)} but accepts {@code clazz}
     * parameter as the type required for each item.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 34 and later, this method matches platform behavior.
     *     <li>SDK 33 and below, this method will not check the list elements' types.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children classes or there was
     * an error trying to instantiate an element.
     */
    @NonNull
    @SuppressWarnings({"deprecation", "unchecked"})
    @RequiresApi(api = Build.VERSION_CODES.Q)
    public static <T> List<T> readParcelableList(@NonNull Parcel in, @NonNull List<T> list,
            @Nullable ClassLoader cl, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 34) {
            return Api33Impl.readParcelableList(in, list, cl, clazz);
        } else {
            return Api29Impl.readParcelableList(in, (List) list, cl);
        }
    }

    /**
     * Same as {@link Parcel#readSerializable()} but accepts {@code loader} parameter
     * as the primary classLoader for resolving the Serializable class; and {@code clazz} parameter
     * as the required type.
     *
     * Compatibility behavior:
     * <ul>
     *     <li>SDK 33 and later, this method matches platform behavior.
     *     <li>SDK 32 and below, this method will not check the item's type.
     * </ul>
     *
     * @throws android.os.BadParcelableException Throws BadParcelableException if the item to be
     * deserialized is not an instance of that class or any of its children class or there there
     * was an error deserializing the object.
     */
    @SuppressWarnings({"deprecation", "unchecked"})
    @Nullable
    public static <T extends Serializable> T readSerializable(@NonNull Parcel in,
            @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
        if (Build.VERSION.SDK_INT >= 33) {
            return Api33Impl.readSerializable(in, loader, clazz);
        } else {
            return (T) in.readSerializable();
        }
    }

    private ParcelCompat() {}

    @RequiresApi(29)
    static class Api29Impl {
        private Api29Impl() {
            // This class is non-instantiable.
        }

        static <T extends Parcelable> List<T> readParcelableList(@NonNull Parcel in,
                @NonNull List<T> list, @Nullable ClassLoader cl) {
            return in.readParcelableList(list, cl);
        }

        static void writeBoolean(@NonNull Parcel parcel, boolean val) {
            parcel.writeBoolean(val);
        }
    }

    @RequiresApi(30)
    static class Api30Impl {
        private Api30Impl() {
            // This class is non-instantiable.
        }

        static Parcelable.Creator<?> readParcelableCreator(@NonNull Parcel in,
                @Nullable ClassLoader loader) {
            return in.readParcelableCreator(loader);
        }
    }

    @RequiresApi(33)
    static class Api33Impl {
        private Api33Impl() {
            // This class is non-instantiable.
        }

        static <T extends Serializable> T readSerializable(@NonNull Parcel in,
                @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
            return in.readSerializable(loader, clazz);
        }

        static <T extends Parcelable> T readParcelable(@NonNull Parcel in,
                @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
            return in.readParcelable(loader, clazz);
        }

        static <T> Parcelable.Creator<T> readParcelableCreator(Parcel in, ClassLoader loader,
                Class<T> clazz) {
            return in.readParcelableCreator(loader, clazz);
        }

        static <T> T[] readParcelableArray(@NonNull Parcel in, @Nullable ClassLoader loader,
                @NonNull Class<T> clazz) {
            return in.readParcelableArray(loader, clazz);
        }

        static <T> List<T> readParcelableList(@NonNull Parcel in, @NonNull List<T> list,
                @Nullable ClassLoader cl, @NonNull Class<T> clazz) {
            return in.readParcelableList(list, cl, clazz);
        }

        static <T> void readList(@NonNull Parcel in, @NonNull List<? super T> outVal,
                @Nullable ClassLoader loader, @NonNull Class<T> clazz) {
            in.readList(outVal, loader, clazz);
        }

        static <T> ArrayList<T> readArrayList(Parcel in, ClassLoader loader,
                Class<? extends T> clazz) {
            return in.readArrayList(loader, clazz);
        }

        static <T> T[] readArray(Parcel in, ClassLoader loader, Class<T> clazz) {
            return in.readArray(loader, clazz);
        }

        static <T> SparseArray<T> readSparseArray(Parcel in, ClassLoader loader,
                Class<? extends T> clazz) {
            return in.readSparseArray(loader, clazz);
        }

        static <K, V> void readMap(Parcel in, Map<? super K, ? super V> outVal,
                ClassLoader loader, Class<K> clazzKey, Class<V> clazzValue) {
            in.readMap(outVal, loader, clazzKey, clazzValue);
        }

        static <V, K> HashMap<K, V> readHashMap(Parcel in, ClassLoader loader,
                Class<? extends K> clazzKey, Class<? extends V> clazzValue) {
            return in.readHashMap(loader, clazzKey, clazzValue);
        }
    }
}