當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectOutputStream.putFields方法代碼示例

本文整理匯總了Java中java.io.ObjectOutputStream.putFields方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectOutputStream.putFields方法的具體用法?Java ObjectOutputStream.putFields怎麽用?Java ObjectOutputStream.putFields使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.io.ObjectOutputStream的用法示例。


在下文中一共展示了ObjectOutputStream.putFields方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link ModelMBeanConstructorInfo} 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("consDescriptor", consDescriptor);
    fields.put("currClass", currClass);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:ModelMBeanConstructorInfo.java

示例2: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes an {@link XMLParseException} 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("msgStr", getMessage());
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:21,代碼來源:XMLParseException.java

示例3: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link ModelMBeanOperationInfo} 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("operationDescriptor", operationDescriptor);
    fields.put("currClass", currClass);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:ModelMBeanOperationInfo.java

示例4: 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:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:ModelMBeanNotificationInfo.java

示例5: 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:SunburstApps,項目名稱:OpenJSharp,代碼行數:24,代碼來源:BigInteger.java

示例6: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream out) throws IOException {
    ObjectOutputStream.PutField fields = out.putFields();
    fields.put("z", z);
    fields.put("b", b);
    fields.put("c", c);
    fields.put("s", s);
    fields.put("i", i);
    fields.put("f", f);
    fields.put("j", j);
    fields.put("d", d);
    fields.put("str", str);
    fields.put("parent", parent);
    fields.put("left", left);
    fields.put("right", right);
    out.writeFields();
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:17,代碼來源:GetPutFieldTrees.java

示例7: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * @serialData "permissions" field (a Vector containing the DelegationPermissions).
 */
/*
 * Writes the contents of the perms field out as a Vector for
 * serialization compatibility with earlier releases.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Write out Vector
    Vector<Permission> permissions = new Vector<>(perms.size());

    synchronized (this) {
        permissions.addAll(perms);
    }

    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("permissions", permissions);
    out.writeFields();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:DelegationPermission.java

示例8: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * @serialData Default fields.
 */
/*
 * Writes the contents of the perms field out as a Hashtable for
 * serialization compatibility with earlier releases. all_allowed
 * unchanged.
 */
private void writeObject(ObjectOutputStream out) throws IOException {
    // Don't call out.defaultWriteObject()

    // Copy perms into a Hashtable
    Hashtable<String, Permission> permissions =
        new Hashtable<>(perms.size()*2);
    permissions.putAll(perms);

    // Write out serializable fields
    ObjectOutputStream.PutField pfields = out.putFields();
    pfields.put("all_allowed", all_allowed);
    pfields.put("permissions", permissions);
    out.writeFields();
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:23,代碼來源:PropertyPermission.java

示例9: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link Role} 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("myName", name);
    fields.put("myObjNameList", objectNameList);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:22,代碼來源:Role.java

示例10: 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:SunburstApps,項目名稱:OpenJSharp,代碼行數:22,代碼來源:MBeanServerNotificationFilter.java

示例11: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link ModelMBeanInfoSupport} 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("modelMBeanDescriptor", modelMBeanDescriptor);
        fields.put("mmbAttributes", modelMBeanAttributes);
        fields.put("mmbConstructors", modelMBeanConstructors);
        fields.put("mmbNotifications", modelMBeanNotifications);
        fields.put("mmbOperations", modelMBeanOperations);
        fields.put("currClass", currClass);
        out.writeFields();
    } else {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:23,代碼來源:ModelMBeanInfoSupport.java

示例12: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link RoleResult} 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("myRoleList", roleList);
    fields.put("myRoleUnresList", unresolvedRoleList);
    out.writeFields();
  }
  else
  {
    // Serializes this instance in the new serial form
    //
    out.defaultWriteObject();
  }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:RoleResult.java

示例13: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
/**
 * Serializes a {@link Notification} 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("type", type);
        fields.put("sequenceNumber", sequenceNumber);
        fields.put("timeStamp", timeStamp);
        fields.put("userData", userData);
        fields.put("message", message);
        fields.put("source", source);
        out.writeFields();
    } else {
        // Serializes this instance in the new serial form
        //
        out.defaultWriteObject();
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:23,代碼來源:Notification.java

示例14: 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:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:40,代碼來源:VetoableChangeSupport.java

示例15: writeObject

import java.io.ObjectOutputStream; //導入方法依賴的package包/類
private void writeObject(ObjectOutputStream s) throws IOException {
    Hashtable<String,PermissionCollection> permTable =
            new Hashtable<>(perms);
    ObjectOutputStream.PutField fields = s.putFields();
    fields.put("perms", permTable);
    s.writeFields();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:8,代碼來源:CryptoPermissions.java


注:本文中的java.io.ObjectOutputStream.putFields方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。