Class BinaryEncoder

  • All Implemented Interfaces:
    Encoder

    public class BinaryEncoder
    extends java.lang.Object
    implements Encoder
    Encoder for StoreType.BINARY. For String and primitives, store unencoded. For other objects, store them marshalled.
    Since:
    9.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object fromStorage​(java.lang.Object stored)
      Convert from storage format to the read/write format.
      MediaType getStorageFormat()
      Returns the MediaType produced by this encoder or null if the storage format is not known.
      short id()
      Each encoder is associated with an unique id in order to optimize serialization.
      boolean isStorageFormatFilterable()  
      protected byte[] marshall​(java.lang.Object source)  
      java.lang.Object toStorage​(java.lang.Object content)
      Convert data in the read/write format to the storage format.
      protected java.lang.Object unmarshall​(byte[] source)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toStorage

        public java.lang.Object toStorage​(java.lang.Object content)
        Description copied from interface: Encoder
        Convert data in the read/write format to the storage format.
        Specified by:
        toStorage in interface Encoder
        Parameters:
        content - data to be converted, never null.
        Returns:
        Object in the storage format.
      • fromStorage

        public java.lang.Object fromStorage​(java.lang.Object stored)
        Description copied from interface: Encoder
        Convert from storage format to the read/write format.
        Specified by:
        fromStorage in interface Encoder
        Parameters:
        stored - data as stored in the cache, never null.
        Returns:
        data in the read/write format
      • isStorageFormatFilterable

        public boolean isStorageFormatFilterable()
        Specified by:
        isStorageFormatFilterable in interface Encoder
        Returns:
        if true, will perform stream and related operation in the storage format.
      • getStorageFormat

        public MediaType getStorageFormat()
        Description copied from interface: Encoder
        Returns the MediaType produced by this encoder or null if the storage format is not known.
        Specified by:
        getStorageFormat in interface Encoder
      • id

        public short id()
        Description copied from interface: Encoder
        Each encoder is associated with an unique id in order to optimize serialization. Known ids are kept in EncoderIds.
        Specified by:
        id in interface Encoder
        Returns:
        unique identifier for this encoder
      • unmarshall

        protected java.lang.Object unmarshall​(byte[] source)
                                       throws java.io.IOException,
                                              java.lang.ClassNotFoundException
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • marshall

        protected byte[] marshall​(java.lang.Object source)
                           throws java.io.IOException,
                                  java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException