Does anyone know why when I do Printwriter.write("string") then do BufferedReader.readLine(), it hangs(I have a while(BufferedReader.ready()) check), but when I do PrintWriter.println("string") then BufferedReader.readLine() it works. Can someone explain to my why this is the case?
PrintWriter#write does NOT write a whole line, while PrintWriter#println does. In other words, using write('h') write('e') print('l') write('l') print('o') will return in "hello" (no line break). But println('h') println('e') println("llo") will return in "h e llo" As BufferedReader#readLine reads until a line break, it waits until you use println or write the line break yourself (write(System.lineSeperator) or similar)
Thanks for the explanation . My guess that readLine only reads something with a line break was right.