Interface PushNotificationDeserializer<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Deserializes a push notification message from the provided input stream. The stream is guaranteed not null,
but may be empty if your
PushNotificationSerializer did not actually write any bytes.-
Method Summary
Modifier and TypeMethodDescriptiondeserialize(@NotNull InputStream payload) Deserializes the provided payload into an object of type T.static <T> PushNotificationDeserializer<T>fromString(Function<String, T> decoder) Deserializes a push notification via some provided function that can transform a string into an arbitrary type, such as GSON/JSON.static PushNotificationDeserializer<String>Deserializes a string (as UTF-8 encoded bytes) from the provided input stream.
-
Method Details
-
deserialize
Deserializes the provided payload into an object of type T. It is your responsibility (paired withyour seriailizer) to encode null values.- Throws:
IOException
-
intoString
Deserializes a string (as UTF-8 encoded bytes) from the provided input stream. If a single null byte was written, null is returned.- See Also:
-
fromString
Deserializes a push notification via some provided function that can transform a string into an arbitrary type, such as GSON/JSON. The initial string is read viaintoString().- Parameters:
decoder- A function that can turn a string into your arbitrary type.l- See Also:
-