Java Doc for ObjectStreamClass.java in  » 6.0-JDK-Core » io-nio » java » io » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » io nio » java.io 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.io.ObjectStreamClass

ObjectStreamClass
public class ObjectStreamClass implements Serializable(Code)
Serialization's descriptor for classes. It contains the name and serialVersionUID of the class. The ObjectStreamClass for a specific class loaded in this Java VM can be found/created using the lookup method.

The algorithm to compute the SerialVersionUID is described in Object Serialization Specification, Section 4.6, Stream Unique Identifiers.
author:
   Mike Warres
author:
   Roger Riggs
version:
   1.158, 05/05/07
See Also:   ObjectStreamField
See Also:    Object Serialization Specification, Section 4, Class Descriptors
since:
   JDK1.1


Inner Class :static class ClassDataSlot
Inner Class :static class WeakClassKey extends WeakReference>

Field Summary
final public static  ObjectStreamField[]NO_FIELDS
    

Constructor Summary
 ObjectStreamClass()
     Creates blank class descriptor which should be initialized via a subsequent call to initProxy(), initNonProxy() or readNonProxy().

Method Summary
 voidcheckDefaultSerialize()
     Throws an InvalidClassException if objects whose class is represented by this descriptor should not be permitted to use default serialization (e.g., if the class declares serializable fields that do not correspond to actual fields, and hence must use the GetField API).
 voidcheckDeserialize()
     Throws an InvalidClassException if object instances referencing this class descriptor should not be allowed to deserialize.
 voidcheckSerialize()
     Throws an InvalidClassException if objects whose class is represented by this descriptor should not be allowed to serialize.
public  ClassforClass()
     Return the class in the local VM that this version is mapped to.
 ClassDataSlot[]getClassDataLayout()
     Returns array of ClassDataSlot instances representing the data layout (including superclass data) for serialized objects described by this class descriptor.
static  StringgetClassSignature(Class cl)
     Returns JVM type signature for given class.
public  ObjectStreamFieldgetField(String name)
     Get the field of this class by name.
 ObjectStreamFieldgetField(String name, Class type)
     Looks up a serializable field of the represented class by name and type. A specified type of null matches all types, Object.class matches all non-primitive types, and any other non-null type matches assignable types only.
public  ObjectStreamField[]getFields()
     Return an array of the fields of this serializable class. an array containing an element for each persistent field ofthis class.
 ObjectStreamField[]getFields(boolean copy)
     Returns arrays of ObjectStreamFields representing the serializable fields of the represented class.
 ObjectStreamClassgetLocalDesc()
     Returns the "local" class descriptor for the class associated with this class descriptor (i.e., the result of ObjectStreamClass.lookup(this.forClass())) or null if there is no class associated with this descriptor.
public  StringgetName()
     Returns the name of the class described by this descriptor.
 intgetNumObjFields()
     Returns number of non-primitive serializable fields of represented class.
 voidgetObjFieldValues(Object obj, Object[] vals)
     Fetches the serializable object field values of object obj and stores them in array vals starting at offset 0.
 intgetPrimDataSize()
     Returns aggregate size (in bytes) of marshalled primitive field values for represented class.
 voidgetPrimFieldValues(Object obj, byte[] buf)
     Fetches the serializable primitive field values of object obj and marshals them into byte array buf starting at offset 0.
 ClassNotFoundExceptiongetResolveException()
     Returns ClassNotFoundException (if any) thrown while attempting to resolve local class corresponding to this class descriptor.
