• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BytesStreamInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.elasticsearch.common.io.stream.BytesStreamInput的典型用法代码示例。如果您正苦于以下问题:Java BytesStreamInput类的具体用法?Java BytesStreamInput怎么用?Java BytesStreamInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BytesStreamInput类属于org.elasticsearch.common.io.stream包,在下文中一共展示了BytesStreamInput类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: serialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
@Test
public void serialization() throws IOException {
	NodeIncrementalUpdateResponse[] nodes = new NodeIncrementalUpdateResponse[] {
			new NodeIncrementalUpdateResponse(new DiscoveryNode("nd1", DummyTransportAddress.INSTANCE, Version.CURRENT),
					false, false, null),
			new NodeIncrementalUpdateResponse(new DiscoveryNode("nd2", DummyTransportAddress.INSTANCE, Version.CURRENT),
					false, false, null),
			new NodeIncrementalUpdateResponse(new DiscoveryNode("nd3", DummyTransportAddress.INSTANCE, Version.CURRENT),
					true, true, "ORG") };
	IncrementalUpdateResponse testedSrc = new IncrementalUpdateResponse(new ClusterName("cl"), nodes);

	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);

	IncrementalUpdateResponse testedTarget = new IncrementalUpdateResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));

	Assert.assertEquals(3, testedTarget.getNodes().length);
	NodeIncrementalUpdateResponse r = testedTarget.getSuccessNodeResponse();
	Assert.assertNotNull(r);
	Assert.assertEquals("nd3", r.getNode().getId());
	Assert.assertTrue(r.isRiverFound());
	Assert.assertTrue(r.spaceFound);
	Assert.assertEquals("ORG", r.reindexedSpaces);
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:26,代码来源:IncrementalUpdateResponseTest.java


示例2: serialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
@Test
public void serialization() throws IOException {
	NodeFullUpdateResponse[] nodes = new NodeFullUpdateResponse[] {
			new NodeFullUpdateResponse(new DiscoveryNode("nd1", DummyTransportAddress.INSTANCE, Version.CURRENT), false, false, null),
			new NodeFullUpdateResponse(new DiscoveryNode("nd2", DummyTransportAddress.INSTANCE, Version.CURRENT), false, false, null),
			new NodeFullUpdateResponse(new DiscoveryNode("nd3", DummyTransportAddress.INSTANCE, Version.CURRENT), true, true, "ORG") };
	FullUpdateResponse testedSrc = new FullUpdateResponse(new ClusterName("cl"), nodes);

	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);

	FullUpdateResponse testedTarget = new FullUpdateResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));

	Assert.assertEquals(3, testedTarget.getNodes().length);
	NodeFullUpdateResponse r = testedTarget.getSuccessNodeResponse();
	Assert.assertNotNull(r);
	Assert.assertEquals("nd3", r.getNode().getId());
	Assert.assertTrue(r.isRiverFound());
	Assert.assertTrue(r.spaceFound);
	Assert.assertEquals("ORG", r.reindexedSpaces);
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:23,代码来源:FullUpdateResponseTest.java


示例3: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeJRLifecycleResponse performSerializationAndBasicAsserts(NodeJRLifecycleResponse testedSrc)
    throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeJRLifecycleResponse testedTarget = new NodeJRLifecycleResponse();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getNode().getId(), testedTarget.getNode().getId());
  Assert.assertEquals(testedSrc.isRiverFound(), testedTarget.isRiverFound());

  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:NodeJRLifecycleResponseTest.java


示例4: performserialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
/**
 * @param testedSrc
 * @return
 * @throws IOException
 */
private JRLifecycleRequest performserialization(JRLifecycleRequest testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  JRLifecycleRequest testedTarget = new JRLifecycleRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:JRLifecycleRequestTest.java


示例5: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeJRLifecycleRequest performSerializationAndBasicAsserts(NodeJRLifecycleRequest testedSrc)
    throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeJRLifecycleRequest testedTarget = new NodeJRLifecycleRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getRequest().getRiverName(), testedTarget.getRequest().getRiverName());
  Assert.assertEquals(testedSrc.getRequest().getCommand(), testedTarget.getRequest().getCommand());

  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:NodeJRLifecycleRequestTest.java


示例6: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private JRLifecycleResponse performSerializationAndBasicAsserts(JRLifecycleResponse testedSrc) throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	JRLifecycleResponse testedTarget = new JRLifecycleResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));

	Assert.assertEquals(testedSrc.getClusterName(), testedTarget.getClusterName());
	Assert.assertEquals(testedSrc.getNodes().length, testedTarget.getNodes().length);

	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:JRLifecycleResponseTest.java


