Package org.appng.api.messaging
Class Serializer
- java.lang.Object
-
- org.appng.api.messaging.Serializer
-
public class Serializer extends Object
Utility class helping to serialize/deserializeEvent
s to anOutputStream
/ from anInputStream
. Uses aSiteAwareObjectInputStream
internally, so the rightSiteClassLoader
is applied when deserializing.- Author:
- Matthias Müller
- See Also:
Event
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Event
deserialize(byte[] data)
Deserializes anEvent
from the given data.Event
deserialize(InputStream data)
Deserializes anEvent
from the given data.Environment
getEnvironment()
Returns theEnvironment
that was used when creating this serializer.String
getNodeId()
Returns to node id used when creating this serializerProperties
getPlatformConfig()
Return the platform configuration asProperties
.Site
getSite(String siteName)
Returns theSite
with the given namevoid
serialize(OutputStream out, Event event)
Serializes the givenEvent
into the givenOutputStream
.
-
-
-
Method Detail
-
serialize
public void serialize(OutputStream out, Event event) throws IOException
Serializes the givenEvent
into the givenOutputStream
.- Parameters:
out
- theOutputStream
to serialized theEvent
intoevent
- theEvent
to be serialized- Throws:
IOException
- if an error occurs during serialization
-
deserialize
public Event deserialize(InputStream data)
Deserializes anEvent
from the given data.- Parameters:
data
- theInputStream
containing the serializedEvent
- Returns:
- the
Event
, ornull
if no event could be deserialized from the given data
-
getSite
public Site getSite(String siteName)
Returns theSite
with the given name- Parameters:
siteName
- the name of the site to retrieve- Returns:
- the
Site
-
getNodeId
public String getNodeId()
Returns to node id used when creating this serializer- Returns:
- the node id
-
getEnvironment
public Environment getEnvironment()
Returns theEnvironment
that was used when creating this serializer.- Returns:
- the
Environment
-
getPlatformConfig
public Properties getPlatformConfig()
Return the platform configuration asProperties
.- Returns:
- the platform configuration
-
-