public  longgetSerialVersionUID()
     Return the serialVersionUID for this class.
 ObjectStreamClassgetSuperDesc()
     Returns superclass descriptor.
 booleanhasBlockExternalData()
     Returns true if class descriptor represents externalizable class that has written its data in 1.2 (block data) format, false otherwise.
 booleanhasReadObjectMethod()
     Returns true if represented class is serializable (but not externalizable) and defines a conformant readObject method.
 booleanhasReadObjectNoDataMethod()
     Returns true if represented class is serializable (but not externalizable) and defines a conformant readObjectNoData method.
 booleanhasReadResolveMethod()
     Returns true if represented class is serializable or externalizable and defines a conformant readResolve method.
 booleanhasWriteObjectData()
     Returns true if class descriptor represents serializable (but not externalizable) class which has written its data via a custom writeObject() method, false otherwise.
 booleanhasWriteObjectMethod()
     Returns true if represented class is serializable (but not externalizable) and defines a conformant writeObject method.
 booleanhasWriteReplaceMethod()
     Returns true if represented class is serializable or externalizable and defines a conformant writeReplace method.
 voidinitNonProxy(ObjectStreamClass model, Class cl, ClassNotFoundException resolveEx, ObjectStreamClass superDesc)
     Initializes class descriptor representing a non-proxy class.
 voidinitProxy(Class cl, ClassNotFoundException resolveEx, ObjectStreamClass superDesc)
     Initializes class descriptor representing a proxy class.
 voidinvokeReadObject(Object obj, ObjectInputStream in)
     Invokes the readObject method of the represented serializable class.
 voidinvokeReadObjectNoData(Object obj)
     Invokes the readObjectNoData method of the represented serializable class.
 ObjectinvokeReadResolve(Object obj)
     Invokes the readResolve method of the represented serializable class and returns the result.
 voidinvokeWriteObject(Object obj, ObjectOutputStream out)
     Invokes the writeObject method of the represented serializable class.
 ObjectinvokeWriteReplace(Object obj)
     Invokes the writeReplace method of the represented serializable class and returns the result.
 booleanisEnum()
     Returns true if class descriptor represents an enum type, false otherwise.
 booleanisExternalizable()
     Returns true if represented class implements Externalizable, false otherwise.
 booleanisInstantiable()
     Returns true if represented class is serializable/externalizable and can be instantiated by the serialization runtime--i.e., if it is externalizable and defines a public no-arg constructor, or if it is non-externalizable and its first non-serializable superclass defines an accessible no-arg constructor.
 booleanisProxy()
     Returns true if class descriptor represents a dynamic proxy class, false otherwise.
 booleanisSerializable()
     Returns true if represented class implements Serializable, false otherwise.
public static  ObjectStreamClasslookup(Class cl)
     Find the descriptor for a class that can be serialized.
static  ObjectStreamClasslookup(Class cl, boolean all)
     Looks up and returns class descriptor for given class, or null if class is non-serializable and "all" is set to false.
public static  ObjectStreamClasslookupAny(Class cl)
     Returns the descriptor for any class, regardless of whether it implements Serializable .
 ObjectnewInstance()
     Creates a new instance of the represented class.
static  voidprocessQueue(ReferenceQueue<Class<?>> queue, ConcurrentMap<? extends WeakReference<Class<?>>, ?> map)
     Removes from the specified map any keys that have been enqueued on the specified reference queue.
 voidreadNonProxy(ObjectInputStream in)
     Reads non-proxy class descriptor information from given input stream.
 voidsetObjFieldValues(Object obj, Object[] vals)
     Sets the serializable object fields of object obj using values from array vals starting at offset 0.
 voidsetPrimFieldValues(Object obj, byte[] buf)
     Sets the serializable primitive fields of object obj using values unmarshalled from byte array buf starting at offset 0.
public  StringtoString()
     Return a string describing this ObjectStreamClass.
 voidwriteNonProxy(ObjectOutputStream out)
     Writes non-proxy class descriptor information to given output stream.

Field Detail
NO_FIELDS
final public static ObjectStreamField[] NO_FIELDS(Code)
serialPersistentFields value indicating no serializable fields




Constructor Detail
ObjectStreamClass
ObjectStreamClass()(Code)
Creates blank class descriptor which should be initialized via a subsequent call to initProxy(), initNonProxy() or readNonProxy().




Method Detail
checkDefaultSerialize
void checkDefaultSerialize() throws InvalidClassException(Code)
Throws an InvalidClassException if objects whose class is represented by this descriptor should not be permitted to use default serialization (e.g., if the class declares serializable fields that do not correspond to actual fields, and hence must use the GetField API). This method does not apply to deserialization of enum constants.



checkDeserialize
void checkDeserialize() throws InvalidClassException(Code)
Throws an InvalidClassException if object instances referencing this class descriptor should not be allowed to deserialize. This method does not apply to deserialization of enum constants.



checkSerialize
void checkSerialize() throws InvalidClassException(Code)
Throws an InvalidClassException if objects whose class is represented by this descriptor should not be allowed to serialize. This method does not apply to serialization of enum constants.



forClass
public Class forClass()(Code)
Return the class in the local VM that this version is mapped to. Null is returned if there is no corresponding local class. the Class instance that this descriptor represents



getClassDataLayout
ClassDataSlot[] getClassDataLayout() throws InvalidClassException(Code)
Returns array of ClassDataSlot instances representing the data layout (including superclass data) for serialized objects described by this class descriptor. ClassDataSlots are ordered by inheritance with those containing "higher" superclasses appearing first. The final ClassDataSlot contains a reference to this descriptor.



getClassSignature
static String getClassSignature(Class cl)(Code)
Returns JVM type signature for given class.



getField
public ObjectStreamField getField(String name)(Code)
Get the field of this class by name.
Parameters:
  name - the name of the data field to look for The ObjectStreamField object of the named field or null ifthere is no such named field.



