@Test public void testSimpleReading() throws IOException { try (FileEventStream feStream = new FileEventStream(new StringReader(EVENTS))) { Assert.assertEquals("other [wc=ic w&c=he,ic n1wc=lc n1w&c=belongs,lc n2wc=lc]", feStream.read().toString()); Assert.assertEquals("other [wc=lc w&c=belongs,lc p1wc=ic p1w&c=he,ic n1wc=lc]", feStream.read().toString()); Assert.assertEquals("other [wc=lc w&c=to,lc p1wc=lc p1w&c=belongs,lc p2wc=ic]", feStream.read().toString()); Assert.assertEquals("org-start [wc=ic w&c=apache,ic p1wc=lc p1w&c=to,lc]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic w&c=software,ic p1wc=ic p1w&c=apache,ic]", feStream.read().toString()); Assert.assertEquals("org-cont [wc=ic w&c=foundation,ic p1wc=ic p1w&c=software,ic]", feStream.read().toString()); Assert.assertEquals("other [wc=other w&c=.,other p1wc=ic]", feStream.read().toString()); Assert.assertNull(feStream.read()); } }
@Override public Event read() throws IOException { String line; if ((line = reader.readLine()) != null) { StringTokenizer st = new StringTokenizer(line); String outcome = st.nextToken(); int count = st.countTokens(); String[] context = new String[count]; for (int ci = 0; ci < count; ci++) { context[ci] = st.nextToken(); } return new Event(outcome, context); } else { return null; } }
FileEventStream implements ObjectStream<Event> { @Override public Event read() throws IOException { String line; if ((line = reader.readLine()) != null) { StringTokenizer st = new StringTokenizer(line); String outcome = st.nextToken(); int count = st.countTokens(); String[] context = new String[count]; for (int ci = 0; ci < count; ci++) { context[ci] = st.nextToken(); } return new Event(outcome, context); } else { return null; } } }
FileEventStream implements ObjectStream<Event> { @Override public Event read() throws IOException { String line; if ((line = reader.readLine()) != null) { StringTokenizer st = new StringTokenizer(line); String outcome = st.nextToken(); int count = st.countTokens(); String[] context = new String[count]; for (int ci = 0; ci < count; ci++) { context[ci] = st.nextToken(); } return new Event(outcome, context); } else { return null; } } FileEventStream(String fileName, String encoding);  FileEventStream(String fileName);  FileEventStream(Reader reader);  FileEventStream(File file); }
FileEventStream implements ObjectStream<Event> { @Override public Event read() throws IOException { String line; if ((line = reader.readLine()) != null) { StringTokenizer st = new StringTokenizer(line); String outcome = st.nextToken(); int count = st.countTokens(); String[] context = new String[count]; for (int ci = 0; ci < count; ci++) { context[ci] = st.nextToken(); } return new Event(outcome, context); } else { return null; } } FileEventStream(String fileName, String encoding);  FileEventStream(String fileName);  FileEventStream(Reader reader);  FileEventStream(File file); @Override Event read(); void close(); static String toLine(Event event); @Override void reset(); }
FileEventStream implements ObjectStream<Event> { @Override public Event read() throws IOException { String line; if ((line = reader.readLine()) != null) { StringTokenizer st = new StringTokenizer(line); String outcome = st.nextToken(); int count = st.countTokens(); String[] context = new String[count]; for (int ci = 0; ci < count; ci++) { context[ci] = st.nextToken(); } return new Event(outcome, context); } else { return null; } } FileEventStream(String fileName, String encoding);  FileEventStream(String fileName);  FileEventStream(Reader reader);  FileEventStream(File file); @Override Event read(); void close(); static String toLine(Event event); @Override void reset();  }