blob: 89f5260cce1a8c494d3505c509b861e3a50e985f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package org.fox.ttcomics2.utils;
import android.content.Context;
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
public class ByteArrayImageDownloader extends BaseImageDownloader {
private static final String SCHEME_STREAM = "stream";
private static final String STREAM_URI_PREFIX = SCHEME_STREAM + "://";
public ByteArrayImageDownloader(Context context) {
super(context);
}
@Override
protected InputStream getStreamFromOtherSource(String imageUri, Object extra) throws IOException {
if (imageUri.startsWith(STREAM_URI_PREFIX)) {
InputStream is = new ByteArrayInputStream((byte[])extra);
return is;
} else {
return super.getStreamFromOtherSource(imageUri, extra);
}
}
}
|