public static void writeText(Path path, String content, Charset charset) {
    try (BufferedWriter writer = Files.newBufferedWriter(path, charset)) {
      writer.write(content);
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
Returns the text read from the given stream as a String.
Closes the given stream upon return.
spock-core/src/main/java/org/spockframework/util/IoUtil.java