1package com.bumptech.glide.load.resource.transcode;
2
3import com.bumptech.glide.load.engine.Resource;
4import com.bumptech.glide.load.resource.bytes.BytesResource;
5import com.bumptech.glide.load.resource.gif.GifDrawable;
6
7/**
8 * An {@link com.bumptech.glide.load.resource.transcode.ResourceTranscoder} that converts
9 * {@link com.bumptech.glide.load.resource.gif.GifDrawable} into bytes by obtaining the original bytes of the GIF from
10 * the {@link com.bumptech.glide.load.resource.gif.GifDrawable}.
11 */
12public class GifDrawableBytesTranscoder implements ResourceTranscoder<GifDrawable, byte[]> {
13    @Override
14    public Resource<byte[]> transcode(Resource<GifDrawable> toTranscode) {
15        GifDrawable gifData = toTranscode.get();
16        return new BytesResource(gifData.getData());
17    }
18
19    @Override
20    public String getId() {
21        return "GifDrawableBytesTranscoder.com.bumptech.glide.load.resource.transcode";
22    }
23}
24