示例7: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeJRStateRequest performSerializationAndBasicAsserts(NodeJRStateRequest testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeJRStateRequest testedTarget = new NodeJRStateRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getRequest().getRiverName(), testedTarget.getRequest().getRiverName());
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:9,代码来源:NodeJRStateRequestTest.java


示例8: performserialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
/**
 * @param testedSrc
 * @return
 * @throws IOException
 */
private JRStateRequest performserialization(JRStateRequest testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  JRStateRequest testedTarget = new JRStateRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:JRStateRequestTest.java


示例9: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeJRStateResponse performSerializationAndBasicAsserts(NodeJRStateResponse testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeJRStateResponse testedTarget = new NodeJRStateResponse();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getNode().getId(), testedTarget.getNode().getId());
  Assert.assertEquals(testedSrc.isRiverFound(), testedTarget.isRiverFound());
  Assert.assertEquals(testedSrc.stateInformation, testedTarget.stateInformation);
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:11,代码来源:NodeJRStateResponseTest.java


示例10: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private JRStateResponse performSerializationAndBasicAsserts(JRStateResponse testedSrc) throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	JRStateResponse testedTarget = new JRStateResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));

	Assert.assertEquals(testedSrc.getClusterName(), testedTarget.getClusterName());
	Assert.assertEquals(testedSrc.getNodes().length, testedTarget.getNodes().length);

	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:JRStateResponseTest.java


示例11: performserialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
/**
 * @param testedSrc
 * @return
 * @throws IOException
 */
private IncrementalUpdateRequest performserialization(IncrementalUpdateRequest testedSrc) throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	IncrementalUpdateRequest testedTarget = new IncrementalUpdateRequest();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));
	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:IncrementalUpdateRequestTest.java


示例12: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeIncrementalUpdateResponse performSerializationAndBasicAsserts(NodeIncrementalUpdateResponse testedSrc)
		throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	NodeIncrementalUpdateResponse testedTarget = new NodeIncrementalUpdateResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));
	Assert.assertEquals(testedSrc.getNode().getId(), testedTarget.getNode().getId());
	Assert.assertEquals(testedSrc.isRiverFound(), testedTarget.isRiverFound());
	Assert.assertEquals(testedSrc.spaceFound, testedTarget.spaceFound);
	Assert.assertEquals(testedSrc.reindexedSpaces, testedTarget.reindexedSpaces);
	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:NodeIncrementalUpdateResponseTest.java


示例13: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeIncrementalUpdateRequest performSerializationAndBasicAsserts(NodeIncrementalUpdateRequest testedSrc)
		throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	NodeIncrementalUpdateRequest testedTarget = new NodeIncrementalUpdateRequest();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));
	Assert.assertEquals(testedSrc.getRequest().getRiverName(), testedTarget.getRequest().getRiverName());
	Assert.assertEquals(testedSrc.getRequest().getSpaceKey(), testedTarget.getRequest().getSpaceKey());

	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:NodeIncrementalUpdateRequestTest.java


示例14: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeListRiversResponse performSerializationAndBasicAsserts(NodeListRiversResponse testedSrc)
		throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	NodeListRiversResponse testedTarget = new NodeListRiversResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));
	Assert.assertEquals(testedSrc.getNode().getId(), testedTarget.getNode().getId());
	Assert.assertEquals(testedSrc.getRiverNames(), testedTarget.getRiverNames());

	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:NodeListRiversResponseTest.java


示例15: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private ListRiversResponse performSerializationAndBasicAsserts(ListRiversResponse testedSrc) throws IOException {
	BytesStreamOutput out = new BytesStreamOutput();
	testedSrc.writeTo(out);
	ListRiversResponse testedTarget = new ListRiversResponse();
	testedTarget.readFrom(new BytesStreamInput(out.bytes()));

	Assert.assertEquals(testedSrc.getClusterName(), testedTarget.getClusterName());
	Assert.assertEquals(testedSrc.getNodes().length, testedTarget.getNodes().length);

	return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:12,代码来源:ListRiversResponseTest.java


示例16: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeFullUpdateResponse performSerializationAndBasicAsserts(NodeFullUpdateResponse testedSrc)
    throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeFullUpdateResponse testedTarget = new NodeFullUpdateResponse();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getNode().getId(), testedTarget.getNode().getId());
  Assert.assertEquals(testedSrc.isRiverFound(), testedTarget.isRiverFound());
  Assert.assertEquals(testedSrc.spaceFound, testedTarget.spaceFound);
  Assert.assertEquals(testedSrc.reindexedSpaces, testedTarget.reindexedSpaces);
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:NodeFullUpdateResponseTest.java


