Here you can find the source of readFileAsStringArray(File file)
public static String[] readFileAsStringArray(File file) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileInputStream; 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 String[] readFileAsStringArray(File file) throws IOException { return readFileAsString(file).split("\n"); }/*from w w w. ja v a2s.c o m*/ public static String readFileAsString(File file) throws IOException { return new String(readFileAsByteArray(file), _charset); } public static byte[] readFileAsByteArray(File file) throws IOException { ByteBuffer bb; FileChannel fc = null; try { fc = new FileInputStream(file).getChannel(); bb = ByteBuffer.allocate((int) fc.size()); fc.read(bb); } finally { if (fc != null) fc.close(); } return bb.array(); } }