I would like to obtain the byte array of a JPEG image without using the following method:
bitmap = BitmapFactory.decodeFile("/sdcard/photo.jpg");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(CompressFormat.JPEG, 50, baos);
byte[] data = baos.toByteArray();
Is there anyway to do this?
Any reason not to just load the file itself as a normal
FileInputStreametc? (Personally I like Guava’sFiles.toByteArray()as a simple way of loading a file, but I don’t know the status of Guava on Android.)