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

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

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

ObjectOutputStream.putFields介绍

[英]Gets this stream's PutField object. This object provides access to the persistent fields that are eventually written to the output stream. It is used to transfer the values from the fields of the object that is currently being written to the persistent fields.
[中]获取此流的PutField对象。此对象提供对最终写入输出流的持久字段的访问。它用于将当前正在写入的对象字段中的值传输到持久字段中。

代码示例

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

for (int i = 0; i < segments.length; ++i)
  segments[i] = new Segment<K, V>(LOAD_FACTOR);
s.putFields().put("segments", segments);
s.putFields().put("segmentShift", segmentShift);
s.putFields().put("segmentMask", segmentMask);
s.writeFields();

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

for (int i = 0; i < segments.length; ++i)
  segments[i] = new Segment<K, V>(LOAD_FACTOR);
s.putFields().put("segments", segments);
s.putFields().put("segmentShift", segmentShift);
s.putFields().put("segmentMask", segmentMask);
s.writeFields();

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

/**
 * @param s Object output stream.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
  s.putFields().put("field1", 1);
  s.putFields().put("field2", 2);
  s.writeFields();
  s.writeObject(null);
}

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

/**
 * @param s Object output stream.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
  s.putFields().put("field1", 1);
  s.putFields().put("field2", 2);
  s.writeFields();
  s.writeObject(null);
}

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

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

相关文章

ObjectOutputStream类方法