@ParametersAreNonnullByDefault
public interface EventFormat
An Event format
specifies how to serialize a CloudEvent as a sequence of bytes.
An implementation of this interface should support all specification versions of CloudEvent.
Implementations of this interface can be registered to the EventFormatProvider to use them.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault io.cloudevents.CloudEventdeserialize(byte[] bytes) Likedeserialize(byte[], CloudEventDataMapper), but with the identityCloudEventDataMapper.io.cloudevents.CloudEventdeserialize(byte[] bytes, io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper) Deserialize a byte array to aCloudEvent.byte[]serialize(io.cloudevents.CloudEvent event) Serialize aCloudEventto a byte array.
-
Method Details
-
serialize
Serialize aCloudEventto a byte array.- Parameters:
event- the event to serialize.- Returns:
- the byte representation of the provided event.
- Throws:
EventSerializationException- if something goes wrong during serialization.
-
deserialize
Likedeserialize(byte[], CloudEventDataMapper), but with the identityCloudEventDataMapper.- Throws:
EventDeserializationException- See Also:
-
deserialize
io.cloudevents.CloudEvent deserialize(byte[] bytes, io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper) throws EventDeserializationException Deserialize a byte array to aCloudEvent.- Parameters:
bytes- the serialized event.mapper- the mapper to use to map the data.- Returns:
- the deserialized event.
- Throws:
EventDeserializationException- if something goes wrong during deserialization.
-
deserializableContentTypes
- Returns:
- the set of content types this event format can deserialize. These content types are used
by the
EventFormatProviderto resolve anEventFormatstarting from the content typeString.
-
serializedContentType
String serializedContentType()- Returns:
- The content type to use when writing an event with this
EventFormat.
-