Class IOMessageReader

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, MessageReader

    public class IOMessageReader
    extends java.lang.Object
    implements MessageReader
    A reader helper class for matching a serializer with an input stream.
    • Constructor Summary

      Constructors 
      Constructor Description
      IOMessageReader​(java.io.InputStream in, Serializer serializer)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      <Message extends PMessage<Message,​Field>,​Field extends PField>
      Message
      read​(PMessageDescriptor<Message,​Field> descriptor)
      Read a message from the stream.
      <Message extends PMessage<Message,​Field>,​Field extends PField>
      PServiceCall<Message,​Field>
      read​(PService service)
      Read a service call from the stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IOMessageReader

        public IOMessageReader​(java.io.InputStream in,
                               Serializer serializer)
    • Method Detail

      • read

        public <Message extends PMessage<Message,​Field>,​Field extends PField> Message read​(PMessageDescriptor<Message,​Field> descriptor)
                                                                                                throws java.io.IOException
        Description copied from interface: MessageReader
        Read a message from the stream.
        Specified by:
        read in interface MessageReader
        Type Parameters:
        Message - The message type.
        Field - The message field type.
        Parameters:
        descriptor - The descriptor for the message to be read.
        Returns:
        The message read.
        Throws:
        java.io.IOException - If the message could not be read.
      • read

        public <Message extends PMessage<Message,​Field>,​Field extends PFieldPServiceCall<Message,​Field> read​(PService service)
                                                                                                                          throws java.io.IOException
        Description copied from interface: MessageReader
        Read a service call from the stream.
        Specified by:
        read in interface MessageReader
        Type Parameters:
        Message - The type of the contained params or response message.
        Field - The field type of the contained params or response message.
        Parameters:
        service - The service whose call should be read.
        Returns:
        The service call read.
        Throws:
        java.io.IOException - If the service call could not be read.
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException