java.io.ObjectInputStream.readNonProxyDesc()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中java.io.ObjectInputStream.readNonProxyDesc()方法的一些代码示例,展示了ObjectInputStream.readNonProxyDesc()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ObjectInputStream.readNonProxyDesc()方法的具体详情如下:
包路径:java.io.ObjectInputStream
类名称:ObjectInputStream
方法名:readNonProxyDesc

ObjectInputStream.readNonProxyDesc介绍

[英]Reads in and returns class descriptor for a class that is not a dynamic proxy class. Sets passHandle to class descriptor's assigned handle. If class descriptor cannot be resolved to a class in the local VM, a ClassNotFoundException is associated with the descriptor's handle.
[中]读入并返回非动态代理类的类的类描述符。将passHandle设置为类描述符的指定句柄。如果类描述符无法解析为本地VM中的类,则ClassNotFoundException与描述符的句柄相关联。

代码示例

代码示例来源: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: jtulach/bck2brwsr

/**
 * Reads in and returns (possibly null) class descriptor.  Sets passHandle
 * to class descriptor's assigned handle.  If class descriptor cannot be
 * resolved to a class in the local VM, a ClassNotFoundException is
 * associated with the class descriptor's handle.
 */
private ObjectStreamClass readClassDesc(boolean unshared)
  throws IOException
{
  byte tc = bin.peekByte();
  switch (tc) {
    case TC_NULL:
      return (ObjectStreamClass) readNull();
    case TC_REFERENCE:
      return (ObjectStreamClass) readHandle(unshared);
    case TC_PROXYCLASSDESC:
      return readProxyDesc(unshared);
    case TC_CLASSDESC:
      return readNonProxyDesc(unshared);
    default:
      throw new StreamCorruptedException(
        String.format("invalid type code: %02X", tc));
  }
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * Reads in and returns (possibly null) class descriptor.  Sets passHandle
 * to class descriptor's assigned handle.  If class descriptor cannot be
 * resolved to a class in the local VM, a ClassNotFoundException is
 * associated with the class descriptor's handle.
 */
private ObjectStreamClass readClassDesc(boolean unshared)
  throws IOException
{
  byte tc = bin.peekByte();
  switch (tc) {
    case TC_NULL:
      return (ObjectStreamClass) readNull();
    case TC_REFERENCE:
      return (ObjectStreamClass) readHandle(unshared);
    case TC_PROXYCLASSDESC:
      return readProxyDesc(unshared);
    case TC_CLASSDESC:
      return readNonProxyDesc(unshared);
    default:
      throw new StreamCorruptedException(
        String.format("invalid type code: %02X", tc));
  }
}

相关文章

ObjectInputStream类方法