-
- 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
-
-
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.
-
-
-
-