Interface Serializer<R,​P extends R>

  • Type Parameters:
    R - The class of object which the serializer can serialize (what it requires).
    P - The class of object which will be provided by this serializer when it parses data.
    All Known Subinterfaces:
    XMLSerializer<R,​P>

    @ComponentRole
    public interface Serializer<R,​P extends R>
    A generic thing for converting objects of a known type into InputStreams and back again.
    Since:
    3.0M2
    Version:
    $Id: 9cbb2336cb0e115ebc2b6f673347eaa6c66fde8e $
    • Method Detail

      • parse

        P parse​(InputStream stream)
         throws IOException
        Parse an InputStream and create a new object.
        Parameters:
        stream - an InputStream to parse.
        Returns:
        a new object made by parsing the stream.
        Throws:
        IOException - if the InputStream does not contain the type of object handled by this serializer, the object was serialized with a different Serializer, or something goes wrong along the way.
      • serialize

        InputStream serialize​(R object)
                       throws IOException
        Serialize the given object and return an InputStream.
        Parameters:
        object - the thing to serialize.
        Returns:
        an InputStream which can be used to create a new object using parse().
        Throws:
        IOException - if something goes wrong while serializing.