Class Stream<T>
- java.lang.Object
-
- com.mongodb.stitch.core.internal.net.Stream<T>
-
- Type Parameters:
T
- type to decode events into
public class Stream<T> extends Object
Stitch stream that sits on top of anEventStream
. Clean interface to read events from a stream as some type T.
-
-
Constructor Summary
Constructors Constructor Description Stream(EventStream eventStream, Class<T> resultClass, CodecRegistry codecRegistry)
Stream(EventStream eventStream, Decoder<T> decoder)
-
-
-
Constructor Detail
-
Stream
public Stream(EventStream eventStream, Decoder<T> decoder)
-
Stream
public Stream(EventStream eventStream, Class<T> resultClass, CodecRegistry codecRegistry)
-
-
Method Detail
-
nextEvent
public StitchEvent<T> nextEvent() throws IOException
Fetch the next event from a given stream- Returns:
- the next event
- Throws:
IOException
- any io exception that could occur
-
isOpen
public boolean isOpen()
Whether or not the underlying event straem is still open.- Returns:
- true is open, false if not
-
close
public void close() throws IOException
Close the underlying event stream.- Throws:
IOException
- i/o exceptions relative to closing
-
cancel
public void cancel()
Close the underlying connection to the event stream.
-
-