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


Java StreamInput.getVersion方法代码示例

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


在下文中一共展示了StreamInput.getVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TransportAddress

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
/**
 * Read from a stream and use the {@code hostString} when creating the InetAddress if the input comes from a version prior
 * {@link Version#V_5_0_3_UNRELEASED} as the hostString was not serialized
 */
public TransportAddress(StreamInput in, @Nullable String hostString) throws IOException {
    if (in.getVersion().before(Version.V_6_0_0_alpha1_UNRELEASED)) { // bwc layer for 5.x where we had more than one transport address
        final short i = in.readShort();
        if(i != 1) { // we fail hard to ensure nobody tries to use some custom transport address impl even if that is difficult to add
            throw new AssertionError("illegal transport ID from node of version: " + in.getVersion()  + " got: " + i + " expected: 1");
        }
    }
    final int len = in.readByte();
    final byte[] a = new byte[len]; // 4 bytes (IPv4) or 16 bytes (IPv6)
    in.readFully(a);
    final InetAddress inetAddress;
    if (in.getVersion().onOrAfter(Version.V_5_0_3_UNRELEASED)) {
        String host = in.readString(); // the host string was serialized so we can ignore the passed in version
        inetAddress = InetAddress.getByAddress(host, a);
    } else {
        // prior to this version, we did not serialize the host string so we used the passed in version
        inetAddress = InetAddress.getByAddress(hostString, a);
    }
    int port = in.readInt();
    this.address = new InetSocketAddress(inetAddress, port);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:TransportAddress.java

示例2: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    bytes = in.readBytesReference();
    version = in.getVersion();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:BytesTransportRequest.java

示例3: CompressedStreamInput

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public CompressedStreamInput(StreamInput in) throws IOException {
    this.in = in;
    super.setVersion(in.getVersion());
    readHeader(in);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:6,代码来源:CompressedStreamInput.java


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