Class NullEncoder<T>

  • Type Parameters:
    T - type discarded by this Encoder
    All Implemented Interfaces:
    Encoder<T>


    public class NullEncoder<T>
    extends Object
    implements Encoder<T>
    A simple Encoder that never writes data.
    • Constructor Summary

      Constructors

      Constructor and Description
      NullEncoder()
       
    • Method Summary

      Modifier and Type Method and Description
      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.
      static <T> Encoder<T> get()
      Returns an Encoder for the given data type.
      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.
    • Constructor Detail

      • NullEncoder

        public NullEncoder()
    • Method Detail

      • get

        public static <T> Encoder<T> get()
        Returns an Encoder for the given data type.
        Type Parameters:
        T - The type of data to be written (or not in this case).
      • encode

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