com.bumptech.glide.load
Interface Encoder<T>

Type Parameters:
T - The type of the data that will be written.
All Known Subinterfaces:
ResourceEncoder<T>
All Known Implementing Classes:
BitmapEncoder, GifBitmapWrapperResourceEncoder, GifResourceEncoder, ImageVideoWrapperEncoder, NullEncoder, NullResourceEncoder, StreamEncoder

public interface Encoder<T>

An interface for writing data to some persistent data store (i.e. a local File cache).


Method Summary
 boolean encode(T 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.
 

Method Detail

encode

boolean encode(T data,
               OutputStream os)
Writes the given data to the given output stream and returns True if the write completed successfully and should be committed.

Parameters:
data - The data to write.
os - The OutputStream to write the data to.

getId

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.

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.