本文整理汇总了Java中org.apache.flume.serialization.EventDeserializer.readEvent方法的典型用法代码示例。如果您正苦于以下问题:Java EventDeserializer.readEvent方法的具体用法?Java EventDeserializer.readEvent怎么用?Java EventDeserializer.readEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flume.serialization.EventDeserializer
的用法示例。
在下文中一共展示了EventDeserializer.readEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateMiniParse
import org.apache.flume.serialization.EventDeserializer; //导入方法依赖的package包/类
private void validateMiniParse(EventDeserializer des) throws IOException {
Event evt;
des.mark();
evt = des.readEvent();
assertEquals(new String(evt.getBody()), mini);
des.reset(); // reset!
evt = des.readEvent();
assertEquals("data should be repeated, " +
"because we reset() the stream", new String(evt.getBody()), mini);
evt = des.readEvent();
assertNull("Event should be null because there are no lines " +
"left to read", evt);
des.mark();
des.close();
}
示例2: validateReadAndMark
import org.apache.flume.serialization.EventDeserializer; //导入方法依赖的package包/类
private void validateReadAndMark(EventDeserializer des) throws IOException {
Event evt;
evt = des.readEvent();
assertTrue(new String(evt.getBody()).contains("Giada De Laurentiis"));
des.mark();
evt = des.readEvent();
assertTrue(new String(evt.getBody()).contains("J K. Rowling"));
des.mark(); // reset!
List<Event> readEvents = des.readEvents(2);
assertEquals(2, readEvents.size());
evt = des.readEvent();
assertNull("Event should be null because there are no more books " + "left to read", evt);
des.mark();
des.mark();
des.close();
}
示例3: validateReadAndMarkWithHeader
import org.apache.flume.serialization.EventDeserializer; //导入方法依赖的package包/类
private void validateReadAndMarkWithHeader(EventDeserializer des) throws IOException {
Event evt;
evt = des.readEvent();
System.out.println(evt.getHeaders().get("myHeader"));
assertTrue(evt.getHeaders().get("myHeader").contains("Giada De Laurentiis"));
des.mark();
evt = des.readEvent();
assertTrue(evt.getHeaders().get("myHeader").contains("J K. Rowling"));
des.mark(); // reset!
List<Event> readEvents = des.readEvents(2);
assertEquals(2, readEvents.size());
evt = des.readEvent();
assertNull("Event should be null because there are no more books " + "left to read", evt);
des.mark();
des.mark();
des.close();
}
示例4: validateReset
import org.apache.flume.serialization.EventDeserializer; //导入方法依赖的package包/类
private void validateReset(EventDeserializer des) throws IOException {
Event evt = des.readEvent();
assertEquals("Everyday Italian", new String(evt.getBody()));
des.mark();
List<Event> events = des.readEvents(3);
assertEquals(3, events.size());
assertEquals("Harry Potter", new String(events.get(0).getBody()));
assertEquals("XQuery Kick Start", new String(events.get(1).getBody()));
assertEquals("Learning XML", new String(events.get(2).getBody()));
des.reset(); // reset!
events = des.readEvents(3);
assertEquals(3, events.size());
assertEquals("Harry Potter", new String(events.get(0).getBody()));
assertEquals("XQuery Kick Start", new String(events.get(1).getBody()));
assertEquals("Learning XML", new String(events.get(2).getBody()));
evt = des.readEvent();
Assert.assertNull("Event should be null because there are no more books " + "left to read", evt);
}