Interface MessageReader

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable
    All Known Implementing Classes:
    FileMessageReader, IOMessageReader

    public interface MessageReader
    extends java.io.Closeable
    An interface for reading messages and service calls.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      <Message extends net.morimekta.providence.PMessage<Message>>
      Message
      read​(net.morimekta.providence.descriptor.PMessageDescriptor<Message> descriptor)
      Read a message from the stream.
      <Message extends net.morimekta.providence.PMessage<Message>>
      net.morimekta.providence.PServiceCall<Message>
      read​(net.morimekta.providence.descriptor.PService service)
      Read a service call from the stream.
      void verifyEndOfContent()
      Verify the stream read from is completed, and does not have garbage content after end of last message.
      • Methods inherited from interface java.io.Closeable

        close
    • Method Detail

      • read

        <Message extends net.morimekta.providence.PMessage<Message>> Message read​(net.morimekta.providence.descriptor.PMessageDescriptor<Message> descriptor)
                                                                           throws java.io.IOException
        Read a message from the stream.
        Type Parameters:
        Message - The message 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

        <Message extends net.morimekta.providence.PMessage<Message>> net.morimekta.providence.PServiceCall<Message> read​(net.morimekta.providence.descriptor.PService service)
                                                                                                                  throws java.io.IOException
        Read a service call from the stream.
        Type Parameters:
        Message - The 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.
      • verifyEndOfContent

        void verifyEndOfContent()
                         throws java.io.IOException
        Verify the stream read from is completed, and does not have garbage content after end of last message.
        Throws:
        java.io.IOException - If garbage found or unable to read from stream or close it.