本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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();
}