@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()); }
@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()); }
@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()); }
@Override public Resource<byte[]> transcode(Resource<GifDrawable> toTranscode) { GifDrawable gifData = toTranscode.get(); ByteBuffer byteBuffer = gifData.getBuffer(); return new BytesResource(ByteBufferUtil.toBytes(byteBuffer)); }
@Override public Resource<byte[]> transcode(Resource<GifDrawable> toTranscode, Options options) { GifDrawable gifData = toTranscode.get(); ByteBuffer byteBuffer = gifData.getBuffer(); return new BytesResource(ByteBufferUtil.toBytes(byteBuffer)); }
@Override public Resource<byte[]> decode(InputStream source, int width, int height) throws IOException { return new BytesResource(inputStreamToBytes(source)); }