java.io.ObjectOutputStream.defaultWriteFields()方法的使用及代码示例

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

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

ObjectOutputStream.defaultWriteFields介绍

[英]Fetches and writes values of serializable fields of given object to stream. The given class descriptor specifies which field values to write, and in which order they should be written.
[中]获取并将给定对象的可序列化字段的值写入流。给定的类描述符指定要写入哪些字段值,以及它们的写入顺序。

代码示例

代码示例来源:origin: stackoverflow.com

Exception in thread "main" java.io.NotSerializableException: HouseSurvey
 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
 at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
 at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
 at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
 at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
 at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
 at HouseSurvey.doPost(HouseSurvey.java:36)
 at HouseSurvey.main(HouseSurvey.java:9)

代码示例来源:origin: jtulach/bck2brwsr

/**
 * Write the non-static and non-transient fields of the current class to
 * this stream.  This may only be called from the writeObject method of the
 * class being serialized. It will throw the NotActiveException if it is
 * called otherwise.
 *
 * @throws  IOException if I/O errors occur while writing to the underlying
 *          <code>OutputStream</code>
 */
public void defaultWriteObject() throws IOException {
  if ( curContext == null ) {
    throw new NotActiveException("not in call to writeObject");
  }
  Object curObj = null; // curContext.getObj();
  ObjectStreamClass curDesc = null; // curContext.getDesc();
  bout.setBlockDataMode(false);
  defaultWriteFields(curObj, curDesc);
  bout.setBlockDataMode(true);
}

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

/**
 * Write the non-static and non-transient fields of the current class to
 * this stream.  This may only be called from the writeObject method of the
 * class being serialized. It will throw the NotActiveException if it is
 * called otherwise.
 *
 * @throws  IOException if I/O errors occur while writing to the underlying
 *          <code>OutputStream</code>
 */
public void defaultWriteObject() throws IOException {
  if ( curContext == null ) {
    throw new NotActiveException("not in call to writeObject");
  }
  Object curObj = null; // curContext.getObj();
  ObjectStreamClass curDesc = null; // curContext.getDesc();
  bout.setBlockDataMode(false);
  defaultWriteFields(curObj, curDesc);
  bout.setBlockDataMode(true);
}

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

defaultWriteFields(obj, slotDesc);

代码示例来源:origin: jtulach/bck2brwsr

defaultWriteFields(obj, slotDesc);

相关文章

ObjectOutputStream类方法