I'm trying to determine the best way to transfer data through a socket between a client and server. Currently I have a BufferedReader that reads one character at a time (or however many characters have arrived since the last iteration). Through each iteration, it pulls the data received so far and puts it into an array. When the '|' character is read, it knows that the current instruction is done.
I know what I have so far is grossly inefficient and burns the CPU, but I'm a little unclear as to the differences between all the ways to read from a socket input stream. What would I use to not have to read each character at a time, but rather to wait until the input stream is finished receiving the current instruction (which would be terminated by "\n")?