The documentation says that one should not use available() method to determine the size of an InputStream. How can I read the whole content of an <
available()
InputStream
You can read it by chunks (byte buffer[] = new byte[2048]) and write the chunks to a ByteArrayOutputStream. From the ByteArrayOutputStream you can retrieve the contents as a byte[], without needing to determine its size beforehand.
byte buffer[] = new byte[2048]