Java 类com.bumptech.glide.load.resource.bytes.BytesResource 实例源码

项目:GitHub    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
  ByteArrayOutputStream os = new ByteArrayOutputStream();
  toTranscode.get().compress(compressFormat, quality, os);
  toTranscode.recycle();
  return new BytesResource(os.toByteArray());
}
项目:GitHub    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode, Options options) {
  ByteArrayOutputStream os = new ByteArrayOutputStream();
  toTranscode.get().compress(compressFormat, quality, os);
  toTranscode.recycle();
  return new BytesResource(os.toByteArray());
}
项目:Gallery    文件:StreamByteArrayResourceDecoder.java   
@Override
public Resource<byte[]> decode(InputStream in, int width, int height) throws
        IOException {
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int count;
    while ((count = in.read(buffer)) != -1) {
        bytes.write(buffer, 0, count);
    }
    return new BytesResource(bytes.toByteArray());
}
项目:MoeGallery    文件:StreamByteArrayResourceDecoder.java   
@Override
public Resource<byte[]> decode(InputStream in, int width, int height) throws
        IOException {
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int count;
    while ((count = in.read(buffer)) != -1) {
        bytes.write(buffer, 0, count);
    }
    return new BytesResource(bytes.toByteArray());
}
项目:saarang-iosched    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    toTranscode.get().compress(compressFormat, quality, os);
    toTranscode.recycle();
    return new BytesResource(os.toByteArray());
}
项目:AppDevFestSudeste2015    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    toTranscode.get().compress(compressFormat, quality, os);
    toTranscode.recycle();
    return new BytesResource(os.toByteArray());
}
项目:devfestnorte-app    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    toTranscode.get().compress(compressFormat, quality, os);
    toTranscode.recycle();
    return new BytesResource(os.toByteArray());
}
项目:saarang-iosched    文件:BitmapBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<Bitmap> toTranscode) {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    toTranscode.get().compress(compressFormat, quality, os);
    toTranscode.recycle();
    return new BytesResource(os.toByteArray());
}
项目:GitHub    文件:GifDrawableBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<GifDrawable> toTranscode) {
  GifDrawable gifData = toTranscode.get();
  ByteBuffer byteBuffer = gifData.getBuffer();
  return new BytesResource(ByteBufferUtil.toBytes(byteBuffer));
}
项目:GitHub    文件:GifDrawableBytesTranscoder.java   
@Override
public Resource<byte[]> transcode(Resource<GifDrawable> toTranscode, Options options) {
  GifDrawable gifData = toTranscode.get();
  ByteBuffer byteBuffer = gifData.getBuffer();
  return new BytesResource(ByteBufferUtil.toBytes(byteBuffer));
}
项目:GlidePlus    文件:StreamByteArrayResourceDecoder.java   
@Override
public Resource<byte[]> decode(InputStream source, int width, int height) throws IOException {
    return new BytesResource(inputStreamToBytes(source));
}