I found that this code is repeated many times along the method:
entry.getKey().serialize( oos ); oos.writeObject( entry.getValue() );
I think it would be a good idea extract it in a method.