I am writing a server application in Java. To read from the socket i have:
line = in.readLine();
where in is a BufferReader instance so i can read strings from the socket stream.
How can i change that to adopt my program to a non line-oriented protocol, where the end of each application-level message is supposded to be terminated by a special charachter, e.g. %, and not a newline charachter?
Use the
read()method in a loop until the character is%. At each character, append it to aStringBuilder.