Gemalto is now part of the Thales Group, find out more.

You are here

Inputstream available method | Thales IoT Developer Community

July 26, 2016 - 12:04pm, 3952 views

Hi,

I'm using InputStream read() method to read comm connection data.

Since read() method blocks until a data received, it is not efficient way of reading.

I tried available method to prevent code blocking. It works fine as fas I see.

I wonder, how an InputStream knows amount of data ready to read. It is not written anywhere that InputStream has a buffer. Has it?

If there isn't a buffer in it, how it knows amount of coming data?

Thanks in advance.