com.ibm.ia.common

Interface ModelSerializer

  • All Known Subinterfaces:
    BaseFactory, EntityFactory, EventFactory


    public interface ModelSerializer
    Factory class used to parse and serialize Event and Entities

    to be used in Events and Entities

    • Method Detail

      • parseEvent

        Event parseEvent(DataFormat format,
                       byte[] eventData,
                       java.lang.String encoding)
                         throws java.lang.UnsupportedOperationException,
                                DataParseException
        Creates Event instance from byte array. If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        eventData - event bytes
        encoding - optional encoding type, default to UTF-8
        Returns:
        Event instance
      • parseEvent

        Event parseEvent(DataFormat format,
                       java.io.InputStream eventData,
                       java.lang.String encoding)
                         throws java.lang.UnsupportedOperationException,
                                DataParseException,
                                java.io.IOException
        Creates Event instance from a byte stream. If the event data is not known by the solution, a UnknownDataElementException is thrown.
      • parseEvent

        Event parseEvent(DataFormat format,
                       org.w3c.dom.Document eventDocument)
                         throws java.lang.UnsupportedOperationException,
                                DataParseException
        Creates Event instance from a Dom document. If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventDocument - event's Dom document
        Returns:
        Event instance
      • parseEvent

        Event parseEvent(DataFormat format,
                       java.lang.String eventData)
                         throws java.lang.UnsupportedOperationException,
                                DataParseException
        Creates Event instance from a String If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventData - event String
        Returns:
        Event instance
      • parseEvent

        Event parseEvent(DataFormat format,
                       java.io.Reader eventData)
                         throws java.lang.UnsupportedOperationException,
                                DataParseException,
                                java.io.IOException
        Creates Event instance from a charset stream If the event data is not known by the solution, a UnknownDataElementException is thrown.
        Throws:
        DataParseException - if the event data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        eventData - event charset reader
        Returns:
        Event instance
      • serializeEvent

        java.lang.String serializeEvent(DataFormat format,
                                      Event event)
                                        throws java.lang.UnsupportedOperationException
        Serializes given Event to String
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat)
        event - Event instance
        Returns:
        String representation of the event
      • serializeEvent

        void serializeEvent(DataFormat format,
                          java.io.OutputStream outputStream,
                          Event event,
                          java.lang.String encoding)
                            throws java.lang.UnsupportedOperationException,
                                   java.io.IOException
        Serializes given Event to byte stream
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        java.io.IOException - if the output cannot be written.
        Parameters:
        format - data format (#see DataFormat)
        outputStream - stream to write bytes to
        event - Event instance
        encoding - optional encoding type, default to UTF-8
      • parseEntity

        Entity parseEntity(DataFormat format,
                         byte[] entityData,
                         java.lang.String encoding)
                           throws java.lang.UnsupportedOperationException,
                                  DataParseException
        Creates Entity instance from a byte array
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity bytes
        encoding - optional encoding type, default to UTF-8
        Returns:
        Entity instance
      • parseEntity

        Entity parseEntity(DataFormat format,
                         java.io.InputStream entityData,
                         java.lang.String encoding)
                           throws java.lang.UnsupportedOperationException,
                                  DataParseException,
                                  java.io.IOException
        Creates Entity instance from a byte stream
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity input stream
        encoding - optional encoding type, default to UTF-8
        Returns:
        Entity instance
      • parseEntity

        Entity parseEntity(DataFormat format,
                         org.w3c.dom.Document entityDom)
                           throws java.lang.UnsupportedOperationException,
                                  DataParseException
        Creates Entity instance from a DOM document
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityDom - entity Dom document
        Returns:
        Entity instance
      • parseEntity

        Entity parseEntity(DataFormat format,
                         java.lang.String entityData)
                           throws java.lang.UnsupportedOperationException,
                                  DataParseException
        Creates Entity instance from a string
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity String
        Returns:
        Entity instance
      • parseEntity

        Entity parseEntity(DataFormat format,
                         java.io.Reader entityData)
                           throws java.lang.UnsupportedOperationException,
                                  DataParseException,
                                  java.io.IOException
        Creates Entity instance from a charset stream reader
        Throws:
        DataParseException - if the entity data cannot be parsed.
        java.io.IOException - if the input cannot be read.
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entityData - entity charset reader
        Returns:
        Entity instance
      • serializeEntity

        java.lang.String serializeEntity(DataFormat format,
                                       Entity entity)
                                         throws java.lang.UnsupportedOperationException
        Serializes Entity instance to String
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        Parameters:
        format - data format (#see DataFormat);
        entity - Entity instance
        Returns:
        String entity representation
      • serializeEntity

        void serializeEntity(DataFormat format,
                           java.io.OutputStream outputStream,
                           Entity entity,
                           java.lang.String encoding)
                             throws java.lang.UnsupportedOperationException,
                                    java.io.IOException
        Serializes Entity instance to byte stream
        Throws:
        java.lang.UnsupportedOperationException - if the operation is not supported for the specified data format.
        java.io.IOException - if the output cannot be written.
        Parameters:
        format - data format (#see DataFormat);
        outputStream - stream to write bytes to
        entity - Entity instance
        encoding - optional encoding type, default to UTF-8

© Copyright IBM 2016