本文整理汇总了Java中com.bumptech.glide.load.model.ImageVideoWrapper.getStream方法的典型用法代码示例。如果您正苦于以下问题:Java ImageVideoWrapper.getStream方法的具体用法?Java ImageVideoWrapper.getStream怎么用?Java ImageVideoWrapper.getStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.bumptech.glide.load.model.ImageVideoWrapper
的用法示例。
在下文中一共展示了ImageVideoWrapper.getStream方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decode
import com.bumptech.glide.load.model.ImageVideoWrapper; //导入方法依赖的package包/类
@Override
public Resource<Bitmap> decode(ImageVideoWrapper source, int width, int height) throws IOException {
Resource<Bitmap> result = null;
InputStream is = source.getStream();
if (is != null) {
try {
result = streamDecoder.decode(source.getStream(), width, height);
} catch (IOException e) {
if (Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, "Failed to load image from stream, trying FileDescriptor", e);
}
}
}
if (result == null) {
result = fileDescriptorDecoder.decode(source.getFileDescriptor(), width, height);
}
return result;
}
示例2: decode
import com.bumptech.glide.load.model.ImageVideoWrapper; //导入方法依赖的package包/类
@Override
public Resource<GifBitmapWrapper> decode(ImageVideoWrapper imageVideoWrapper, int i, int i1) throws IOException {
InputStream inputStream = imageVideoWrapper.getStream();
StringBuffer sb = new StringBuffer();
byte[] b = new byte[4096];
boolean findData = false;
for (int n; (n = inputStream.read(b)) != -1; ) {
String data = new String(b, 0, n);
sb.append(data);
if (findData == false && sb.length() > "data:image/jpeg;base64,".length()) {
findData = true;
int index = sb.indexOf(",");
sb = sb.delete(0, index + 1);
}
}
String result = sb.toString();
Bitmap bmp = convertBitmap(result);
if (bmp == null) {
return null;
}
setPhotoData(bmp);
return getGifBitmapWrapperResource();
}
示例3: decode
import com.bumptech.glide.load.model.ImageVideoWrapper; //导入方法依赖的package包/类
private ImageWrapper decode(ImageVideoWrapper source, int width, int height, byte[] bytes) throws IOException {
final ImageWrapper result;
if (source.getStream() != null) {
result = decodeStream(source, width, height, bytes);
} else {
result = decodeBitmapWrapper(source, width, height);
}
return result;
}