getField
ObjectStreamField getField(String name, Class type)(Code)
Looks up a serializable field of the represented class by name and type. A specified type of null matches all types, Object.class matches all non-primitive types, and any other non-null type matches assignable types only. Returns matching field, or null if no match found.



getFields
public ObjectStreamField[] getFields()(Code)
Return an array of the fields of this serializable class. an array containing an element for each persistent field ofthis class. Returns an array of length zero if there are nofields.
since:
   1.2



getFields
ObjectStreamField[] getFields(boolean copy)(Code)
Returns arrays of ObjectStreamFields representing the serializable fields of the represented class. If copy is true, a clone of this class descriptor's field array is returned, otherwise the array itself is returned.



getLocalDesc
ObjectStreamClass getLocalDesc()(Code)
Returns the "local" class descriptor for the class associated with this class descriptor (i.e., the result of ObjectStreamClass.lookup(this.forClass())) or null if there is no class associated with this descriptor.



getName
public String getName()(Code)
Returns the name of the class described by this descriptor. This method returns the name of the class in the format that is used by the Class.getName method. a string representing the name of the class



getNumObjFields
int getNumObjFields()(Code)
Returns number of non-primitive serializable fields of represented class.



getObjFieldValues
void getObjFieldValues(Object obj, Object[] vals)(Code)
Fetches the serializable object field values of object obj and stores them in array vals starting at offset 0. It is the responsibility of the caller to ensure that obj is of the proper type if non-null.



getPrimDataSize
int getPrimDataSize()(Code)
Returns aggregate size (in bytes) of marshalled primitive field values for represented class.



getPrimFieldValues
void getPrimFieldValues(Object obj, byte[] buf)(Code)
Fetches the serializable primitive field values of object obj and marshals them into byte array buf starting at offset 0. It is the responsibility of the caller to ensure that obj is of the proper type if non-null.



getResolveException
ClassNotFoundException getResolveException()(Code)
Returns ClassNotFoundException (if any) thrown while attempting to resolve local class corresponding to this class descriptor.



getSerialVersionUID
public long getSerialVersionUID()(Code)
Return the serialVersionUID for this class. The serialVersionUID defines a set of classes all with the same name that have evolved from a common root class and agree to be serialized and deserialized using a common format. NonSerializable classes have a serialVersionUID of 0L. the SUID of the class described by this descriptor



getSuperDesc
ObjectStreamClass getSuperDesc()(Code)
Returns superclass descriptor. Note that on the receiving side, the superclass descriptor may be bound to a class that is not a superclass of the subclass descriptor's bound class.



hasBlockExternalData
boolean hasBlockExternalData()(Code)
Returns true if class descriptor represents externalizable class that has written its data in 1.2 (block data) format, false otherwise.



hasReadObjectMethod
boolean hasReadObjectMethod()(Code)
Returns true if represented class is serializable (but not externalizable) and defines a conformant readObject method. Otherwise, returns false.



hasReadObjectNoDataMethod
boolean hasReadObjectNoDataMethod()(Code)
Returns true if represented class is serializable (but not externalizable) and defines a conformant readObjectNoData method. Otherwise, returns false.



hasReadResolveMethod
boolean hasReadResolveMethod()(Code)
Returns true if represented class is serializable or externalizable and defines a conformant readResolve method. Otherwise, returns false.



hasWriteObjectData
boolean hasWriteObjectData()(Code)
Returns true if class descriptor represents serializable (but not externalizable) class which has written its data via a custom writeObject() method, false otherwise.



hasWriteObjectMethod
boolean hasWriteObjectMethod()(Code)
Returns true if represented class is serializable (but not externalizable) and defines a conformant writeObject method. Otherwise, returns false.



hasWriteReplaceMethod
boolean hasWriteReplaceMethod()(Code)
Returns true if represented class is serializable or externalizable and defines a conformant writeReplace method. Otherwise, returns false.



initNonProxy
void initNonProxy(ObjectStreamClass model, Class cl, ClassNotFoundException resolveEx, ObjectStreamClass superDesc) throws InvalidClassException(Code)
Initializes class descriptor representing a non-proxy class.



initProxy
void initProxy(Class cl, ClassNotFoundException resolveEx, ObjectStreamClass superDesc) throws InvalidClassException(Code)
Initializes class descriptor representing a proxy class.



invokeReadObject
void invokeReadObject(Object obj, ObjectInputStream in) throws ClassNotFoundException, IOException, UnsupportedOperationException(Code)
Invokes the readObject method of the represented serializable class. Throws UnsupportedOperationException if this class descriptor is not associated with a class, or if the class is externalizable, non-serializable or does not define readObject.



