public static void writeToFile(String data, String file, DDLOperationContext context) throws IOException {
    if (StringUtils.isEmpty(data)) {
      return;
    }

    Path resFile = new Path(file);
    FileSystem fs = resFile.getFileSystem(context.getConf());
    try (FSDataOutputStream out = fs.create(resFile);
         OutputStreamWriter writer = new OutputStreamWriter(out, StandardCharsets.UTF_8)) {
      writer.write(data);
      writer.write((char) Utilities.newLineCode);
      writer.flush();
    }
  }
Creates a String from the properties in this format:
   'property_name1'='property_value1',
   'property_name2'='property_value2',
   ...

Properties are listed in alphabetical order.

@param properties The properties to list.
@param exclude Property names to exclude.
ql/src/java/org/apache/hadoop/hive/ql/ddl/ShowUtils.java