Class StringSerializer

    • Constructor Detail

      • StringSerializer

        public StringSerializer()
    • Method Detail

      • configure

        public void configure​(Map<String,​?> properties)
        Configures this StringSerializer with the given properties.

        NOTE: The default encoding is UTF-8.

        Specified by:
        configure in interface Serializer<String>
        Parameters:
        properties - a map of configuration properties
        Throws:
        IllegalArgumentException - if the charset encoding type is unsupported or the specified charset is unsupported, or when properties is null.
      • serialize

        public byte[] serialize​(String destinationName,
                                String data)
        Serializes the given string data to byte[] using the configured character encoding.

        NOTE: The default encoding is UTF-8.

        Specified by:
        serialize in interface Serializer<String>
        Parameters:
        destinationName - the name of the destination (not used in this implementation)
        data - the string data to serialize
        Returns:
        the serialized byte[], or null if the input data is null