本文整理汇总了Java中com.sun.corba.se.impl.io.ObjectStreamClass.lookup方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectStreamClass.lookup方法的具体用法?Java ObjectStreamClass.lookup怎么用?Java ObjectStreamClass.lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.corba.se.impl.io.ObjectStreamClass
的用法示例。
在下文中一共展示了ObjectStreamClass.lookup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: outputObject
import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{
currentObject = obj;
Class currclass = obj.getClass();
/* Get the Class descriptor for this class,
* Throw a NotSerializableException if there is none.
*/
currentClassDesc = ObjectStreamClass.lookup(currclass);
if (currentClassDesc == null) {
// XXX I18N, Logging needed.
throw new NotSerializableException(currclass.getName());
}
/* If the object is externalizable,
* call writeExternal.
* else do Serializable processing.
*/
if (currentClassDesc.isExternalizable()) {
// Write format version
orbStream.write_octet(streamFormatVersion);
Externalizable ext = (Externalizable)obj;
ext.writeExternal(this);
} else {
/* The object's classes should be processed from supertype to subtype
* Push all the clases of the current object onto a stack.
* Remember the stack pointer where this set of classes is being pushed.
*/
int stackMark = classDescStack.size();
try {
ObjectStreamClass next;
while ((next = currentClassDesc.getSuperclass()) != null) {
classDescStack.push(currentClassDesc);
currentClassDesc = next;
}
/*
* For currentClassDesc and all the pushed class descriptors
* If the class is writing its own data
* set blockData = true; call the class writeObject method
* If not
* invoke either the defaultWriteObject method.
*/
do {
WriteObjectState oldState = writeObjectState;
try {
setState(NOT_IN_WRITE_OBJECT);
if (currentClassDesc.hasWriteObject()) {
invokeObjectWriter(currentClassDesc, obj );
} else {
defaultWriteObjectDelegate();
}
} finally {
setState(oldState);
}
} while (classDescStack.size() > stackMark &&
(currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
} finally {
classDescStack.setSize(stackMark);
}
}
}
示例2: outputObject
import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{
currentObject = obj;
Class currclass = obj.getClass();
/* Get the Class descriptor for this class,
* Throw a NotSerializableException if there is none.
*/
currentClassDesc = ObjectStreamClass.lookup(currclass);
if (currentClassDesc == null) {
// XXX I18N, Logging needed.
throw new NotSerializableException(currclass.getName());
}
/* If the object is externalizable,
* call writeExternal.
* else do Serializable processing.
*/
if (currentClassDesc.isExternalizable()) {
// Write format version
orbStream.write_octet(streamFormatVersion);
Externalizable ext = (Externalizable)obj;
ext.writeExternal(this);
} else {
/* The object's classes should be processed from supertype to subtype
* Push all the clases of the current object onto a stack.
* Remember the stack pointer where this set of classes is being pushed.
*/
if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
this.writeUTF((String)obj);
return;
}
int stackMark = classDescStack.size();
try {
ObjectStreamClass next;
while ((next = currentClassDesc.getSuperclass()) != null) {
classDescStack.push(currentClassDesc);
currentClassDesc = next;
}
/*
* For currentClassDesc and all the pushed class descriptors
* If the class is writing its own data
* set blockData = true; call the class writeObject method
* If not
* invoke either the defaultWriteObject method.
*/
do {
WriteObjectState oldState = writeObjectState;
try {
setState(NOT_IN_WRITE_OBJECT);
if (currentClassDesc.hasWriteObject()) {
invokeObjectWriter(currentClassDesc, obj );
} else {
defaultWriteObjectDelegate();
}
} finally {
setState(oldState);
}
} while (classDescStack.size() > stackMark &&
(currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
} finally {
classDescStack.setSize(stackMark);
}
}
}
示例3: outputObject
import com.sun.corba.se.impl.io.ObjectStreamClass; //导入方法依赖的package包/类
private void outputObject(final Object obj) throws IOException{
currentObject = obj;
Class currclass = obj.getClass();
/* Get the Class descriptor for this class,
* Throw a NotSerializableException if there is none.
*/
currentClassDesc = ObjectStreamClass.lookup(currclass);
if (currentClassDesc == null) {
// XXX I18N, Logging needed.
throw new NotSerializableException(currclass.getName());
}
/* If the object is externalizable,
* call writeExternal.
* else do Serializable processing.
*/
if (currentClassDesc.isExternalizable()) {
// Write format version
orbStream.write_octet(streamFormatVersion);
Externalizable ext = (Externalizable)obj;
ext.writeExternal(this);
} else {
/* The object's classes should be processed from supertype to subtype
* Push all the clases of the current object onto a stack.
* Remember the stack pointer where this set of classes is being pushed.
*/
int stackMark = classDescStack.size();
try {
ObjectStreamClass next;
while ((next = currentClassDesc.getSuperclass()) != null) {
classDescStack.push(currentClassDesc);
currentClassDesc = next;
}
/*
* For currentClassDesc and all the pushed class descriptors
* If the class is writing its own data
* set blockData = true; call the class writeObject method
* If not
* invoke either the defaultWriteObject method.
*/
do {
WriteObjectState oldState = writeObjectState;
try {
setState(NOT_IN_WRITE_OBJECT);
if (currentClassDesc.hasWriteObject()) {
invokeObjectWriter(currentClassDesc, obj );
} else {
defaultWriteObjectDelegate();
}
} finally {
setState(oldState);
}
} while (classDescStack.size() > stackMark &&
(currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
} finally {
classDescStack.setSize(stackMark);
}
}
}