Read all lines with BufferedReader
One line of code using Java 8: line = buffer.lines().collect(Collectors.joining());
One line of code using Java 8: line = buffer.lines().collect(Collectors.joining());
BufferedReader is a wrapper for both “InputStreamReader/FileReader”, which buffers the information each time a native I/O is called. You can imagine the efficiency difference with reading a character(or bytes) vis-a-vis reading a large no. of characters in one go(or bytes). With BufferedReader, if you wish to read single character, it will store the contents to … Read more