Class ParcelUtils
-
- All Implemented Interfaces:
public class ParcelUtils
/~chinese 向 parcel 中写入 byte 类型数据
-
-
Constructor Summary
Constructors Constructor Description ParcelUtils()
-
Method Summary
Modifier and Type Method Description static void
writeToParcel(Parcel out, byte obj)
/~english static void
writeToParcel(Parcel out, String obj)
/~english static void
writeToParcel(Parcel out, Long obj)
/~english static void
writeToParcel(Parcel out, Integer obj)
/~english static void
writeToParcel(Parcel out, Float obj)
/~english static void
writeToParcel(Parcel out, Double obj)
/~english static void
writeToParcel(Parcel out, Map obj)
/~english static void
writeToParcel(Parcel out, Date obj)
/~english static Float
readFloatFromParcel(Parcel in)
/~english static Double
readDoubleFromParcel(Parcel in)
/~english static Date
readDateFromParcel(Parcel in)
/~english static Integer
readIntFromParcel(Parcel in)
/~english static Long
readLongFromParcel(Parcel in)
/~english static String
readFromParcel(Parcel in)
/~english static Map
readMapFromParcel(Parcel in)
/~english 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. -
-
Method Detail
-
writeToParcel
static void writeToParcel(Parcel out, byte obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, String obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Long obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Integer obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Float obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Double obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Map obj)
/~english
-
writeToParcel
static void writeToParcel(Parcel out, Date obj)
/~english
-
readFloatFromParcel
static Float readFloatFromParcel(Parcel in)
/~english
-
readDoubleFromParcel
static Double readDoubleFromParcel(Parcel in)
/~english
-
readDateFromParcel
static Date readDateFromParcel(Parcel in)
/~english
-
readIntFromParcel
static Integer readIntFromParcel(Parcel in)
/~english
-
readLongFromParcel
static Long readLongFromParcel(Parcel in)
/~english
-
readFromParcel
static String readFromParcel(Parcel in)
/~english
-
readMapFromParcel
static Map readMapFromParcel(Parcel in)
/~english
-
readFromParcel
static <T extends Parcelable> T readFromParcel(Parcel in, Class<T> cls)
Read and return a new Parcelable from the parcel.
- Parameters:
in
- Parcelcls
- 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
- Parcelmodel
- 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
- Parcelmodel
- 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
- Parcelcls
- 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
- Parcelcollection
- 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 arraycls
- 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 arraycls
- 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.
-
-
-
-