blob: a6368d26b7437c2dd06a5aeb008c0897fb805db6 [file] [log] [blame]
package com.bumptech.glide.load.resource.bytes;
import com.bumptech.glide.load.engine.Resource;
/**
* An {@link com.bumptech.glide.load.engine.Resource} wrapping a byte array.
*/
public class BytesResource implements Resource<byte[]> {
private final byte[] bytes;
public BytesResource(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("Bytes must not be null");
}
this.bytes = bytes;
}
@Override
public byte[] get() {
return bytes;
}
@Override
public int getSize() {
return bytes.length;
}
@Override
public void recycle() {
// Do nothing.
}
}