The list of methods to do UTF File Write are organized into topic(s).
BufferedWriter
getBufferedUTF8Writer(File file) Creates a BufferedWriter for UTF-8-encoded files
return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8")));
Writer
getUTF8Writer(String file) get UTF Writer
return new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8));
Writer
utf8Writer(File file) Creates a writer whose character encoding is set to "UTF-8".
return utf8Writer(file, false);
Writer
utf8Writer(final File f) Creates a Writer that writes to the given file, converting chars to bytes using the UTF-8 charset.
return new OutputStreamWriter(new FileOutputStream(f), UTF8);
void
writeFile(byte[] data, String outfile) write File
FileOutputStream fout = null;
FileChannel fc = null;
try {
fout = new FileOutputStream(outfile);
fc = fout.getChannel();
fc.transferFrom(Channels.newChannel(new ByteArrayInputStream(data)), 0, data.length);
} catch (Exception e) {
e.printStackTrace();
...
boolean
writeFile(String fileName, ArrayList data, String outputFolder) write the contents of given data (list of lines) under given fileName in given outputFolder
try {
Path outputFile = Paths.get(outputFolder + File.separator + fileName);
createFoldersForPath(outputFile.toAbsolutePath().toString());
Files.write(outputFile, data, Charset.forName("UTF-8"));
return true;
} catch (IOException e) {
e.printStackTrace();
return false;
...