invokeReadObjectNoData
void invokeReadObjectNoData(Object obj) throws IOException, UnsupportedOperationException(Code)
Invokes the readObjectNoData method of the represented serializable class. Throws UnsupportedOperationException if this class descriptor is not associated with a class, or if the class is externalizable, non-serializable or does not define readObjectNoData.



invokeReadResolve
Object invokeReadResolve(Object obj) throws IOException, UnsupportedOperationException(Code)
Invokes the readResolve method of the represented serializable class and returns the result. Throws UnsupportedOperationException if this class descriptor is not associated with a class, or if the class is non-serializable or does not define readResolve.



invokeWriteObject
void invokeWriteObject(Object obj, ObjectOutputStream out) throws IOException, UnsupportedOperationException(Code)
Invokes the writeObject method of the represented serializable class. Throws UnsupportedOperationException if this class descriptor is not associated with a class, or if the class is externalizable, non-serializable or does not define writeObject.



invokeWriteReplace
Object invokeWriteReplace(Object obj) throws IOException, UnsupportedOperationException(Code)
Invokes the writeReplace method of the represented serializable class and returns the result. Throws UnsupportedOperationException if this class descriptor is not associated with a class, or if the class is non-serializable or does not define writeReplace.



isEnum
boolean isEnum()(Code)
Returns true if class descriptor represents an enum type, false otherwise.



isExternalizable
boolean isExternalizable()(Code)
Returns true if represented class implements Externalizable, false otherwise.



isInstantiable
boolean isInstantiable()(Code)
Returns true if represented class is serializable/externalizable and can be instantiated by the serialization runtime--i.e., if it is externalizable and defines a public no-arg constructor, or if it is non-externalizable and its first non-serializable superclass defines an accessible no-arg constructor. Otherwise, returns false.



isProxy
boolean isProxy()(Code)
Returns true if class descriptor represents a dynamic proxy class, false otherwise.



isSerializable
boolean isSerializable()(Code)
Returns true if represented class implements Serializable, false otherwise.



lookup
public static ObjectStreamClass lookup(Class cl)(Code)
Find the descriptor for a class that can be serialized. Creates an ObjectStreamClass instance if one does not exist yet for class. Null is returned if the specified class does not implement java.io.Serializable or java.io.Externalizable.
Parameters:
  cl - class for which to get the descriptor the class descriptor for the specified class



lookup
static ObjectStreamClass lookup(Class cl, boolean all)(Code)
Looks up and returns class descriptor for given class, or null if class is non-serializable and "all" is set to false.
Parameters:
  cl - class to look up
Parameters:
  all - if true, return descriptors for all classes; if false, onlyreturn descriptors for serializable classes



lookupAny
public static ObjectStreamClass lookupAny(Class cl)(Code)
Returns the descriptor for any class, regardless of whether it implements Serializable .
Parameters:
  cl - class for which to get the descriptor the class descriptor for the specified class
since:
   1.6



newInstance
Object newInstance() throws InstantiationException, InvocationTargetException, UnsupportedOperationException(Code)
Creates a new instance of the represented class. If the class is externalizable, invokes its public no-arg constructor; otherwise, if the class is serializable, invokes the no-arg constructor of the first non-serializable superclass. Throws UnsupportedOperationException if this class descriptor is not associated with a class, if the associated class is non-serializable or if the appropriate no-arg constructor is inaccessible/unavailable.



processQueue
static void processQueue(ReferenceQueue<Class<?>> queue, ConcurrentMap<? extends WeakReference<Class<?>>, ?> map)(Code)
Removes from the specified map any keys that have been enqueued on the specified reference queue.



readNonProxy
void readNonProxy(ObjectInputStream in) throws IOException, ClassNotFoundException(Code)
Reads non-proxy class descriptor information from given input stream. The resulting class descriptor is not fully functional; it can only be used as input to the ObjectInputStream.resolveClass() and ObjectStreamClass.initNonProxy() methods.



setObjFieldValues
void setObjFieldValues(Object obj, Object[] vals)(Code)
Sets the serializable object fields of object obj using values from array vals starting at offset 0. It is the responsibility of the caller to ensure that obj is of the proper type if non-null.



setPrimFieldValues
void setPrimFieldValues(Object obj, byte[] buf)(Code)
Sets the serializable primitive fields of object obj using values unmarshalled from byte array buf starting at offset 0. It is the responsibility of the caller to ensure that obj is of the proper type if non-null.



toString
public String toString()(Code)
Return a string describing this ObjectStreamClass.



writeNonProxy
void writeNonProxy(ObjectOutputStream out) throws IOException(Code)
Writes non-proxy class descriptor information to given output stream.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.