org.appng.api.messaging

## Class Serializer

- java.lang.Object
- - org.appng.api.messaging.Serializer

-     public class Serializer
      extends Object

  Utility class helping to serialize/deserialize `Event`s to an `OutputStream`/ from an `InputStream` . Uses a `SiteAwareObjectInputStream` internally, so the right `SiteClassLoader` is applied when deserializing.
  Author:
    Matthias Müller
  See Also:
    `Event`

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Event` | `deserialize(byte[] data)` Deserializes an `Event` from the given data.
    `Event` | `deserialize(InputStream data)` Deserializes an `Event` from the given data.
    `Environment` | `getEnvironment()` Returns the `Environment` that was used when creating this serializer.
    `String` | `getNodeId()` Returns to node id used when creating this serializer
    `Properties` | `getPlatformConfig()` Return the platform configuration as `Properties`.
    `Site` | `getSite(String siteName)` Returns the `Site` with the given name
    `void` | `serialize(OutputStream out, Event event)` Serializes the given `Event` into the given `OutputStream`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### serialize

          public void serialize(OutputStream out,
                                Event event)
                         throws IOException

      Serializes the given `Event` into the given `OutputStream`.
      Parameters:
        `out` - the `OutputStream` to serialized the `Event` into
        `event` - the `Event` to be serialized
      Throws:
        `IOException` - if an error occurs during serialization

    - #### deserialize

          public Event deserialize(byte[] data)

      Deserializes an `Event` from the given data.
      Parameters:
        `data` - the bytes representing the serialized `Event`
      Returns:
        the `Event`, or `null` if no event could be deserialized from the given data

    - #### deserialize

          public Event deserialize(InputStream data)

      Deserializes an `Event` from the given data.
      Parameters:
        `data` - the `InputStream` containing the serialized `Event`
      Returns:
        the `Event`, or `null` if no event could be deserialized from the given data

    - #### getSite

          public Site getSite(String siteName)

      Returns the `Site` 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 the `Environment` that was used when creating this serializer.
      Returns:
        the `Environment`

    - #### getPlatformConfig

          public Properties getPlatformConfig()

      Return the platform configuration as `Properties`.
      Returns:
        the platform configuration

Copyright © 2011–2023 aiticon GmbH. All rights reserved.