[Solved] java code to split text file into chunks based on chunk size

That’s because BufferedReader.readLine() reads only a line not the whole file. I assume that the line break characters \r and \n are not part of the normal content you interested in. Maybe that helps. // … StringBuilder sb = new StringBuilder(); String line; while ((line = inputStream.readLine()) != null) { sb.append(line); // if enough content … Read more