Class Codecs.StringCodec

  • All Implemented Interfaces:
    Codec
    Enclosing class:
    Codecs

    public static class Codecs.StringCodec
    extends Object
    implements Codec
    • Method Detail

      • canHandle

        public boolean canHandle​(Type clazz)
        Description copied from interface: Codec
        Checks if the current codec can handle the serialization and deserialization of object from the given type.
        Specified by:
        canHandle in interface Codec
        Parameters:
        clazz - the type, cannot be null
        Returns:
        true if the codec can handle the type, false otherwise
      • encode

        public byte[] encode​(Object item)
        Description copied from interface: Codec
        Encodes the given object. The type of the given object matches the type used to call the Codec.canHandle(Type) method.
        Specified by:
        encode in interface Codec
        Parameters:
        item - the item
        Returns:
        the encoded content
      • decode

        public String decode​(byte[] item)
        Description copied from interface: Codec
        Decodes the given bytes to an object. The codec must return an instance of the type used to call the Codec.canHandle(Type) method.
        Specified by:
        decode in interface Codec
        Parameters:
        item - the bytes
        Returns:
        the object