Package 

Class GsonConverter

  • All Implemented Interfaces:
    com.squareup.tape2.ObjectQueue.Converter

    
    public class GsonConverter<T>
     implements ObjectQueue.Converter<T>
                        

    A GsonConverter class that implements the ObjectQueue.Converter interface. It provides methods to convert objects to and from byte arrays using Gson.

    • Constructor Summary

      Constructors 
      Constructor Description
      GsonConverter(Class<T> type) Constructor to initialize the GsonConverter with the specific type.
    • Method Summary

      Modifier and Type Method Description
      T from(Array<byte> bytes) Converts a byte array into an object of type T.
      void toStream(T object, OutputStream bytes) Converts an object of type T into a byte stream.
      • Methods inherited from class com.squareup.tape2.ObjectQueue.Converter

        from, toStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GsonConverter

        GsonConverter(Class<T> type)
        Constructor to initialize the GsonConverter with the specific type.
        Parameters:
        type - The class type of the objects being converted.
    • Method Detail

      • from

         T from(Array<byte> bytes)

        Converts a byte array into an object of type T.

        Parameters:
        bytes - The byte array to be converted.
      • toStream

         void toStream(T object, OutputStream bytes)

        Converts an object of type T into a byte stream.

        Parameters:
        object - The object to be converted.
        bytes - The output stream where the object will be written.