I have a FileInputStream created using Context.openFileInput(). I now want to convert the file into a byte array.
Context.openFileInput()
Unfortunately, I can\'t determine the
You can pre-allocate the byte array using
int size = context.getFileStreamPath(filename).length();
This way, you will avoid allocating memory chunks every time your ByteArrayOutputStream fills up.
ByteArrayOutputStream