当前位置: 首页>>代码示例>>Java>>正文


Java ObjectOutputStream.PutField方法代码示例

本文整理汇总了Java中java.io.ObjectOutputStream.PutField方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectOutputStream.PutField方法的具体用法?Java ObjectOutputStream.PutField怎么用?Java ObjectOutputStream.PutField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.io.ObjectOutputStream的用法示例。


在下文中一共展示了ObjectOutputStream.PutField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes an {@link MBeanServerNotificationFilter} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("mySelectObjNameList", selectedNames);
    fields.put("myDeselectObjNameList", deselectedNames);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:MBeanServerNotificationFilter.java

示例2: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes an {@link InvalidTargetObjectTypeException} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("relatedExcept", exception);
    fields.put("msgStr", ((exception != null)?exception.getMessage():""));
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:InvalidTargetObjectTypeException.java

示例3: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes a {@link ModelMBeanAttributeInfo} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("attrDescriptor", attrDescriptor);
    fields.put("currClass", currClass);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:ModelMBeanAttributeInfo.java

示例4: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
  ObjectOutputStream.PutField pf = out.putFields();
  pf.put("name", this.name);
  pf.put("doc", this.doc);
  //
  // out.writeObject(this.name);
  // out.writeObject(this.doc);
  // save only the annotations
  // in an array that will prevent the need for casting
  // when deserializing
  annotations = new Annotation[this.annotsById.size()];
  annotations = this.annotsById.values().toArray(annotations);
  // out.writeObject(annotations);
  pf.put("annotations", this.annotations);    
  pf.put("relations", this.relations);
  
  
  out.writeFields();
  annotations = null;
  boolean isIndexedByType = (this.annotsByType != null);
  boolean isIndexedByStartNode = (this.annotsByStartNode != null);
  out.writeBoolean(isIndexedByType);
  out.writeBoolean(isIndexedByStartNode);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:25,代码来源:AnnotationSetImpl.java

示例5: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * default behavior is overridden in order to write the
 * scope_ifname field as a String, rather than a NetworkInterface
 * which is not serializable
 */
