@ Override @ SuppressWarnings ( "unchecked" ) public void deserialize ( byte [ ] serializedData , boolean wipe ) throws IOException { if ( wipe ) { map . clear ( ) ; } InputStream in = new ByteArrayInputStream ( serializedData ) ; ObjectInputStream ois = new ClassResolverObjectInputStream ( in ) ; try { // Because it may be a map of maps, we want to UPDATE inner maps, not overwrite for ( Map . Entry < String , ? extends Serializable > e : ( ( Map < String , ? extends Serializable > ) ois . readObject ( ) ) . entrySet ( ) ) { if ( e . getValue ( ) instanceof Map && map . get ( e . getKey ( ) ) instanceof Map ) { ( ( Map ) map . get ( e . getKey ( ) ) ) . putAll ( ( Map ) e . getValue ( ) ) ; } else { put ( e . getKey ( ) , e . getValue ( ) ) ; } } } catch ( ClassNotFoundException ex ) { throw new IllegalStateException ( "Unable to decompress SerializableHashMap" , ex ) ; } }
This deserializes only the data as opposed to the whole object .