Here you can find the source of readers(String path)
public static String[] readers(String path) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.Reader; import java.io.Writer; import java.net.ServerSocket; import java.net.Socket; import java.nio.channels.Channel; import java.util.ArrayList; import java.util.List; public class Main { public static String[] readers(String path) throws IOException { FileReader fileReader = new FileReader(path); BufferedReader fr = new BufferedReader(fileReader); String line = null;/*from w ww . j ava2s . c o m*/ List<String> list = new ArrayList<>(); while (null != (line = fr.readLine())) { list.add(line); } close(fileReader); return list.toArray(new String[] {}); } public static void close(InputStream in) { if (null != in) { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void close(Socket socket) { if (null != socket) { if (!socket.isClosed()) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static void close(ServerSocket socket) { if (null != socket) { if (!socket.isClosed()) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static void close(OutputStream out) { if (null != out) { try { out.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void close(Reader reader) { if (null != reader) { try { reader.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void close(Writer writer) { if (null != writer) { try { writer.close(); } catch (IOException e) { e.printStackTrace(); } } } public static void close(Channel channel) { if (null != channel) { if (channel.isOpen()) { try { channel.close(); } catch (IOException e) { e.printStackTrace(); } } } } }