Class JsonbService

java.lang.Object
com.inrupt.client.jsonb.JsonbService
All Implemented Interfaces:
JsonService

public class JsonbService extends Object implements JsonService
A JsonService using the JakartaEE JSON Bind API.
  • Constructor Details

    • JsonbService

      public JsonbService()
      Create a JSON-B service.
  • Method Details

    • toJson

      public <T> void toJson(T object, OutputStream output) throws IOException
      Description copied from interface: JsonService
      Write object data into JSON.
      Specified by:
      toJson in interface JsonService
      Type Parameters:
      T - the object type
      Parameters:
      object - the object to serialize
      output - the output stream
      Throws:
      IOException - when there is a serialization error
    • fromJson

      public <T> T fromJson(InputStream input, Class<T> clazz) throws IOException
      Description copied from interface: JsonService
      Read JSON into a java object.
      Specified by:
      fromJson in interface JsonService
      Type Parameters:
      T - the object type
      Parameters:
      input - the input stream
      clazz - the object class
      Returns:
      the newly created object
      Throws:
      IOException - when there is a parsing error
    • fromJson

      public <T> T fromJson(InputStream input, Type type) throws IOException
      Description copied from interface: JsonService
      Read JSON into a java object.
      Specified by:
      fromJson in interface JsonService
      Type Parameters:
      T - the object type
      Parameters:
      input - the input stream
      type - the runtime type of the object
      Returns:
      the newly created object
      Throws:
      IOException - when there is a parsing error