Read lines from file, calling a consumer function for each line
You are conflating bytes with characters.  An InputStream produces bytes, but you implicitly interpret each byte as a character when you do character=stream.read() followed by the cast lineBuild.append((char)character).  To be clear:


Strings consist of chars, not bytes.
InputStreams and OutputStreams deal with bytes.
Readers and Writers deal with characters.


To read lines as strings, first convert stream to a Reader using InputStreamReader.

BufferedReader br = new BufferedReader(new InputStreamReader(stream, "ISO-8859-1"));


Then, BufferedReader offers a .readLine() method.  Or, since you seem to be interested in a stream-based approach, call .lines(), which produces a Stream&lt;String&gt;.