示例17: performSerializationAndBasicAsserts

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
private NodeFullUpdateRequest performSerializationAndBasicAsserts(NodeFullUpdateRequest testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  NodeFullUpdateRequest testedTarget = new NodeFullUpdateRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  Assert.assertEquals(testedSrc.getRequest().getRiverName(), testedTarget.getRequest().getRiverName());
  Assert.assertEquals(testedSrc.getRequest().getSpaceKey(), testedTarget.getRequest().getSpaceKey());

  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:11,代码来源:NodeFullUpdateRequestTest.java


示例18: performserialization

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
/**
 * @param testedSrc
 * @return
 * @throws IOException
 */
private FullUpdateRequest performserialization(FullUpdateRequest testedSrc) throws IOException {
  BytesStreamOutput out = new BytesStreamOutput();
  testedSrc.writeTo(out);
  FullUpdateRequest testedTarget = new FullUpdateRequest();
  testedTarget.readFrom(new BytesStreamInput(out.bytes()));
  return testedTarget;
}
 
开发者ID:searchisko,项目名称:elasticsearch-river-remote,代码行数:13,代码来源:FullUpdateRequestTest.java


示例19: streamInput

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
@Override
public StreamInput streamInput() {
    return new BytesStreamInput(this);
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:5,代码来源:ByteBufBytesReference.java


示例20: indexFile

import org.elasticsearch.common.io.stream.BytesStreamInput; //导入依赖的package包/类
/** Index an Amazon S3 file by retrieving its content and building the suitable Json content. */
private String indexFile(S3ObjectSummary summary){
   if (logger.isDebugEnabled()){
      logger.debug("Trying to index '{}'", summary.getKey());
   }
   
   try{
      // Build a unique id from S3 unique summary key.
      String fileId = buildIndexIdFromS3Key(summary.getKey());

      if (feedDefinition.isJsonSupport()){
         esIndex(indexName, typeName, summary.getKey(), s3.getContent(summary));
      } else {
         byte[] fileContent = s3.getContent(summary);

         if (fileContent != null) {
            // Compute number of chars to index.
            // see https://github.com/lbroudoux/es-amazon-s3-river/issues/36
            int indexedChars = 100000;
            if (feedDefinition.getIndexedCharsRatio() > 0) {
               indexedChars = (int) Math.round(fileContent.length * feedDefinition.getIndexedCharsRatio());
            }

            // Parse content using Tika directly.
            Metadata fileMetadata = new Metadata();
            String parsedContent = TikaHolder.tika().parseToString(
                  new BytesStreamInput(fileContent), fileMetadata, indexedChars);

            // Store Tika metadatas into a map.
            Map<String, Object> fileMetadataMap = new HashMap<String, Object>();
            for (String key : fileMetadata.names()) {
               fileMetadataMap.put(key, fileMetadata.get(key));
            }

            esIndex(indexName, typeName, fileId,
                  jsonBuilder()
                        .startObject()
                           .field(S3RiverUtil.DOC_FIELD_TITLE, summary.getKey().substring(summary.getKey().lastIndexOf('/') + 1))
                           .field(S3RiverUtil.DOC_FIELD_MODIFIED_DATE, summary.getLastModified().getTime())
                           .field(S3RiverUtil.DOC_FIELD_SOURCE_URL, s3.getDownloadUrl(summary, feedDefinition))
                           .field(S3RiverUtil.DOC_FIELD_METADATA, s3.getS3UserMetadata(summary.getKey()))
                           .startObject("file")
                              .field("_name", summary.getKey().substring(summary.getKey().lastIndexOf('/') + 1))
                              .field("title", summary.getKey().substring(summary.getKey().lastIndexOf('/') + 1))
                              .field("file", parsedContent)
                              .field("metadata", fileMetadataMap)
                           .endObject()
                        .endObject()
            );
            return fileId;
         }
      }
   } catch (Exception e) {
      logger.warn("Can not index " + summary.getKey() + " : " + e.getMessage());
   }
   return null;
}
 
开发者ID:lbroudoux,项目名称:es-amazon-s3-river,代码行数:58,代码来源:S3River.java



注:本文中的org.elasticsearch.common.io.stream.BytesStreamInput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleLogger类代码示例发布时间:2022-05-22
下一篇:
Java LeafSetEntryNode类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap