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

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

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

ObjectOutputStream.writeFields介绍

[英]Writes the fields of the object currently being written to the target stream. The field values are buffered in the currently active PutField object, which can be accessed by calling putFields().
[中]将当前正在写入目标流的对象的字段写入目标流。字段值缓冲在当前活动的PutField对象中,可以通过调用putFields()来访问该对象。

代码示例

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

private void writeObject(ObjectOutputStream stream) throws IOException {
  // Emulate loadFactor field for other implementations to read
  ObjectOutputStream.PutField fields = stream.putFields();
  fields.put("loadFactor", DEFAULT_LOAD_FACTOR);
  stream.writeFields();
  stream.writeInt(table.length); // Capacity
  stream.writeInt(size);
  for (Entry<K, V> e : entrySet()) {
    stream.writeObject(e.getKey());
    stream.writeObject(e.getValue());
  }
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions);
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", hashtable);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(permissions);
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", hashtable);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

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

private void writeObject(ObjectOutputStream stream) throws IOException {
  stream.putFields().put("comparator", comparator());
  stream.writeFields();
  stream.writeInt(size);
  for (Map.Entry<K, V> entry : entrySet()) {
    stream.writeObject(entry.getKey());
    stream.writeObject(entry.getValue());
  }
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  Hashtable<String, TopicPermission> hashtable = new Hashtable<String, TopicPermission>(permissions);
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", hashtable);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

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

private synchronized void writeObject(ObjectOutputStream stream)
    throws IOException {
  // Emulate loadFactor field for other implementations to read
  ObjectOutputStream.PutField fields = stream.putFields();
  fields.put("threshold",  (int) (DEFAULT_LOAD_FACTOR * table.length));
  fields.put("loadFactor", DEFAULT_LOAD_FACTOR);
  stream.writeFields();
  stream.writeInt(table.length); // Capacity
  stream.writeInt(size);
  for (Entry<K, V> e : entrySet()) {
    stream.writeObject(e.getKey());
    stream.writeObject(e.getValue());
  }
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(permissions);
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", hashtable);
  pfields.put("all_allowed", all_allowed);
  pfields.put("filterPermissions", filterPermissions);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(permissions);
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", hashtable);
  pfields.put("all_allowed", all_allowed);
  pfields.put("filterPermissions", filterPermissions);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.core

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  pfields.put("filterPermissions", filterPermissions);
  out.writeFields();
}

代码示例来源:origin: org.osgi/org.osgi.compendium

private synchronized void writeObject(ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pfields = out.putFields();
  pfields.put("hasElement", false);
  pfields.put("permissions", permissions);
  pfields.put("all_allowed", all_allowed);
  out.writeFields();
}

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

private synchronized void writeObject(ObjectOutputStream out)
    throws IOException {
  ObjectOutputStream.PutField fields = out.putFields();
  fields.put("count", length());
  fields.put("shared", false);
  fields.put("value", getValue());
  out.writeFields();
}

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
  private void writeObject(ObjectOutputStream stream) throws IOException {
    stream.defaultWriteObject();
    ObjectOutputStream.PutField fields = stream.putFields();
    fields.put("name", "test");
    stream.writeFields();
  }
}

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

private void writeObject(ObjectOutputStream stream) throws IOException {
  ObjectOutputStream.PutField fields = stream.putFields();
  fields.put("defaultCenturyStart", defaultCenturyStart);
  fields.put("formatData", formatData);
  fields.put("pattern", pattern);
  fields.put("serialVersionOnStream", 1);
  stream.writeFields();
}

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

private void writeObject(ObjectOutputStream stream) throws IOException {
  ObjectOutputStream.PutField fields = stream.putFields();
  fields.put("country", countryCode);
  fields.put("hashcode", -1);
  fields.put("language", languageCode);
  fields.put("variant", variantCode);
  stream.writeFields();
}

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

ObjectOutputStream.PutField putFields = out.putFields();
putFields.put("source", sourceBean);
putFields.put("children", map);
out.writeFields();

代码示例来源:origin: junit-team/junit4

public void serialize(ObjectOutputStream s) throws IOException {
  ObjectOutputStream.PutField fields = s.putFields();
  fields.put("fCount", fCount);
  fields.put("fIgnoreCount", fIgnoreCount);
  fields.put("fFailures", fFailures);
  fields.put("fRunTime", fRunTime);
  fields.put("fStartTime", fStartTime);
  fields.put("assumptionFailureCount", assumptionFailureCount);
  s.writeFields();
}

相关文章

ObjectOutputStream类方法