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 voidcancel()Cancels the underlying connection to the current stream.voidclose()Close the current stream.protected booleanisActive()booleanisOpen()Whether or not the stream is still active.EventnextEvent()The next event in this event stream.protected StringreadLine()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:EventStreamThe next event in this event stream.- Specified by:
nextEventin 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:EventStreamReaderRead the next line of a stream from a given source.- Specified by:
readLinein 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:EventStreamReaderWhether or not the stream is still active.- Specified by:
isOpenin interfaceEventStream- Specified by:
isOpenin classEventStreamReader- Returns:
- true if active, false if not
-
close
public void close() throws IOExceptionDescription copied from interface:EventStreamClose the current stream.- Specified by:
closein interfaceEventStream- Throws:
IOException- can throw exception if internal buffer not closed properly
-
cancel
public void cancel()
Description copied from interface:EventStreamCancels the underlying connection to the current stream.- Specified by:
cancelin interfaceEventStream
-
-