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

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

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

ObjectInputStream.readFieldDescriptors介绍

[英]Reads a collection of field descriptors (name, type name, etc) for the class descriptor cDesc (an ObjectStreamClass)
[中]读取类描述符cDesc(ObjectStreamClass)的字段描述符集合(名称、类型名称等)

代码示例

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException if a class for one of the objects cannot be found.
 * @throws IOException            if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

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

/**
 * Reads a class descriptor from the source stream.
 *
 * @return the class descriptor read from the source stream.
 * @throws ClassNotFoundException
 *             if a class for one of the objects cannot be found.
 * @throws IOException
 *             if an error occurs while reading from the source stream.
 */
protected ObjectStreamClass readClassDescriptor() throws IOException, ClassNotFoundException {
  ObjectStreamClass newClassDesc = new ObjectStreamClass();
  String name = input.readUTF();
  if (name.length() == 0) {
    throw new IOException("The stream is corrupted");
  }
  newClassDesc.setName(name);
  newClassDesc.setSerialVersionUID(input.readLong());
  newClassDesc.setFlags(input.readByte());
  /*
   * We must register the class descriptor before reading field
   * descriptors. If called outside of readObject, the descriptorHandle
   * might be unset.
   */
  if (descriptorHandle == -1) {
    descriptorHandle = nextHandle();
  }
  registerObjectRead(newClassDesc, descriptorHandle, false);
  readFieldDescriptors(newClassDesc);
  return newClassDesc;
}

相关文章

ObjectInputStream类方法