Class EventStreamReader
- java.lang.Object
-
- com.stackone.stackone_client_java.utils.EventStreamReader
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class EventStreamReader extends java.lang.Object implements java.lang.AutoCloseable
-
-
Constructor Summary
Constructors Constructor Description EventStreamReader(java.io.InputStream in)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()static EventStreamMessageparseMessage(java.lang.String text)java.util.Optional<EventStreamMessage>readMessage()java.lang.StringreadRawMessage()Returns the event message (lines separated by \n) without the terminating \n\n.
-
-
-
Method Detail
-
readRawMessage
public java.lang.String readRawMessage() throws java.io.IOExceptionReturns 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
-
parseMessage
public static EventStreamMessage parseMessage(java.lang.String text)
-
close
public void close() throws java.lang.Exception- Specified by:
closein interfacejava.lang.AutoCloseable- Throws:
java.lang.Exception
-
-