Class FileMessageWriter

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

    public class FileMessageWriter
    extends java.lang.Object
    implements MessageWriter
    A message writer that writes to a single file until the end.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      int separator()
      Write an entry separator to the writer.
      <Message extends PMessage<Message,​Field>,​Field extends PField>
      int
      write​(Message message)
      Write a providence message to the writer.
      <Message extends PMessage<Message,​Field>,​Field extends PField>
      int
      write​(PServiceCall<Message,​Field> call)
      Write a providence service call to the writer.
      • Methods inherited from class java.lang.Object

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

      • FileMessageWriter

        public FileMessageWriter​(java.io.File file,
                                 Serializer serializer)
      • FileMessageWriter

        public FileMessageWriter​(java.io.File file,
                                 Serializer serializer,
                                 boolean append)
    • Method Detail

      • write

        public <Message extends PMessage<Message,​Field>,​Field extends PField> int write​(Message message)
                                                                                             throws java.io.IOException
        Description copied from interface: MessageWriter
        Write a providence message to the writer.
        Specified by:
        write in interface MessageWriter
        Type Parameters:
        Message - The message type.
        Field - The field type.
        Parameters:
        message - The message to write.
        Returns:
        The number of bytes written.
        Throws:
        java.io.IOException - If write failed.
      • write

        public <Message extends PMessage<Message,​Field>,​Field extends PField> int write​(PServiceCall<Message,​Field> call)
                                                                                             throws java.io.IOException
        Description copied from interface: MessageWriter
        Write a providence service call to the writer.
        Specified by:
        write in interface MessageWriter
        Type Parameters:
        Message - The message type embedded in the call.
        Field - The field type embedded in the call.
        Parameters:
        call - The service call to write.
        Returns:
        The number of bytes written.
        Throws:
        java.io.IOException - If write failed.
      • separator

        public int separator()
                      throws java.io.IOException
        Description copied from interface: MessageWriter
        Write an entry separator to the writer.
        Specified by:
        separator in interface MessageWriter
        Returns:
        The number of bytes written.
        Throws:
        java.io.IOException - If write failed.
      • 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