package com.zinc.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class textUtil {

public static String[] parser(String filepath) {
String [] wordCensor = {};
String encoding="UTF-8";
// filepath = "E://keywords.txt";
File filein=new File(filepath);
String content="";
if(filein.exists()){
BufferedReader bufferedReader;
try {
InputStreamReader read = new InputStreamReader (new FileInputStream(filein),encoding);
bufferedReader = new BufferedReader(read);
String c=bufferedReader.readLine();
while(c!=null){
content+=c;
c=bufferedReader.readLine();
}
bufferedReader.close();
// System.out.println(content);
wordCensor = content.split(",");
// for(int i=0; i<wordCensor.length; i++){
// System.out.println(i + " " + wordCensor[i]);
// }
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
return wordCensor;
}

public static void main(String[] args) {
textUtil.parser("E://keywords.txt");
}
}