|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.os.Parcel
public final class Parcel
Container for a message (data and object references) that can
be sent through an IBinder. A Parcel can contain both flattened data
that will be unflattened on the other side of the IPC (using the various
methods here for writing specific types, or the general
Parcelable interface), and references to live IBinder
objects that will result in the other side receiving a proxy IBinder
connected with the original IBinder in the Parcel.
Parcel is not a general-purpose
serialization mechanism. This class (and the corresponding
Parcelable API for placing arbitrary objects into a Parcel) is
designed as a high-performance IPC transport. As such, it is not
appropriate to place any Parcel data in to persistent storage: changes
in the underlying implementation of any of the data in the Parcel can
render older data unreadable.
The bulk of the Parcel API revolves around reading and writing data of various types. There are six major classes of such functions available.
The most basic data functions are for writing and reading primitive
data types: writeByte(byte), readByte(), writeDouble(double),
readDouble(), writeFloat(float), readFloat(), writeInt(int),
readInt(), writeLong(long), readLong(),
writeString(java.lang.String), readString(). Most other
data operations are built on top of these. The given data is written and
read using the endianess of the host CPU.
There are a variety of methods for reading and writing raw arrays of primitive objects, which generally result in writing a 4-byte length followed by the primitive data items. The methods for reading can either read the data into an existing array, or create and return a new array. These available types are:
writeBooleanArray(boolean[]),
readBooleanArray(boolean[]), createBooleanArray()
writeByteArray(byte[]),
writeByteArray(byte[], int, int), readByteArray(byte[]),
createByteArray()
writeCharArray(char[]), readCharArray(char[]),
createCharArray()
writeDoubleArray(double[]), readDoubleArray(double[]),
createDoubleArray()
writeFloatArray(float[]), readFloatArray(float[]),
createFloatArray()
writeIntArray(int[]), readIntArray(int[]),
createIntArray()
writeLongArray(long[]), readLongArray(long[]),
createLongArray()
writeStringArray(String[]), readStringArray(String[]),
createStringArray().
writeSparseBooleanArray(SparseBooleanArray),
readSparseBooleanArray().
The Parcelable protocol provides an extremely efficient (but
low-level) protocol for objects to write and read themselves from Parcels.
You can use the direct methods writeParcelable(Parcelable, int)
and readParcelable(ClassLoader) or
writeParcelableArray(T[], int) and
readParcelableArray(ClassLoader) to write or read. These
methods write both the class type and its data to the Parcel, allowing
that class to be reconstructed from the appropriate class loader when
later reading.
There are also some methods that provide a more efficient way to work
with Parcelables: writeTypedArray(T[], int),
writeTypedList(List),
readTypedArray(T[], android.os.Parcelable.Creator and readTypedList(java.util.List. These methods
do not write the class information of the original object: instead, the
caller of the read function must know what type to expect and pass in the
appropriate Parcelable.Creator instead to
properly construct the new object and read its data. (To more efficient
write and read a single Parceable object, you can directly call
Parcelable.writeToParcel and
Parcelable.Creator.createFromParcel
yourself.)
A special type-safe container, called Bundle, is available
for key/value maps of heterogeneous values. This has many optimizations
for improved performance when reading and writing data, and its type-safe
API avoids difficult to debug type errors when finally marshalling the
data contents into a Parcel. The methods to use are
writeBundle(Bundle), readBundle(), and
readBundle(ClassLoader).
An unusual feature of Parcel is the ability to read and write active objects. For these objects the actual contents of the object is not written, rather a special token referencing the object is written. When reading the object back from the Parcel, you do not get a new instance of the object, but rather a handle that operates on the exact same object that was originally written. There are two forms of active objects available.
Binder objects are a core facility of Android's general cross-process
communication system. The IBinder interface describes an abstract
protocol with a Binder object. Any such interface can be written in to
a Parcel, and upon reading you will receive either the original object
implementing that interface or a special proxy implementation
that communicates calls back to the original object. The methods to use are
writeStrongBinder(IBinder),
writeStrongInterface(IInterface), readStrongBinder(),
writeBinderArray(IBinder[]), readBinderArray(IBinder[]),
createBinderArray(),
writeBinderList(List), readBinderList(List),
createBinderArrayList().
FileDescriptor objects, representing raw Linux file descriptor identifiers,
can be written and ParcelFileDescriptor objects returned to operate
on the original file descriptor. The returned file descriptor is a dup
of the original file descriptor: the object and fd is different, but
operating on the same underlying file stream, with the same position, etc.
The methods to use are writeFileDescriptor(FileDescriptor),
readFileDescriptor().
A final class of methods are for writing and reading standard Java
containers of arbitrary types. These all revolve around the
writeValue(Object) and readValue(ClassLoader) methods
which define the types of objects allowed. The container methods are
writeArray(Object[]), readArray(ClassLoader),
writeList(List), readList(List, ClassLoader),
readArrayList(ClassLoader),
writeMap(Map), readMap(Map, ClassLoader),
writeSparseArray(SparseArray),
readSparseArray(ClassLoader).
| Field Summary | |
|---|---|
static Parcelable.Creator<String> |
STRING_CREATOR
|
| Method Summary | ||
|---|---|---|
void |
appendFrom(Parcel parcel,
int offset,
int length)
|
|
(package private) static void |
closeFileDescriptor(FileDescriptor desc)
|
|
IBinder[] |
createBinderArray()
|
|
ArrayList<IBinder> |
createBinderArrayList()
Read and return a new ArrayList containing IBinder objects from the parcel that was written with writeBinderList(java.util.List at the
current dataPosition(). |
|
boolean[] |
createBooleanArray()
|
|
byte[] |
createByteArray()
Read and return a byte[] object from the parcel. |
|
char[] |
createCharArray()
|
|
double[] |
createDoubleArray()
|
|
float[] |
createFloatArray()
|
|
int[] |
createIntArray()
|
|
long[] |
createLongArray()
|
|
String[] |
createStringArray()
|
|
ArrayList<String> |
createStringArrayList()
Read and return a new ArrayList containing String objects from the parcel that was written with writeStringList(java.util.List at the
current dataPosition(). |
|
|
createTypedArray(Parcelable.Creator<T> c)
Read and return a new array containing a particular object type from the parcel at the current dataPosition(). |
|
|
createTypedArrayList(Parcelable.Creator<T> c)
Read and return a new ArrayList containing a particular object type from the parcel that was written with writeTypedList(java.util.List at the
current dataPosition(). |
|
int |
dataAvail()
Returns the amount of data remaining to be read from the parcel. |
|
int |
dataCapacity()
Returns the total amount of space in the parcel. |
|
int |
dataPosition()
Returns the current position in the parcel data. |
|
int |
dataSize()
Returns the total amount of data contained in the parcel. |
|
void |
enforceInterface(String interfaceName)
|
|
protected void |
finalize()
Is called before the object's memory is being reclaimed by the VM. |
|
boolean |
hasFileDescriptors()
Report whether the parcel contains any marshalled file descriptors. |
|
byte[] |
marshall()
Returns the raw bytes of the parcel. |
|
static Parcel |
obtain()
Retrieve a new Parcel object from the pool. |
|
protected static Parcel |
obtain(int obj)
|
|
(package private) static FileDescriptor |
openFileDescriptor(String file,
int mode)
|
|
Object[] |
readArray(ClassLoader loader)
Read and return a new Object array from the parcel at the current dataPosition(). |
|
ArrayList |
readArrayList(ClassLoader loader)
Read and return a new ArrayList object from the parcel at the current dataPosition(). |
|
void |
readBinderArray(IBinder[] val)
|
|
void |
readBinderList(List<IBinder> list)
Read into the given List items IBinder objects that were written with writeBinderList(java.util.List at the current dataPosition(). |
|
void |
readBooleanArray(boolean[] val)
|
|
Bundle |
readBundle()
Read and return a new Bundle object from the parcel at the current dataPosition(). |
|
Bundle |
readBundle(ClassLoader loader)
Read and return a new Bundle object from the parcel at the current dataPosition(), using the given class loader to initialize the class loader of the Bundle for later retrieval of Parcelable objects. |
|
(package private) Bundle |
readBundleUnpacked(ClassLoader loader)
Read and return a new Bundle object from the parcel at the current dataPosition(). |
|
byte |
readByte()
Read a byte value from the parcel at the current dataPosition(). |
|
void |
readByteArray(byte[] val)
Read a byte[] object from the parcel and copy it into the given byte array. |
|
void |
readCharArray(char[] val)
|
|
double |
readDouble()
Read a double precision floating point value from the parcel at the current dataPosition(). |
|
void |
readDoubleArray(double[] val)
|
|
void |
readException()
Special function for reading an exception result from the header of a parcel, to be used after receiving the result of a transaction. |
|
void |
readException(int code,
String msg)
Use this function for customized exception handling. |
|
ParcelFileDescriptor |
readFileDescriptor()
Read a FileDescriptor from the parcel at the current dataPosition(). |
|
float |
readFloat()
Read a floating point value from the parcel at the current dataPosition(). |
|
void |
readFloatArray(float[] val)
|
|
HashMap |
readHashMap(ClassLoader loader)
Please use readBundle(ClassLoader) instead (whose data must have
been written with writeBundle(android.os.Bundle). |
|
int |
readInt()
Read an integer value from the parcel at the current dataPosition(). |
|
void |
readIntArray(int[] val)
|
|
void |
readList(List outVal,
ClassLoader loader)
Read into an existing List object from the parcel at the current dataPosition(), using the given class loader to load any enclosed Parcelables. |
|
long |
readLong()
Read a long integer value from the parcel at the current dataPosition(). |
|
void |
readLongArray(long[] val)
|
|
void |
readMap(Map outVal,
ClassLoader loader)
Please use readBundle(ClassLoader) instead (whose data must have
been written with writeBundle(android.os.Bundle). |
|
|
readParcelable(ClassLoader loader)
Read and return a new Parcelable from the parcel. |
|
Parcelable[] |
readParcelableArray(ClassLoader loader)
Read and return a new Parcelable array from the parcel. |
|
Serializable |
readSerializable()
Read and return a new Serializable object from the parcel. |
|
SparseArray |
readSparseArray(ClassLoader loader)
Read and return a new SparseArray object from the parcel at the current dataPosition(). |
|
SparseBooleanArray |
readSparseBooleanArray()
Read and return a new SparseBooleanArray object from the parcel at the current dataPosition(). |
|
String |
readString()
Read a string value from the parcel at the current dataPosition(). |
|
String[] |
readStringArray()
Read and return a String[] object from the parcel. |
|
void |
readStringArray(String[] val)
|
|
void |
readStringList(List<String> list)
Read into the given List items String objects that were written with writeStringList(java.util.List at the current dataPosition(). |
|
IBinder |
readStrongBinder()
Read an object from the parcel at the current dataPosition(). |
|
|
readTypedArray(Parcelable.Creator<T> c)
Deprecated. |
|
|
readTypedArray(T[] val,
Parcelable.Creator<T> c)
|
|
|
readTypedList(List<T> list,
Parcelable.Creator<T> c)
Read into the given List items containing a particular object type that were written with writeTypedList(java.util.List at the
current dataPosition(). |
|
Object |
readValue(ClassLoader loader)
Read a typed object from a parcel. |
|
void |
recycle()
Put a Parcel object back into the pool. |
|
void |
setDataCapacity(int size)
Change the capacity (current available space) of the parcel. |
|
void |
setDataPosition(int pos)
Move the current read/write position in the parcel. |
|
void |
setDataSize(int size)
Change the amount of data in the parcel. |
|
void |
unmarshall(byte[] data,
int offest,
int length)
Set the bytes in data to be the raw bytes of this Parcel. |
|
void |
writeArray(Object[] val)
Flatten an Object array into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeBinderArray(IBinder[] val)
|
|
void |
writeBinderList(List<IBinder> val)
Flatten a List containing IBinder objects into the parcel, at the current dataPosition() and growing dataCapacity() if needed. |
|
void |
writeBooleanArray(boolean[] val)
|
|
void |
writeBundle(Bundle val)
Flatten a Bundle into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeByte(byte val)
Write an byte value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeByteArray(byte[] b)
Write a byte array into the parcel at the current {#link #dataPosition}, growing dataCapacity() if needed. |
|
void |
writeByteArray(byte[] b,
int offset,
int len)
Write an byte array into the parcel at the current {#link #dataPosition}, growing dataCapacity() if needed. |
|
void |
writeCharArray(char[] val)
|
|
void |
writeDouble(double val)
Write a double precision floating point value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeDoubleArray(double[] val)
|
|
void |
writeException(Exception e)
Special function for writing an exception result at the header of a parcel, to be used when returning an exception from a transaction. |
|
void |
writeFileDescriptor(FileDescriptor val)
Write a FileDescriptor into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeFloat(float val)
Write a floating point value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeFloatArray(float[] val)
|
|
void |
writeInt(int val)
Write an integer value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeIntArray(int[] val)
|
|
void |
writeInterfaceToken(String interfaceName)
Store or read an IBinder interface token in the parcel at the current dataPosition(). |
|
void |
writeList(List val)
Flatten a List into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeLong(long val)
Write a long integer value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeLongArray(long[] val)
|
|
void |
writeMap(Map val)
Please use writeBundle(android.os.Bundle) instead. |
|
void |
writeNoException()
Special function for writing information at the front of the Parcel indicating that no exception occurred. |
|
void |
writeParcelable(Parcelable p,
int parcelableFlags)
Flatten the name of the class of the Parcelable and its contents into the parcel. |
|
|
writeParcelableArray(T[] value,
int parcelableFlags)
Write a heterogeneous array of Parcelable objects into the Parcel. |
|
void |
writeSerializable(Serializable s)
Write a generic serializable object in to a Parcel. |
|
void |
writeSparseArray(SparseArray<Object> val)
Flatten a generic SparseArray into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeSparseBooleanArray(SparseBooleanArray val)
|
|
void |
writeString(String val)
Write a string value into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeStringArray(String[] val)
|
|
void |
writeStringList(List<String> val)
Flatten a List containing String objects into the parcel, at the current dataPosition() and growing dataCapacity() if needed. |
|
void |
writeStrongBinder(IBinder val)
Write an object into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
void |
writeStrongInterface(IInterface val)
Write an object into the parcel at the current dataPosition(), growing dataCapacity() if needed. |
|
|
writeTypedArray(T[] val,
int parcelableFlags)
Flatten a heterogeneous array containing a particular object type into the parcel, at the current dataPosition() and growing dataCapacity() if needed. |
|
|
writeTypedList(List<T> val)
Flatten a List containing a particular object type into the parcel, at the current dataPosition() and growing dataCapacity() if needed. |
|
void |
writeValue(Object v)
Flatten a generic object in to a parcel. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Parcelable.Creator<String> STRING_CREATOR
| Method Detail |
|---|
public static Parcel obtain()
public final void recycle()
public final int dataSize()
public final int dataAvail()
dataSize()-dataPosition().
public final int dataPosition()
dataSize().
public final int dataCapacity()
dataSize(). The difference between it and dataSize() is the
amount of room left until the parcel needs to re-allocate its
data buffer.
public final void setDataSize(int size)
size - The new number of bytes in the Parcel.public final void setDataPosition(int pos)
pos - New offset in the parcel; must be between 0 and
dataSize().public final void setDataCapacity(int size)
size - The new capacity of the parcel, in bytes. Can not be
less than dataSize() -- that is, you can not drop existing data
with this method.public final byte[] marshall()
The data you retrieve here must not be placed in any kind of persistent storage (on local disk, across a network, etc). For that, you should use standard serialization or another kind of general serialization mechanism. The Parcel marshalled representation is highly optimized for local IPC, and as such does not attempt to maintain compatibility with data created in different versions of the platform.
public final void unmarshall(byte[] data,
int offest,
int length)
public final void appendFrom(Parcel parcel,
int offset,
int length)
public final boolean hasFileDescriptors()
public final void writeInterfaceToken(String interfaceName)
dataPosition(). This is used to validate that the marshalled
transaction is intended for the target interface.
public final void enforceInterface(String interfaceName)
public final void writeByteArray(byte[] b)
dataCapacity() if needed.
b - Bytes to place into the parcel.
public final void writeByteArray(byte[] b,
int offset,
int len)
dataCapacity() if needed.
b - Bytes to place into the parcel.offset - Index of first byte to be written.len - Number of bytes to write.public final void writeInt(int val)
public final void writeLong(long val)
public final void writeFloat(float val)
public final void writeDouble(double val)
public final void writeString(String val)
public final void writeStrongBinder(IBinder val)
public final void writeStrongInterface(IInterface val)
public final void writeFileDescriptor(FileDescriptor val)
public final void writeByte(byte val)
public final void writeMap(Map val)
writeBundle(android.os.Bundle) instead. Flattens a Map into the parcel
at the current dataPosition(),
growing dataCapacity() if needed. The Map keys must be String objects.
The Map values are written using writeValue(java.lang.Object) and must follow
the specification there.
It is strongly recommended to use writeBundle(android.os.Bundle) instead of
this method, since the Bundle class provides a type-safe API that
allows you to avoid mysterious type errors at the point of marshalling.
public final void writeBundle(Bundle val)
public final void writeList(List val)
writeValue(java.lang.Object) and must follow the specification there.
public final void writeArray(Object[] val)
writeValue(java.lang.Object) and must follow the specification there.
public final void writeSparseArray(SparseArray<Object> val)
writeValue(java.lang.Object) and must follow the
specification there.
public final void writeSparseBooleanArray(SparseBooleanArray val)
public final void writeBooleanArray(boolean[] val)
public final boolean[] createBooleanArray()
public final void readBooleanArray(boolean[] val)
public final void writeCharArray(char[] val)
public final char[] createCharArray()
public final void readCharArray(char[] val)
public final void writeIntArray(int[] val)
public final int[] createIntArray()
public final void readIntArray(int[] val)
public final void writeLongArray(long[] val)
public final long[] createLongArray()
public final void readLongArray(long[] val)
public final void writeFloatArray(float[] val)
public final float[] createFloatArray()
public final void readFloatArray(float[] val)
public final void writeDoubleArray(double[] val)
public final double[] createDoubleArray()
public final void readDoubleArray(double[] val)
public final void writeStringArray(String[] val)
public final String[] createStringArray()
public final void readStringArray(String[] val)
public final void writeBinderArray(IBinder[] val)
public final IBinder[] createBinderArray()
public final void readBinderArray(IBinder[] val)
public final <T extends Parcelable> void writeTypedList(List<T> val)
val - The list of objects to be written.createTypedArrayList(android.os.Parcelable.Creator) ,
readTypedList(java.util.List, android.os.Parcelable.Creator) ,
Parcelablepublic final void writeStringList(List<String> val)
createStringArrayList() or
readStringList(java.util.List) .
val - The list of strings to be written.createStringArrayList(),
readStringList(java.util.List) public final void writeBinderList(List<IBinder> val)
createBinderArrayList() or
readBinderList(java.util.List) .
val - The list of strings to be written.createBinderArrayList(),
readBinderList(java.util.List)
public final <T extends Parcelable> void writeTypedArray(T[] val,
int parcelableFlags)
writeParcelableArray(T[], int) method, however, only the
raw data of the objects is written and not their type, so you must use
readTypedArray(T[], android.os.Parcelable.Creator) with the correct corresponding
Parcelable.Creator implementation to unmarshall them.
val - The array of objects to be written.parcelableFlags - Contextual flags as per
Parcelable.writeToParcel().readTypedArray(T[], android.os.Parcelable.Creator) ,
writeParcelableArray(T[], int),
Parcelable.Creatorpublic final void writeValue(Object v)
Bundle
writeMap(java.util.Map)).
Parcelable protocol.
TextUtils.writeToParcel(java.lang.CharSequence, android.os.Parcel, int)).
writeList(java.util.List)).
SparseArray (as supported by writeSparseArray(android.util.SparseArray) ).
IBinder
writeSerializable(java.io.Serializable) for caveats). Note that all of the
previous types have relatively efficient implementations for
writing to a Parcel; having to rely on the generic serialization
approach is much less efficient and should be avoided whenever
possible.
public final void writeParcelable(Parcelable p,
int parcelableFlags)
p - The Parcelable object to be written.parcelableFlags - Contextual flags as per
Parcelable.writeToParcel().public final void writeSerializable(Serializable s)
public final void writeException(Exception e)
The supported exception types are:
BadParcelableException
IllegalArgumentException
IllegalStateException
NullPointerException
SecurityException
e - The Exception to be written.writeNoException(),
readException()public final void writeNoException()
writeException(java.lang.Exception),
readException()public final void readException()
writeException(java.lang.Exception),
writeNoException()
public final void readException(int code,
String msg)
code - exception codemsg - exception messagepublic final int readInt()
public final long readLong()
public final float readFloat()
public final double readDouble()
public final String readString()
public final IBinder readStrongBinder()
public final ParcelFileDescriptor readFileDescriptor()
static FileDescriptor openFileDescriptor(String file,
int mode)
throws FileNotFoundException
FileNotFoundException
static void closeFileDescriptor(FileDescriptor desc)
throws IOException
IOExceptionpublic final byte readByte()
public final void readMap(Map outVal,
ClassLoader loader)
readBundle(ClassLoader) instead (whose data must have
been written with writeBundle(android.os.Bundle). Read into an existing Map object
from the parcel at the current dataPosition().
public final void readList(List outVal,
ClassLoader loader)
public final HashMap readHashMap(ClassLoader loader)
readBundle(ClassLoader) instead (whose data must have
been written with writeBundle(android.os.Bundle). Read and return a new HashMap
object from the parcel at the current dataPosition(), using the given
class loader to load any enclosed Parcelables. Returns null if
the previously written map object was null.
public final Bundle readBundle()
public final Bundle readBundle(ClassLoader loader)
Bundle readBundleUnpacked(ClassLoader loader)
public final byte[] createByteArray()
public final void readByteArray(byte[] val)
public final String[] readStringArray()
public final ArrayList readArrayList(ClassLoader loader)
public final Object[] readArray(ClassLoader loader)
public final SparseArray readSparseArray(ClassLoader loader)
public final SparseBooleanArray readSparseBooleanArray()
public final <T> ArrayList<T> createTypedArrayList(Parcelable.Creator<T> c)
writeTypedList(java.util.List) at the
current dataPosition(). Returns null if the
previously written list object was null. The list must have
previously been written via writeTypedList(java.util.List) with the same object
type.
writeTypedList(java.util.List)
public final <T> void readTypedList(List<T> list,
Parcelable.Creator<T> c)
writeTypedList(java.util.List) at the
current dataPosition(). The list must have
previously been written via writeTypedList(java.util.List) with the same object
type.
writeTypedList(java.util.List) public final ArrayList<String> createStringArrayList()
writeStringList(java.util.List) at the
current dataPosition(). Returns null if the
previously written list object was null.
writeStringList(java.util.List) public final ArrayList<IBinder> createBinderArrayList()
writeBinderList(java.util.List) at the
current dataPosition(). Returns null if the
previously written list object was null.
writeBinderList(java.util.List) public final void readStringList(List<String> list)
writeStringList(java.util.List) at the current dataPosition().
writeStringList(java.util.List) public final void readBinderList(List<IBinder> list)
writeBinderList(java.util.List) at the current dataPosition().
writeBinderList(java.util.List) public final <T> T[] createTypedArray(Parcelable.Creator<T> c)
writeTypedArray(T[], int) with the same
object type.
writeTypedArray(T[], int)
public final <T> void readTypedArray(T[] val,
Parcelable.Creator<T> c)
@Deprecated public final <T> T[] readTypedArray(Parcelable.Creator<T> c)
public final <T extends Parcelable> void writeParcelableArray(T[] value,
int parcelableFlags)
writeTypedArray(T[], int), but will
correctly handle an array containing more than one type of object.
value - The array of objects to be written.parcelableFlags - Contextual flags as per
Parcelable.writeToParcel().writeTypedArray(T[], int)public final Object readValue(ClassLoader loader)
public final <T extends Parcelable> T readParcelable(ClassLoader loader)
loader - A ClassLoader from which to instantiate the Parcelable
object, or null for the default class loader.
BadParcelableException - Throws BadParcelableException if there
was an error trying to instantiate the Parcelable.public final Parcelable[] readParcelableArray(ClassLoader loader)
public final Serializable readSerializable()
protected static final Parcel obtain(int obj)
protected void finalize()
throws Throwable
Object
The method can be used to free system resources or perform other cleanup
before the object is garbage collected. The default implementation of the
method is empty, which is also expected by the VM, but subclasses can
override finalize() as required. Uncaught exceptions which are
thrown during the execution of this method cause it to terminate
immediately but are otherwise ignored.
Note that the VM does guarantee that finalize() is called at most
once for any object, but it doesn't guarantee when (if at all) finalize() will be called. For example, object B's finalize()
can delay the execution of object A's finalize() method and
therefore it can delay the reclamation of A's memory. To be safe, use a
ReferenceQueue, because it provides more control
over the way the VM deals with references during garbage collection.
finalize in class ObjectThrowable - any exception which is raised during finalization; these are
ignored by the virtual machine.
|
Build 1.1_r1 (from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||