Class OkHttpEventStream
- java.lang.Object
-
- com.mongodb.stitch.core.internal.net.EventStreamReader
-
- com.mongodb.stitch.core.internal.net.OkHttpEventStream
-
- All Implemented Interfaces:
EventStream
public class OkHttpEventStream extends EventStreamReader implements EventStream
-
-
Method Summary
Modifier and Type Method Description void
cancel()
Cancels the underlying connection to the current stream.void
close()
Close the current stream.protected boolean
isActive()
boolean
isOpen()
Whether or not the stream is still active.Event
nextEvent()
The next event in this event stream.protected String
readLine()
Read the next line of a stream from a given source.-
Methods inherited from class com.mongodb.stitch.core.internal.net.EventStreamReader
processEvent
-
-
-
-
Method Detail
-
nextEvent
public Event nextEvent() throws IOException
Description copied from interface:EventStream
The next event in this event stream.- Specified by:
nextEvent
in interfaceEventStream
- Returns:
- next event in this stream
- Throws:
IOException
- general i/o related errors
-
isActive
protected boolean isActive()
-
readLine
protected String readLine() throws IOException
Description copied from class:EventStreamReader
Read the next line of a stream from a given source.- Specified by:
readLine
in classEventStreamReader
- Returns:
- the next utf8 line
- Throws:
IOException
- if a stream is in the wrong state, IO errors can be thrown
-
isOpen
public boolean isOpen()
Description copied from class:EventStreamReader
Whether or not the stream is still active.- Specified by:
isOpen
in interfaceEventStream
- Specified by:
isOpen
in classEventStreamReader
- Returns:
- true if active, false if not
-
close
public void close() throws IOException
Description copied from interface:EventStream
Close the current stream.- Specified by:
close
in interfaceEventStream
- Throws:
IOException
- can throw exception if internal buffer not closed properly
-
cancel
public void cancel()
Description copied from interface:EventStream
Cancels the underlying connection to the current stream.- Specified by:
cancel
in interfaceEventStream
-
-