String serializer/deserializer in java