Class StringSerializer

java.lang.Object
org.drasyl.node.handler.serialization.StringSerializer
All Implemented Interfaces:
Serializer

public class StringSerializer extends Object
This Serializer (de)serializes String objects.
  • Constructor Details

    • StringSerializer

      public StringSerializer()
  • Method Details

    • matchedToByArray

      protected byte[] matchedToByArray(String o)
    • matchedFromByteArray

      protected String matchedFromByteArray(byte[] bytes, Class<String> type)
    • toByteArray

      public byte[] toByteArray(Object o) throws IOException
      Description copied from interface: Serializer
      Serializes the given object into an array of bytes
      Specified by:
      toByteArray in interface Serializer
      Throws:
      IOException - if deserialization to byte array fails
    • fromByteArray

      public <T> T fromByteArray(byte[] bytes, Class<T> type) throws IOException
      Description copied from interface: Serializer
      Produces an object of type T from an array of bytes.
      Specified by:
      fromByteArray in interface Serializer
      Throws:
      IOException - if serialization to byte array fails