Java Path File Content writeFile(String path, String content)

Here you can find the source of writeFile(String path, String content)

Description

write File

License

Apache License

Declaration

@SuppressWarnings("unused")
    public static void writeFile(String path, String content) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
    @SuppressWarnings("unused")
    public static void writeFile(String path, String content) {
        try {//  ww w. j  av  a  2s  .  c o m
            Files.write(Paths.get(path), content.getBytes());
        } catch (IOException e) {
            throwRuntime(e);
        }
    }

    public static void throwRuntime(Exception e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

Related

  1. writeFile(Path file, String content)
  2. writeFile(Path filePath, String content)
  3. writeFile(Path path, String content)
  4. writeFile(Path path, String contents)
  5. writeFile(String path, String content)
  6. writeFile(String path, String contents)
  7. writeFileContents(Path to, byte[] contents)
  8. writeJsonToFile(Path jsonPath, String jsonContent)
  9. writeLines(Path base, String file, String[] content)