Class FileMessageReader

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

    public class FileMessageReader
    extends java.lang.Object
    implements MessageReader
    A message reader that reads from a single file until the end.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileMessageReader​(java.io.File file, Serializer serializer)
      Create the file message reader.
    • 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

      • FileMessageReader

        public FileMessageReader​(java.io.File file,
                                 Serializer serializer)
        Create the file message reader.
        Parameters:
        file - The file to be read.
        serializer - The serializer to use.
    • 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