Java Path File Content writeStringToFile(String content, Path targetPath)

Here you can find the source of writeStringToFile(String content, Path targetPath)

Description

write String To File

License

Apache License

Declaration

public static Path writeStringToFile(String content, Path targetPath) throws IOException 

Method Source Code


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

import java.io.IOException;

import java.nio.file.Files;
import java.nio.file.Path;

import java.nio.file.StandardOpenOption;

public class Main {
    public static Path writeStringToFile(String content, Path targetPath) throws IOException {
        return Files.write(targetPath, content.getBytes(), StandardOpenOption.CREATE_NEW);
    }//from w w w .ja v a2  s  . c om
}

Related

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