Check return value of stream.read()

This resolves a warning where the return value of stream.read() is ignored,
which ultimately has no negative effect because the contents of the read data
is validated by checking for a specific value, but it could potentially fail
if the value is changed later to something that could be valid after a "bad"
read().

This change throws an exception if the return value is an error.

LBANDROID-9