Class S3EventSerializer<T>
java.lang.Object
com.amazonaws.services.lambda.runtime.serialization.events.serializers.S3EventSerializer<T>
- All Implemented Interfaces:
OrgJsonSerializer<T>, PojoSerializer<T>
Serializer for S3 event
NOTE: Because the s3 event class provided by the SDK does not play well with Jackson through a class laoder,
this class uses the low level org json library to serialize and deserialize the event. If new events are added
that do not work well with Jackson or GSON, this is the fallback method that will always work but is more verbose.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromJson(InputStream input) deserialize an instance of an s3 event from an input streamdeserialize an instance of an s3 event from a stringvoidtoJson(T value, OutputStream output) serialize an S3 event object to the output streamConstruct s3Event Serialize from specific s3 event class from userwithClassLoader(ClassLoader classLoader) Sets the ClassLoader that will be used to load S3 event classes
-
Constructor Details
-
S3EventSerializer
public S3EventSerializer()
-
-
Method Details
-
withClass
Construct s3Event Serialize from specific s3 event class from user- Specified by:
withClassin interfaceOrgJsonSerializer<T>- Parameters:
eventClass- s3 event class- Returns:
- OrgJsonSerializer with event type
-
withClassLoader
Sets the ClassLoader that will be used to load S3 event classes- Specified by:
withClassLoaderin interfaceOrgJsonSerializer<T>- Parameters:
classLoader- - ClassLoader that S3 event classes will be loaded from- Returns:
- OrgJsonSerializer with the supplied classLoader
-
fromJson
deserialize an instance of an s3 event from an input stream- Specified by:
fromJsonin interfaceOrgJsonSerializer<T>- Specified by:
fromJsonin interfacePojoSerializer<T>- Parameters:
input- InputStream reading from- Returns:
- S3Event Object
-
fromJson
deserialize an instance of an s3 event from a string- Specified by:
fromJsonin interfaceOrgJsonSerializer<T>- Specified by:
fromJsonin interfacePojoSerializer<T>- Parameters:
input- String with JSON- Returns:
- s3Event object
-
toJson
serialize an S3 event object to the output stream- Specified by:
toJsonin interfaceOrgJsonSerializer<T>- Specified by:
toJsonin interfacePojoSerializer<T>- Parameters:
value- S3 event objectoutput- OutputStream serializing to
-