public @Nullable EncodedImage cloneOrNull() {
    EncodedImage encodedImage;
    if (mInputStreamSupplier != null) {
      encodedImage = new EncodedImage(mInputStreamSupplier, mStreamSize);
    } else {
      CloseableReference<PooledByteBuffer> pooledByteBufferRef =
          CloseableReference.cloneOrNull(mPooledByteBufferRef);
      try {
        encodedImage = (pooledByteBufferRef == null) ? null : new EncodedImage(pooledByteBufferRef);
      } finally {
        // Close the recently created reference since it will be cloned again in the constructor.
        CloseableReference.closeSafely(pooledByteBufferRef);
      }
    }
    if (encodedImage != null) {
      encodedImage.copyMetaDataFrom(this);
    }
    return encodedImage;
  }
Returns the cloned encoded image if the parameter received is not null, null otherwise.

@param encodedImage the EncodedImage to clone
imagepipeline-base/src/main/java/com/facebook/imagepipeline/image/EncodedImage.java