Class BinaryGsonCodec<T>

java.lang.Object
io.datarouter.gson.codec.BinaryGsonCodec<T>
All Implemented Interfaces:
io.datarouter.bytes.Codec<T,byte[]>

public class BinaryGsonCodec<T> extends Object implements io.datarouter.bytes.Codec<T,byte[]>
Create a single object that can convert a single class to and from byte-array encoded json.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.datarouter.bytes.Codec

    io.datarouter.bytes.Codec.FunctionalCodec<A extends Object,B extends Object>, io.datarouter.bytes.Codec.NullPassthroughCodec<A extends Object,B extends Object>
  • Field Summary

    Fields inherited from interface io.datarouter.bytes.Codec

    IDENTITY_INSTANCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    BinaryGsonCodec(com.google.gson.Gson gson, Class<T> cls)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(byte[] encodedValue)
     
    byte[]
    encode(T value)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.datarouter.bytes.Codec

    encodeAndDecode
  • Constructor Details

    • BinaryGsonCodec

      public BinaryGsonCodec(com.google.gson.Gson gson, Class<T> cls)
  • Method Details

    • encode

      public byte[] encode(T value)
      Specified by:
      encode in interface io.datarouter.bytes.Codec<T,byte[]>
    • decode

      public T decode(byte[] encodedValue)
      Specified by:
      decode in interface io.datarouter.bytes.Codec<T,byte[]>