code: public static void writeObjectToFileOrDie(@Nonnull final Object obj, @Nonnull final String file) throws IOException {
          writeObjectToFileOrDie(obj, file, LOGGER);
      }
docs: Serializes an object to a file, throws an exception if it fails
  
  @param obj object to write to a file
  @param file path to save the object to
  @throws java.io.IOException if the existing file could not be erased, or the file could not be written, flushed, synced, or closed