Reading from BufferedReader (readLine) returns null?

I am currently trying to read Stringfrom BufferedReader, but cannot find a way to do this ...

Of course I tried

BufferedReader inStream = null;
inStream = new BufferedReader(new InputStreamReader(client.getInputStream()));
String test = inStream.readLine();

However, the result is zero when trying to print to the screen, even if it BufferedReader inStreamis equal to some message.

+3
source share
1 answer

Based on the documentation , BufferedReader.readLine()returns nullonly when the end of the stream is reached. This means that if the first call readLine()returns null, there was nothing in the input stream.

+10
source

All Articles