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

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

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

ObjectInputStream.checkedSetSuperClassDesc介绍

暂无

代码示例

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

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: com.jtransc/jtransc-rt

checkedSetSuperClassDesc(newClassDesc, readClassDesc());
return newClassDesc;

代码示例来源:origin: com.bugvm/bugvm-rt

checkedSetSuperClassDesc(newClassDesc, readClassDesc());
return newClassDesc;

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

checkedSetSuperClassDesc(newClassDesc, readClassDesc());
return newClassDesc;

代码示例来源: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: 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: com.mobidevelop.robovm/robovm-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: com.gluonhq/robovm-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: 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: com.jtransc/jtransc-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: FlexoVM/flexovm

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: com.gluonhq/robovm-rt

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Reads a class descriptor (an {@code ObjectStreamClass}) from the
 * stream.
 *
 * @return the class descriptor read from the stream
 * @throws IOException            If an IO exception happened when reading the class
 *                                descriptor.
 * @throws ClassNotFoundException If the class corresponding to the class descriptor could not
 *                                be found.
 */
private ObjectStreamClass readClassDesc() throws ClassNotFoundException, IOException {
  byte tc = nextTC();
  switch (tc) {
    case TC_CLASSDESC:
      return readNewClassDesc(false);
    case TC_PROXYCLASSDESC:
      Class<?> proxyClass = readNewProxyClassDesc();
      ObjectStreamClass streamClass = ObjectStreamClass.lookup(proxyClass);
      streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
      registerObjectRead(streamClass, nextHandle(), false);
      checkedSetSuperClassDesc(streamClass, readClassDesc());
      return streamClass;
    case TC_REFERENCE:
      return (ObjectStreamClass) readCyclicReference();
    case TC_NULL:
      return null;
    default:
      throw corruptStream(tc);
  }
}

代码示例来源:origin: MobiVM/robovm

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: ibinti/bugvm

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: com.bugvm/bugvm-rt

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

代码示例来源:origin: FlexoVM/flexovm

streamClass.setLoadFields(ObjectStreamClass.NO_FIELDS);
  registerObjectRead(streamClass, nextHandle(), false);
  checkedSetSuperClassDesc(streamClass, readClassDesc());
  return streamClass;
case TC_REFERENCE:

相关文章

ObjectInputStream类方法