Java 类com.bumptech.glide.util.ByteArrayPool 实例源码

项目:GlidePlus    文件:ImageWrapperResourceDecoder.java   
@SuppressWarnings("resource")
// @see ResourceDecoder.decode
@Override
public Resource<ImageWrapper> decode(ImageVideoWrapper source, int width, int height) throws IOException {
    ByteArrayPool pool = ByteArrayPool.get();
    byte[] tempBytes = pool.getBytes();

    ImageWrapper wrapper = null;
    try {
        wrapper = decode(source, width, height, tempBytes);
    } finally {
        pool.releaseBytes(tempBytes);
    }
    return wrapper != null ? new ImageWrapperResource(wrapper) : null;
}