@Test public void testStandardCase() throws IOException { List<RESULT> samples = new ArrayList<>(); samples.add(RESULT.EVENTS); samples.add(RESULT.EMPTY); samples.add(RESULT.EVENTS); try (TestEventStream eventStream = new TestEventStream(new CollectionObjectStream<>(samples))) { int eventCounter = 0; while (eventStream.read() != null) { eventCounter++; } Assert.assertEquals(2, eventCounter); } }
@Override public final Event read() throws IOException { if (events.hasNext()) { return events.next(); } else { T sample; while (!events.hasNext() && (sample = samples.read()) != null) { events = createEvents(sample); } if (events.hasNext()) { return read(); } } return null; }
AbstractEventStream implements ObjectStream<Event> { @Override public final Event read() throws IOException { if (events.hasNext()) { return events.next(); } else { T sample; while (!events.hasNext() && (sample = samples.read()) != null) { events = createEvents(sample); } if (events.hasNext()) { return read(); } } return null; } }
AbstractEventStream implements ObjectStream<Event> { @Override public final Event read() throws IOException { if (events.hasNext()) { return events.next(); } else { T sample; while (!events.hasNext() && (sample = samples.read()) != null) { events = createEvents(sample); } if (events.hasNext()) { return read(); } } return null; } AbstractEventStream(ObjectStream<T> samples); }
AbstractEventStream implements ObjectStream<Event> { @Override public final Event read() throws IOException { if (events.hasNext()) { return events.next(); } else { T sample; while (!events.hasNext() && (sample = samples.read()) != null) { events = createEvents(sample); } if (events.hasNext()) { return read(); } } return null; } AbstractEventStream(ObjectStream<T> samples); @Override final Event read(); @Override void reset(); @Override void close(); }
AbstractEventStream implements ObjectStream<Event> { @Override public final Event read() throws IOException { if (events.hasNext()) { return events.next(); } else { T sample; while (!events.hasNext() && (sample = samples.read()) != null) { events = createEvents(sample); } if (events.hasNext()) { return read(); } } return null; } AbstractEventStream(ObjectStream<T> samples); @Override final Event read(); @Override void reset(); @Override void close();  }