com.bumptech.glide.load.model
Class ImageVideoWrapperEncoder

java.lang.Object
  extended by com.bumptech.glide.load.model.ImageVideoWrapperEncoder
All Implemented Interfaces:
Encoder<ImageVideoWrapper>

public class ImageVideoWrapperEncoder
extends Object
implements Encoder<ImageVideoWrapper>

A source encoder that writes a ImageVideoWrapper to disk by preferentially writing data from the wrapper's InputStream and falling back to the wrapper's ParcelFileDescriptor if the InputStream isn't available.


Constructor Summary
ImageVideoWrapperEncoder(Encoder<InputStream> streamEncoder, Encoder<ParcelFileDescriptor> fileDescriptorEncoder)
           
 
Method Summary
 boolean encode(ImageVideoWrapper data, OutputStream os)
          Writes the given data to the given output stream and returns True if the write completed successfully and should be committed.
 String getId()
          Returns an ID identifying any transformation this encoder may apply to the given data that will be mixed in to the cache key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageVideoWrapperEncoder

public ImageVideoWrapperEncoder(Encoder<InputStream> streamEncoder,
                                Encoder<ParcelFileDescriptor> fileDescriptorEncoder)
Method Detail

encode

public boolean encode(ImageVideoWrapper data,
                      OutputStream os)
Description copied from interface: Encoder
Writes the given data to the given output stream and returns True if the write completed successfully and should be committed.

Specified by:
encode in interface Encoder<ImageVideoWrapper>
Parameters:
data - The data to write.
os - The OutputStream to write the data to.

getId

public String getId()
Description copied from interface: Encoder
Returns an ID identifying any transformation this encoder may apply to the given data that will be mixed in to the cache key.

If the encoder does not transform the data in a way that significantly affects the cached result (ie performs no unusual compression or downsampling) an empty string is an appropriate id.

Specified by:
getId in interface Encoder<ImageVideoWrapper>