SyntaxFix
Write A Post
Hire A Developer
Questions
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]