本文整理了Java中java.io.ObjectInputStream.readClassDesc()
方法的一些代码示例,展示了ObjectInputStream.readClassDesc()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readClassDesc()
方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readClassDesc
[英]Reads a class descriptor (an ObjectStreamClass) from the stream.
[中]从流中读取类描述符(ObjectStreamClass)。
代码示例来源:origin: robovm/robovm
ObjectStreamClass classDesc = readClassDesc();
代码示例来源:origin: robovm/robovm
private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException {
ObjectStreamClass classDesc;
primitiveData = input;
int oldHandle = descriptorHandle;
descriptorHandle = nextHandle();
classDesc = readClassDescriptor();
registerObjectRead(classDesc, descriptorHandle, false);
descriptorHandle = oldHandle;
primitiveData = emptyStream;
classDesc.setClass(resolveClass(classDesc));
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
ObjectStreamClass superClass = readClassDesc();
checkedSetSuperClassDesc(classDesc, superClass);
// Check SUIDs, note all SUID for Enum is 0L
if (0L != classDesc.getSerialVersionUID() || 0L != superClass.getSerialVersionUID()) {
throw new InvalidClassException(superClass.getName(),
"Incompatible class (SUID): " + superClass + " but expected " + superClass);
}
byte tc = nextTC();
// discard TC_ENDBLOCKDATA after classDesc if any
if (tc == TC_ENDBLOCKDATA) {
// read next parent class. For enum, it may be null
superClass.setSuperclass(readClassDesc());
} else {
// not TC_ENDBLOCKDATA, push back for next read
pushbackTC();
}
return classDesc;
}
代码示例来源:origin: robovm/robovm
checkedSetSuperClassDesc(newClassDesc, readClassDesc());
return newClassDesc;
代码示例来源:origin: robovm/robovm
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: MobiVM/robovm
private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException {
ObjectStreamClass classDesc;
primitiveData = input;
int oldHandle = descriptorHandle;
descriptorHandle = nextHandle();
classDesc = readClassDescriptor();
registerObjectRead(classDesc, descriptorHandle, false);
descriptorHandle = oldHandle;
primitiveData = emptyStream;
classDesc.setClass(resolveClass(classDesc));
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
ObjectStreamClass superClass = readClassDesc();
checkedSetSuperClassDesc(classDesc, superClass);
// Check SUIDs, note all SUID for Enum is 0L
if (0L != classDesc.getSerialVersionUID() || 0L != superClass.getSerialVersionUID()) {
throw new InvalidClassException(superClass.getName(),
"Incompatible class (SUID): " + superClass + " but expected " + superClass);
}
byte tc = nextTC();
// discard TC_ENDBLOCKDATA after classDesc if any
if (tc == TC_ENDBLOCKDATA) {
// read next parent class. For enum, it may be null
superClass.setSuperclass(readClassDesc());
} else {
// not TC_ENDBLOCKDATA, push back for next read
pushbackTC();
}
return classDesc;
}
代码示例来源:origin: robovm/robovm
streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
registerObjectRead(streamClass, nextHandle(), false);
checkedSetSuperClassDesc(streamClass, readClassDesc());
return streamClass;
case TC_REFERENCE:
代码示例来源:origin: ibinti/bugvm
private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException {
ObjectStreamClass classDesc;
primitiveData = input;
int oldHandle = descriptorHandle;
descriptorHandle = nextHandle();
classDesc = readClassDescriptor();
registerObjectRead(classDesc, descriptorHandle, false);
descriptorHandle = oldHandle;
primitiveData = emptyStream;
classDesc.setClass(resolveClass(classDesc));
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
ObjectStreamClass superClass = readClassDesc();
checkedSetSuperClassDesc(classDesc, superClass);
// Check SUIDs, note all SUID for Enum is 0L
if (0L != classDesc.getSerialVersionUID() || 0L != superClass.getSerialVersionUID()) {
throw new InvalidClassException(superClass.getName(),
"Incompatible class (SUID): " + superClass + " but expected " + superClass);
}
byte tc = nextTC();
// discard TC_ENDBLOCKDATA after classDesc if any
if (tc == TC_ENDBLOCKDATA) {
// read next parent class. For enum, it may be null
superClass.setSuperclass(readClassDesc());
} else {
// not TC_ENDBLOCKDATA, push back for next read
pushbackTC();
}
return classDesc;
}
代码示例来源:origin: robovm/robovm
ObjectStreamClass classDesc = readClassDesc();
代码示例来源:origin: com.bugvm/bugvm-rt
private ObjectStreamClass readEnumDescInternal() throws IOException, ClassNotFoundException {
ObjectStreamClass classDesc;
primitiveData = input;
int oldHandle = descriptorHandle;
descriptorHandle = nextHandle();
classDesc = readClassDescriptor();
registerObjectRead(classDesc, descriptorHandle, false);
descriptorHandle = oldHandle;
primitiveData = emptyStream;
classDesc.setClass(resolveClass(classDesc));
// Consume unread class annotation data and TC_ENDBLOCKDATA
discardData();
ObjectStreamClass superClass = readClassDesc();
checkedSetSuperClassDesc(classDesc, superClass);
// Check SUIDs, note all SUID for Enum is 0L
if (0L != classDesc.getSerialVersionUID() || 0L != superClass.getSerialVersionUID()) {
throw new InvalidClassException(superClass.getName(),
"Incompatible class (SUID): " + superClass + " but expected " + superClass);
}
byte tc = nextTC();
// discard TC_ENDBLOCKDATA after classDesc if any
if (tc == TC_ENDBLOCKDATA) {
// read next parent class. For enum, it may be null
superClass.setSuperclass(readClassDesc());
} else {
// not TC_ENDBLOCKDATA, push back for next read
pushbackTC();
}
return classDesc;
}
代码示例来源:origin: stackoverflow.com
Exception in thread "main" java.io.InvalidClassException: TestData; Serializable incompatible with Externalizable
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:634)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1623)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1774)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at ReadIt.main(ReadIt.java:10)
代码示例来源:origin: com.jtransc/jtransc-rt
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared read the object unshared
* @return The {@code java.lang.Class} read from the stream.
* @throws IOException If an IO exception happened when reading the class.
* @throws ClassNotFoundException If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: MobiVM/robovm
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: org.apidesign.bck2brwsr/emul
/**
* Reads in and returns class object. Sets passHandle to class object's
* assigned handle. Returns null if class is unresolvable (in which case a
* ClassNotFoundException will be associated with the class' handle in the
* handle table).
*/
private Class readClass(boolean unshared) throws IOException {
if (bin.readByte() != TC_CLASS) {
throw new InternalError();
}
ObjectStreamClass desc = readClassDesc(false);
Class cl = desc.forClass();
passHandle = handles.assign(unshared ? unsharedMarker : cl);
ClassNotFoundException resolveEx = desc.getResolveException();
if (resolveEx != null) {
handles.markException(passHandle, resolveEx);
}
handles.finish(passHandle);
return cl;
}
代码示例来源:origin: ibinti/bugvm
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: com.mobidevelop.robovm/robovm-rt
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: com.gluonhq/robovm-rt
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: com.bugvm/bugvm-rt
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: jtulach/bck2brwsr
/**
* Reads in and returns class object. Sets passHandle to class object's
* assigned handle. Returns null if class is unresolvable (in which case a
* ClassNotFoundException will be associated with the class' handle in the
* handle table).
*/
private Class readClass(boolean unshared) throws IOException {
if (bin.readByte() != TC_CLASS) {
throw new InternalError();
}
ObjectStreamClass desc = readClassDesc(false);
Class cl = desc.forClass();
passHandle = handles.assign(unshared ? unsharedMarker : cl);
ClassNotFoundException resolveEx = desc.getResolveException();
if (resolveEx != null) {
handles.markException(passHandle, resolveEx);
}
handles.finish(passHandle);
return cl;
}
代码示例来源:origin: FlexoVM/flexovm
/**
* Reads a new class from the receiver. It is assumed the class has not been
* read yet (not a cyclic reference). Return the class read.
*
* @param unshared
* read the object unshared
* @return The {@code java.lang.Class} read from the stream.
*
* @throws IOException
* If an IO exception happened when reading the class.
* @throws ClassNotFoundException
* If a class for one of the objects could not be found
*/
private Class<?> readNewClass(boolean unshared) throws ClassNotFoundException, IOException {
ObjectStreamClass classDesc = readClassDesc();
if (classDesc == null) {
throw missingClassDescriptor();
}
Class<?> localClass = classDesc.forClass();
if (localClass != null) {
registerObjectRead(localClass, nextHandle(), unshared);
}
return localClass;
}
代码示例来源:origin: MobiVM/robovm
streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
registerObjectRead(streamClass, nextHandle(), false);
checkedSetSuperClassDesc(streamClass, readClassDesc());
return streamClass;
case TC_REFERENCE:
内容来源于网络,如有侵权,请联系作者删除!