当前位置: 首页>>代码示例>>Java>>正文


Java EventDeserializer.readEvent方法代码示例

本文整理汇总了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();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:20,代码来源:TestBlobDeserializer.java

示例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();
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:22,代码来源:XmlXpathDeserializerTest.java

示例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();
}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:23,代码来源:XmlXpathDeserializerTest.java

示例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);

}
 
开发者ID:Stratio,项目名称:ingestion,代码行数:24,代码来源:XmlXpathDeserializerTest.java


注:本文中的org.apache.flume.serialization.EventDeserializer.readEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。