I have the following code situation:
A function which processes and returns a bitmap images from InputStream
everything is OK up here
private Bitmap loadBitmap(InputStrean is)
{
.....
.....
return BitmapFactory.decodeStream(is, null, o);
}
Before last statement I wanted to copy that stream
private Bitmap loadBitmap(InputStrean is)
{
.....
.....
CopyStream(is, os);
return BitmapFactory.decodeStream(is, null, o);
}
which resulted in the following error "SkImageDecoder::Factory returned null"
public static void CopyStream(InputStream is, OutputStream os)
{
final int buffer_size=1024;
try
{
byte[] bytes=new byte[buffer_size];
for(;;)
{
int count=is.read(bytes, 0, buffer_size);
if(count==-1)
break;
os.write(bytes, 0, count);
}
}
catch(Exception ex){}
}
InputStream does not change and yet ... he can be wrong ?