aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/print/attribute/HashAttributeSet.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2006-03-10 21:46:48 +0000
committerMark Wielaard <mark@gcc.gnu.org>2006-03-10 21:46:48 +0000
commit8aa540d2f783474d1d2e06f16744bf67b9c1facc (patch)
treeea38c56431c5d4528fb54254c3f8e50f517bede3 /libjava/classpath/javax/print/attribute/HashAttributeSet.java
parent27079765d00123f8e53d0e1ef7f9d46559266e6d (diff)
downloadgcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.zip
gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.gz
gcc-8aa540d2f783474d1d2e06f16744bf67b9c1facc.tar.bz2
Imported GNU Classpath 0.90
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. From-SVN: r111942
Diffstat (limited to 'libjava/classpath/javax/print/attribute/HashAttributeSet.java')
-rw-r--r--libjava/classpath/javax/print/attribute/HashAttributeSet.java37
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 0db81ba..65371ea 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());
+ }
}