1

Android's new class for decode images, the ImageDecoder, has lots of source types. But not the createSource(InputStream) included. There is a similar method createSource(Resources res, InputStream is), but it is hidden(why?).

Now I want to use ImageDecoder to decode an InputStream, which is opened from a ZipFile.getInputStream() just like BitmapFactory.decodeStream does.

So:

  1. Why is the method hidden?
  2. Is there any alternative so I can use ImageDecoder with an InputStream? (Cause I don't want to use the old BitmapFactory)
landerlyoung
  • 1,693
  • 17
  • 14

1 Answers1

2

Why is the method hidden?

Google has stated that they do not want to support streams, though they did not elaborate on a reason.

Is there any alternative so I can use ImageDecoder with an InputStream?

Read the stream into memory, then use ByteBuffer, I guess.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Thanks for the link. Maybe I'll still use BitmapFactory... I don't really understand why Google don't want InputStream. – landerlyoung Jun 11 '19 at 12:39