diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-03-10 21:46:48 +0000 |
commit | ce57ab760f69de6db452def7ffbf5b114a2d8694 (patch) | |
tree | ea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/javax/print/attribute/HashAttributeSet.java | |
parent | 50996fe55769882de3f410896032c887f0ff0d04 (diff) | |
download | ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.tar.gz ppe42-gcc-ce57ab760f69de6db452def7ffbf5b114a2d8694.zip |
Imported GNU Classpath 0.90
* scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore.
* gnu/classpath/jdwp/VMFrame.java (SIZE): New constant.
* java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5.
* java/lang/Math.java: New override file.
* java/lang/Character.java: Merged from Classpath.
(start, end): Now 'int's.
(canonicalName): New field.
(CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants.
(UnicodeBlock): Added argument.
(of): New overload.
(forName): New method.
Updated unicode blocks.
(sets): Updated.
* sources.am: Regenerated.
* Makefile.in: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/javax/print/attribute/HashAttributeSet.java')
-rw-r--r-- | libjava/classpath/javax/print/attribute/HashAttributeSet.java | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/libjava/classpath/javax/print/attribute/HashAttributeSet.java b/libjava/classpath/javax/print/attribute/HashAttributeSet.java index 0db81bae540..65371ea9fa2 100644 --- a/libjava/classpath/javax/print/attribute/HashAttributeSet.java +++ b/libjava/classpath/javax/print/attribute/HashAttributeSet.java @@ -1,5 +1,5 @@ /* HashAttributeSet.java -- - Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,9 @@ exception statement from your version. */ package javax.print.attribute; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.HashMap; import java.util.Iterator; @@ -49,8 +52,8 @@ public class HashAttributeSet implements AttributeSet, Serializable { private static final long serialVersionUID = 5311560590283707917L; - private Class interfaceName; - private HashMap attributeMap = new HashMap(); + private Class myInterface; + private transient HashMap attributeMap = new HashMap(); /** * Creates an empty <code>HashAttributeSet</code> object. @@ -112,7 +115,7 @@ public class HashAttributeSet implements AttributeSet, Serializable if (interfaceName == null) throw new NullPointerException("interfaceName may not be null"); - this.interfaceName = interfaceName; + myInterface = interfaceName; } /** @@ -192,7 +195,7 @@ public class HashAttributeSet implements AttributeSet, Serializable */ public boolean add(Attribute attribute) { - return addInternal(attribute, interfaceName); + return addInternal(attribute, myInterface); } private boolean addInternal(Attribute attribute, Class interfaceName) @@ -201,7 +204,7 @@ public class HashAttributeSet implements AttributeSet, Serializable throw new NullPointerException("attribute may not be null"); AttributeSetUtilities.verifyAttributeCategory(interfaceName, - this.interfaceName); + myInterface); Object old = attributeMap.put (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue @@ -220,7 +223,7 @@ public class HashAttributeSet implements AttributeSet, Serializable */ public boolean addAll(AttributeSet attributes) { - return addAllInternal(attributes, interfaceName); + return addAllInternal(attributes, myInterface); } private boolean addAllInternal(AttributeSet attributes, Class interfaceName) @@ -393,4 +396,24 @@ public class HashAttributeSet implements AttributeSet, Serializable return array; } + + // Implemented as specified in serialized form + private void readObject(ObjectInputStream s) + throws ClassNotFoundException, IOException + { + myInterface = (Class) s.readObject(); + int size = s.readInt(); + attributeMap = new HashMap(size); + for (int i=0; i < size; i++) + add((Attribute) s.readObject()); + } + + private void writeObject(ObjectOutputStream s) throws IOException + { + s.writeObject(myInterface); + s.writeInt(size()); + Iterator it = attributeMap.values().iterator(); + while (it.hasNext()) + s.writeObject(it.next()); + } } |