read() will not give significant performance differences.
Read more: Comparison with Peter Lawery read () and readLine ()
Now back to your original question:
Input line: hello how are you?
Therefore, you need to index the words of the string, i.e.:
BufferedReader r = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = r.readLine()) != null) { String[] splitString = line.split("\\s+");
Note. The sample \\s+ will put the delimiter on the line like any spaces, such as tab, space, etc.
zengr source share