java - FileReader vs FileInputReader. split vs Pattern -


I'm working with a file with approximately 2g file line by line to find some specific conditions I want to read Can I use lied classes better: FileReader or FileInputStream? And how can I find specific words efficiently? I'm just using the partition () method, but I can use the java.util.regex.Pattern class with the java.util.regex.matcher class.

So the questions are: Which class can I use: FileReader or FileInputStream? Can I use split method or regedx classes?

Do anyone have the answer to this question? Location

The best option would be to use BufferedReader readLine () method) by wrapping a FileInputStream (actually to read the file) by wrapping (for its ability to specify encoding): < / P>

  BufferedReader br = new BufferedReader (new InputStreamReader (new FileInputStream (name), encoding);  

Flemish uses platform default encoding, which is usually a bad idea, which mainly creates a network for developers Do not know about the problems being probable.

If you want to find substrings in bus lines, then String.indexOf () is the most effective way; It is better to use Regexes if you are actually looking for specific patterns.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -