@Override public Map readObject(ObjectInput input) throws IOException, ClassNotFoundException { int magicNumber = input.readUnsignedByte(); Map subject = null; switch (magicNumber) { case HASHMAP: subject = new HashMap(); break; case TREEMAP: subject = new TreeMap(); break; case FASTCOPYHASHMAP: subject = new FastCopyHashMap(); break; } MarshallUtil.unmarshallMap(subject, input); return subject; }
@Override public void writeObject(ObjectOutput output, Map map) throws IOException { int number = numbers.get(map.getClass(), -1); output.write(number); MarshallUtil.marshallMap(map, output); }