Class EventStreamReader

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public final class EventStreamReader
    extends java.lang.Object
    implements java.lang.AutoCloseable
    • Constructor Detail

      • EventStreamReader

        public EventStreamReader​(java.io.InputStream in)
    • Method Detail

      • readRawMessage

        public java.lang.String readRawMessage()
                                        throws java.io.IOException
        Returns the event message (lines separated by \n) without the terminating \n\n. Returns null when end of stream reached (and may occur with a partially read event message that has not yet been terminated). Characters in comment lines are discarded as read (they are not buffered).
        Returns:
        the event message
        Throws:
        java.io.IOException
      • readMessage

        public java.util.Optional<EventStreamMessage> readMessage()
                                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • close

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