using FileReader instead of BufferedReader
Hi! i'm trying to write a code that can read a file without stopping when there's a line break. i've understood that i should use read() instead of readLine() but also that i should use FileReader instead of BufferedReader because "The major function of BufferedReader is to break the input into lines. " (copied from another thread here at sun).
Here's my problem, it doesn't work when i try to exchange BufferedReader for FileReader, anyone knows how to do it?
publicclass LearnLine{
public LearnLine(){}
publicstaticvoid main (String[] args){
String REGEX ="file with";
String INPUT;
try{
FileInputStream fstream =new FileInputStream("Test.txt");
// Get the object of DataInputStream
DataInputStream in =new DataInputStream(fstream);
BufferedReader br =new BufferedReader(new InputStreamReader(in));
while ((INPUT = br.readLine()) !=null){
Pattern p = Pattern.compile(REGEX);
Matcher m = p.matcher(INPUT);
while (m.find()){
System.out.println("found it");
}
}
}catch (Exception e){
System.out.println("heyheyhey");
e.printStackTrace();
}
}
}

