當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。