private synchronized void writeObject(ObjectOutputStream s)
    throws IOException
{
        String ifname = null;

    if (holder6.scope_ifname != null) {
        ifname = holder6.scope_ifname.getName();
        holder6.scope_ifname_set = true;
    }
    ObjectOutputStream.PutField pfields = s.putFields();
    pfields.put("ipaddress", holder6.ipaddress);
    pfields.put("scope_id", holder6.scope_id);
    pfields.put("scope_id_set", holder6.scope_id_set);
    pfields.put("scope_ifname_set", holder6.scope_ifname_set);
    pfields.put("ifname", ifname);
    s.writeFields();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:Inet6Address.java

示例6: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
     * Save the {@code BigInteger} instance to a stream.
     * The magnitude of a BigInteger is serialized as a byte array for
     * historical reasons.
     *
     * @serialData two necessary fields are written as well as obsolete
     *             fields for compatibility with older versions.
     */
    private void writeObject(ObjectOutputStream s) throws IOException {
        // set the values of the Serializable fields
        ObjectOutputStream.PutField fields = s.putFields();
        fields.put("signum", signum);
        fields.put("magnitude", magSerializedForm());
        // The values written for cached fields are compatible with older
        // versions, but are ignored in readObject so don't otherwise matter.
        fields.put("bitCount", -1);
        fields.put("bitLength", -1);
        fields.put("lowestSetBit", -2);
        fields.put("firstNonzeroByteNum", -2);

        // save them
        s.writeFields();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:BigInteger.java

示例7: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes a {@link RelationNotification} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("myNewRoleValue", newRoleValue);
    fields.put("myOldRoleValue", oldRoleValue);
    fields.put("myRelId", relationId);
    fields.put("myRelObjName", relationObjName);
    fields.put("myRelTypeName", relationTypeName);
    fields.put("myRoleName",roleName);
    fields.put("myUnregMBeanList", unregisterMBeanList);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:RelationNotification.java

示例8: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Save the {@code BigInteger} instance to a stream.  The magnitude of a
 * {@code BigInteger} is serialized as a byte array for historical reasons.
 * To maintain compatibility with older implementations, the integers
 * -1, -1, -2, and -2 are written as the values of the obsolete fields
 * {@code bitCount}, {@code bitLength}, {@code lowestSetBit}, and
 * {@code firstNonzeroByteNum}, respectively.  These values are compatible
 * with older implementations, but will be ignored by current
 * implementations.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    // set the values of the Serializable fields
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("signum", signum);
    fields.put("magnitude", magSerializedForm());
    // The values written for cached fields are compatible with older
    // versions, but are ignored in readObject so don't otherwise matter.
    fields.put("bitCount", -1);
    fields.put("bitLength", -1);
    fields.put("lowestSetBit", -2);
    fields.put("firstNonzeroByteNum", -2);

    // save them
    s.writeFields();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:BigInteger.java

示例9: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes a {@link ModelMBeanNotificationInfo} to an
 * {@link ObjectOutputStream}.
 **/
private void writeObject(ObjectOutputStream out)
    throws IOException {
    if (compat) {
        // Serializes this instance in the old serial form
        //
        ObjectOutputStream.PutField fields = out.putFields();
        fields.put("notificationDescriptor", notificationDescriptor);
        fields.put("currClass", currClass);
        out.writeFields();
    } else {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:ModelMBeanNotificationInfo.java

示例10: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Writes serializable fields to stream.
 */
private void writeObject(ObjectOutputStream s)
    throws IOException
{
    Hashtable<String, Component> tab = new Hashtable<>();
    int ncomponents = vector.size();
    for (int i = 0; i < ncomponents; i++) {
        Card card = vector.get(i);
        tab.put(card.name, card.comp);
    }

    ObjectOutputStream.PutField f = s.putFields();
    f.put("hgap", hgap);
    f.put("vgap", vgap);
    f.put("vector", vector);
    f.put("currentCard", currentCard);
    f.put("tab", tab);
    s.writeFields();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:22,代码来源:CardLayout.java

示例11: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes a {@link NumericValueExp} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("doubleVal", doubleValue());
    fields.put("longVal", longValue());
    fields.put("valIsLong", isLong());
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:NumericValueExp.java

示例12: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * Serializes a {@link RelationTypeSupport} to an {@link ObjectOutputStream}.
 */
private void writeObject(ObjectOutputStream out)
        throws IOException {
  if (compat)
  {
    // Serializes this instance in the old serial form
    //
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("myTypeName", typeName);
    fields.put("myRoleName2InfoMap", roleName2InfoMap);
    fields.put("myIsInRelServFlg", isInRelationService);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:RelationTypeSupport.java

示例13: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * @serialData Null terminated list of <code>VetoableChangeListeners</code>.
 * <p>
 * At serialization time we skip non-serializable listeners and
 * only serialize the serializable listeners.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String, VetoableChangeSupport> children = null;
    VetoableChangeListener[] listeners = null;
    synchronized (this.map) {
        for (Entry<String, VetoableChangeListener[]> entry : this.map.getEntries()) {
            String property = entry.getKey();
            if (property == null) {
                listeners = entry.getValue();
            } else {
                if (children == null) {
                    children = new Hashtable<>();
                }
                VetoableChangeSupport vcs = new VetoableChangeSupport(this.source);
                vcs.map.set(null, entry.getValue());
                children.put(property, vcs);
            }
        }
    }
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("children", children);
    fields.put("source", this.source);
    fields.put("vetoableChangeSupportSerializedDataVersion", 2);
    s.writeFields();

    if (listeners != null) {
        for (VetoableChangeListener l : listeners) {
            if (l instanceof Serializable) {
                s.writeObject(l);
            }
        }
    }
    s.writeObject(null);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:VetoableChangeSupport.java

示例14: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * writeObject is called to save the state of the {@code BatchUpdateException}
 * to a stream.
 */
private void writeObject(ObjectOutputStream s)
        throws IOException, ClassNotFoundException {

    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("updateCounts", updateCounts);
    fields.put("longUpdateCounts", longUpdateCounts);
    s.writeFields();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:BatchUpdateException.java

示例15: writeObject

import java.io.ObjectOutputStream; //导入方法依赖的package包/类
/**
 * @serialData Null terminated list of <code>PropertyChangeListeners</code>.
 * <p>
 * At serialization time we skip non-serializable listeners and
 * only serialize the serializable listeners.
 */
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String, PropertyChangeSupport> children = null;
    PropertyChangeListener[] listeners = null;
    synchronized (this.map) {
        for (Entry<String, PropertyChangeListener[]> entry : this.map.getEntries()) {
            String property = entry.getKey();
            if (property == null) {
                listeners = entry.getValue();
            } else {
                if (children == null) {
                    children = new Hashtable<>();
                }
                PropertyChangeSupport pcs = new PropertyChangeSupport(this.source);
                pcs.map.set(null, entry.getValue());
                children.put(property, pcs);
            }
        }
    }
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("children", children);
    fields.put("source", this.source);
    fields.put("propertyChangeSupportSerializedDataVersion", 2);
    s.writeFields();

    if (listeners != null) {
        for (PropertyChangeListener l : listeners) {
            if (l instanceof Serializable) {
                s.writeObject(l);
            }
        }
    }
    s.writeObject(null);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:40,代码来源:PropertyChangeSupport.java


注:本文中的java.io.ObjectOutputStream.PutField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。