Here you can find the source of writeFileAsStringArray(File file, String[] par2DataArray)
public static void writeFileAsStringArray(File file, String[] par2DataArray) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; import java.nio.charset.Charset; public class Main { private static Charset _charset = Charset.defaultCharset(); public static void writeFileAsStringArray(File file, String[] par2DataArray) throws IOException { StringBuilder sb = new StringBuilder(); for (String t : par2DataArray) { sb.append(t);/* w w w. j ava2 s . c o m*/ } writeFileAsString(file, sb.toString()); } public static void writeFileAsString(File file, String par2Data) throws IOException { writeFileAsByteArray(file, par2Data.getBytes(_charset)); } public static void writeFileAsByteArray(File file, byte[] par2Data) throws IOException { ByteBuffer bb; FileChannel fc = null; try { fc = new FileOutputStream(file).getChannel(); bb = ByteBuffer.wrap(par2Data); fc.write(bb); } finally { if (fc != null) fc.close(); } } }