Class StringSerializer

java.lang.Object
de.iip_ecosphere.platform.transport.serialization.StringSerializer
All Implemented Interfaces:
InputTypeTranslator<byte[],String>, OutputTypeTranslator<String,byte[]>, Serializer<String>, TypeTranslator<String,byte[]>

public class StringSerializer extends Object implements Serializer<String>
A default serializer for String through Base64 encoding.
Author:
Holger Eichelberger, SSE
  • Constructor Details

    • StringSerializer

      public StringSerializer()
  • Method Details

    • from

      public String from(byte[] data) throws IOException
      Description copied from interface: InputTypeTranslator
      Deserializes a target value into a source value ("input from external").
      Specified by:
      from in interface InputTypeTranslator<byte[],String>
      Parameters:
      data - the data to be translated back
      Returns:
      the serialized object
      Throws:
      IOException - in case that serialization fails
    • to

      public byte[] to(String source) throws IOException
      Description copied from interface: OutputTypeTranslator
      Translates a source value into a target value ("output to external").
      Specified by:
      to in interface OutputTypeTranslator<String,byte[]>
      Parameters:
      source - the source value to be translated
      Returns:
      the target value
      Throws:
      IOException - in case that translation fails
    • clone

      public String clone(String origin) throws IOException
      Description copied from interface: Serializer
      Creates a new value instance and copies the values from origin to the new instance. Use the SerializerRegistry to implement cloning of nested object values.
      Specified by:
      clone in interface Serializer<String>
      Parameters:
      origin - the object to clone
      Returns:
      the cloned object
      Throws:
      IOException - in case that cloning/serialization operations fail
    • getType

      public Class<String> getType()
      Description copied from interface: Serializer
      The type to be handled by this serializer.
      Specified by:
      getType in interface Serializer<String>
      Returns:
      the type