Here you can find the source of getFileContents(String path)
static Vector<String> getFileContents(String path)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.InputStreamReader; import java.util.Vector; public class Main { static Vector<String> getFileContents(String path) { Vector<String> words = new Vector<String>(); try {//from w w w . j av a2 s. c om FileInputStream fstream = new FileInputStream(path); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { words.add(strLine); } in.close(); } catch (Exception e) { System.err.println("Error: " + e.getMessage()); return new Vector<String>(); } return (words); } }