Class ByteBufferJsonAdapter

java.lang.Object
org.eclipse.keyple.core.util.json.ByteBufferJsonAdapter
All Implemented Interfaces:
com.google.gson.JsonDeserializer<ByteBuffer>, com.google.gson.JsonSerializer<ByteBuffer>

public class ByteBufferJsonAdapter extends Object implements com.google.gson.JsonSerializer<ByteBuffer>, com.google.gson.JsonDeserializer<ByteBuffer>
JSON serializer/deserializer of a ByteBuffer to a hex string.

Note: This implementation assumes that the ByteBuffer is backed by an array and is not a direct array.

Since:
2.3.2
  • Constructor Details

    • ByteBufferJsonAdapter

      public ByteBufferJsonAdapter()
  • Method Details

    • serialize

      public com.google.gson.JsonElement serialize(ByteBuffer buffer, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Specified by:
      serialize in interface com.google.gson.JsonSerializer<ByteBuffer>
      Since:
      2.3.2
    • deserialize

      public ByteBuffer deserialize(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<ByteBuffer>
      Throws:
      com.google.gson.JsonParseException
      Since:
      2.3.2