Class ParcelUtils

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      ParcelUtils()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static void writeToParcel(Parcel out, byte obj) 向 parcel 中写入 byte 类型数据
      static void writeToParcel(Parcel out, String obj) 向 parcel 中写入 String 类型数据
      static void writeToParcel(Parcel out, Long obj) 向 parcel 中写入 Long 类型数据
      static void writeToParcel(Parcel out, Integer obj) 向 parcel 中写入 Integer 类型数据
      static void writeToParcel(Parcel out, Float obj) 向 parcel 中写入 Float 类型数据
      static void writeToParcel(Parcel out, Double obj) 向 parcel 中写入 Double 类型数据
      static void writeToParcel(Parcel out, Map obj) 向 parcel 中写入 Map 类型数据
      static void writeToParcel(Parcel out, Date obj) 向 parcel 中写入 Date 类型数据
      static Float readFloatFromParcel(Parcel in) 从 Parcel 中读取 Float 类型数据
      static Double readDoubleFromParcel(Parcel in) 从 Parcel 中读取 Double 类型数据
      static Date readDateFromParcel(Parcel in) 从 Parcel 中读取 Date 类型数据
      static Integer readIntFromParcel(Parcel in) 从 Parcel 中读取 Integer 类型数据
      static Long readLongFromParcel(Parcel in) 从 Parcel 中读取 Long 类型数据
      static String readFromParcel(Parcel in) 从 Parcel 中读取 String 类型数据
      static Map readMapFromParcel(Parcel in) 从 Parcel 中读取 Map 类型数据
      static <T extends Parcelable> T readFromParcel(Parcel in, Class<T> cls) Read and return a new Parcelable from the parcel.
      static <T extends Parcelable> void writeToParcel(Parcel out, T model) Flatten the name of the class of the Parcelable and its contents into the parcel.
      static <T extends List<out Object>> void writeToParcel(Parcel out, T model) Flatten a List into the parcel at the current dataPosition(), growing dataCapacity() if needed.
      static <T> ArrayList<T> readListFromParcel(Parcel in, Class<T> cls) Read and return a new ArrayList object from the parcel at the current dataPosition().
      static void writeListToParcel(Parcel out, List<out Object> collection) Flatten a List into the parcel at the current dataPosition(), growing dataCapacity() if needed.
      static <T extends Parcelable> T bytesToParcelable(Array<byte> data, Class<T> cls) Read and return a new Parcelable from the parcel.
      static Array<byte> parcelableToByte(Parcelable model) Returns the raw bytes of the parcel.
      static <T extends Parcelable> List<T> bytesToParcelableList(Array<byte> data, Class<T> cls) Read and return a new ArrayList object from the parcel at the current dataPosition().
      static Array<byte> parcelableListToByte(List<out Parcelable> list) Returns the raw bytes of the parcel.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParcelUtils

        ParcelUtils()
    • Method Detail

      • writeToParcel

         static void writeToParcel(Parcel out, byte obj)

        向 parcel 中写入 byte 类型数据

        Parameters:
        out - Parcel
        obj - byte 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, String obj)

        向 parcel 中写入 String 类型数据

        Parameters:
        out - Parcel
        obj - String 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Long obj)

        向 parcel 中写入 Long 类型数据

        Parameters:
        out - Parcel
        obj - Long 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Integer obj)

        向 parcel 中写入 Integer 类型数据

        Parameters:
        out - Parcel
        obj - Integer 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Float obj)

        向 parcel 中写入 Float 类型数据

        Parameters:
        out - Parcel
        obj - Float 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Double obj)

        向 parcel 中写入 Double 类型数据

        Parameters:
        out - Parcel
        obj - Double 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Map obj)

        向 parcel 中写入 Map 类型数据

        Parameters:
        out - Parcel
        obj - Map 类型数据
      • writeToParcel

         static void writeToParcel(Parcel out, Date obj)

        向 parcel 中写入 Date 类型数据

        Parameters:
        out - Parcel
        obj - Date 类型数据
      • readFloatFromParcel

         static Float readFloatFromParcel(Parcel in)

        从 Parcel 中读取 Float 类型数据

        Parameters:
        in - Parcel
        Returns:

        Float 类型数据

      • readDoubleFromParcel

         static Double readDoubleFromParcel(Parcel in)

        从 Parcel 中读取 Double 类型数据

        Parameters:
        in - Parcel
        Returns:

        Double 类型数据

      • readDateFromParcel

         static Date readDateFromParcel(Parcel in)

        从 Parcel 中读取 Date 类型数据

        Parameters:
        in - Parcel
        Returns:

        Date 类型数据

      • readIntFromParcel

         static Integer readIntFromParcel(Parcel in)

        从 Parcel 中读取 Integer 类型数据

        Parameters:
        in - Parcel
        Returns:

        Integer 类型数据

      • readLongFromParcel

         static Long readLongFromParcel(Parcel in)

        从 Parcel 中读取 Long 类型数据

        Parameters:
        in - Parcel
        Returns:

        Long 类型数据

      • readFromParcel

         static String readFromParcel(Parcel in)

        从 Parcel 中读取 String 类型数据

        Parameters:
        in - Parcel
        Returns:

        String 类型数据

      • readMapFromParcel

         static Map readMapFromParcel(Parcel in)

        从 Parcel 中读取 Map 类型数据

        Parameters:
        in - Parcel
        Returns:

        Map 类型数据

      • readFromParcel

         static <T extends Parcelable> T readFromParcel(Parcel in, Class<T> cls)

        Read and return a new Parcelable from the parcel.

        Parameters:
        in - Parcel
        cls - Class
        Returns:

        Returns the newly created Parcelable, or null if a null object has been written.

      • writeToParcel

         static <T extends Parcelable> void writeToParcel(Parcel out, T model)

        Flatten the name of the class of the Parcelable and its contents into the parcel.

        Parameters:
        out - Parcel
        model - java object
      • writeToParcel

         static <T extends List<out Object>> void writeToParcel(Parcel out, T model)

        Flatten a List into the parcel at the current dataPosition(), growing dataCapacity() if needed.

        Parameters:
        out - Parcel
        model - java object
      • readListFromParcel

         static <T> ArrayList<T> readListFromParcel(Parcel in, Class<T> cls)

        Read and return a new ArrayList object from the parcel at the current dataPosition(). Returns null if the previously written list object was null. The given class loader will be used to load any enclosed Parcelables.

        Parameters:
        in - Parcel
        cls - Class
      • writeListToParcel

         static void writeListToParcel(Parcel out, List<out Object> collection)

        Flatten a List into the parcel at the current dataPosition(), growing dataCapacity() if needed.

        Parameters:
        out - Parcel
        collection - List
      • bytesToParcelable

         static <T extends Parcelable> T bytesToParcelable(Array<byte> data, Class<T> cls)

        Read and return a new Parcelable from the parcel.

        Parameters:
        data - byte array
        cls - Class
        Returns:

        Returns the newly created Parcelable, or null if a null object has been written.

      • parcelableToByte

         static Array<byte> parcelableToByte(Parcelable model)

        Returns the raw bytes of the parcel.

        Parameters:
        model - Parcelable
        Returns:

        Returns the raw bytes of the parcel.

      • bytesToParcelableList

         static <T extends Parcelable> List<T> bytesToParcelableList(Array<byte> data, Class<T> cls)

        Read and return a new ArrayList object from the parcel at the current dataPosition(). Returns null if the previously written list object was null. The given class loader will be used to load any enclosed Parcelables.

        Parameters:
        data - byte array
        cls - Class
        Returns:

        a new ArrayList object from the parcel at the current dataPosition().

      • parcelableListToByte

         static Array<byte> parcelableListToByte(List<out Parcelable> list)

        Returns the raw bytes of the parcel.

        Parameters:
        list - Parcelable list
        Returns:

        Returns the raw bytes of the parcel.