當前位置: 首頁>>代碼示例>>Java>>正文


Java StreamInput.readBytesRef方法代碼示例

本文整理匯總了Java中org.elasticsearch.common.io.stream.StreamInput.readBytesRef方法的典型用法代碼示例。如果您正苦於以下問題:Java StreamInput.readBytesRef方法的具體用法?Java StreamInput.readBytesRef怎麽用?Java StreamInput.readBytesRef使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.common.io.stream.StreamInput的用法示例。


在下文中一共展示了StreamInput.readBytesRef方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: Bucket

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
private Bucket(StreamInput in, DocValueFormat format, boolean keyed) throws IOException {
    this.format = format;
    this.keyed = keyed;
    key = in.readOptionalString();
    if (in.readBoolean()) {
        from = in.readBytesRef();
    } else {
        from = null;
    }
    if (in.readBoolean()) {
        to = in.readBytesRef();
    } else {
        to = null;
    }
    docCount = in.readLong();
    aggregations = InternalAggregations.readAggregations(in);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:InternalBinaryRange.java

示例2: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    id = in.readLong();
    int termsSize = in.readVInt();
    if (termsSize == 0) {
        terms = EMPTY_TERMS;
    } else {
        terms = new Term[termsSize];
        for (int i = 0; i < terms.length; i++) {
            terms[i] = new Term(in.readString(), in.readBytesRef());
        }
    }
    this.termStatistics = readTermStats(in, terms);
    readFieldStats(in, fieldStatistics);


    maxDoc = in.readVInt();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:20,代碼來源:DfsSearchResult.java

示例3: readSortValue

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
private static Comparable readSortValue(StreamInput in) throws IOException {
    byte type = in.readByte();
    if (type == 0) {
        return null;
    } else if (type == 1) {
        return in.readString();
    } else if (type == 2) {
        return in.readInt();
    } else if (type == 3) {
        return in.readLong();
    } else if (type == 4) {
        return in.readFloat();
    } else if (type == 5) {
        return in.readDouble();
    } else if (type == 6) {
        return in.readByte();
    } else if (type == 7) {
        return in.readShort();
    } else if (type == 8) {
        return in.readBoolean();
    } else if (type == 9) {
        return in.readBytesRef();
    } else {
        throw new IOException("Can't match type [" + type + "]");
    }
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:27,代碼來源:Lucene.java

示例4: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    id = in.readLong();
    int termsSize = in.readVInt();
    if (termsSize == 0) {
        terms = EMPTY_TERMS;
    } else {
        terms = new Term[termsSize];
        for (int i = 0; i < terms.length; i++) {
            terms[i] = new Term(in.readString(), in.readBytesRef());
        }
    }
    this.termStatistics = readTermStats(in, terms);
    readFieldStats(in, fieldStatistics);
    

    maxDoc = in.readVInt();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:20,代碼來源:DfsSearchResult.java

示例5: testRandomReads

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
public void testRandomReads() throws IOException {
    int length = randomIntBetween(10, scaledRandomIntBetween(PAGE_SIZE * 2, PAGE_SIZE * 20));
    BytesReference pbr = newBytesReference(length);
    StreamInput streamInput = pbr.streamInput();
    BytesRefBuilder target = new BytesRefBuilder();
    while (target.length() < pbr.length()) {
        switch (randomIntBetween(0, 10)) {
            case 6:
            case 5:
                target.append(new BytesRef(new byte[]{streamInput.readByte()}));
                break;
            case 4:
            case 3:
                BytesRef bytesRef = streamInput.readBytesRef(scaledRandomIntBetween(1, pbr.length() - target.length()));
                target.append(bytesRef);
                break;
            default:
                byte[] buffer = new byte[scaledRandomIntBetween(1, pbr.length() - target.length())];
                int offset = scaledRandomIntBetween(0, buffer.length - 1);
                int read = streamInput.read(buffer, offset, buffer.length - offset);
                target.append(new BytesRef(buffer, offset, read));
                break;
        }
    }
    assertEquals(pbr.length(), target.length());
    BytesRef targetBytes = target.get();
    assertArrayEquals(BytesReference.toBytes(pbr), Arrays.copyOfRange(targetBytes.bytes, targetBytes.offset, targetBytes.length));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:29,代碼來源:AbstractBytesReferenceTestCase.java

示例6: Bucket

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
/**
 * Read from a stream.
 */
public Bucket(StreamInput in, long subsetSize, long supersetSize, DocValueFormat format) throws IOException {
    super(in, subsetSize, supersetSize, format);
    termBytes = in.readBytesRef();
    subsetDf = in.readVLong();
    supersetDf = in.readVLong();
    score = in.readDouble();
    aggregations = InternalAggregations.readAggregations(in);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:SignificantStringTerms.java

示例7: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    int size = in.readVInt();
    termStatistics = HppcMaps.newMap(size);
    for (int i = 0; i < size; i++) {
        Term term = new Term(in.readString(), in.readBytesRef());
        TermStatistics stats = new TermStatistics(in.readBytesRef(),
                in.readVLong(),
                DfsSearchResult.subOne(in.readVLong()));
        termStatistics.put(term, stats);
    }
    fieldStatistics = DfsSearchResult.readFieldStats(in);
    maxDoc = in.readVLong();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:15,代碼來源:AggregatedDfs.java

示例8: StoreFileMetaData

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
/**
 * Read from a stream.
 */
public StoreFileMetaData(StreamInput in) throws IOException {
    name = in.readString();
    length = in.readVLong();
    checksum = in.readString();
    // TODO Why not Version.parse?
    writtenBy = Lucene.parseVersionLenient(in.readString(), FIRST_LUCENE_CHECKSUM_VERSION);
    hash = in.readBytesRef();
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:12,代碼來源:StoreFileMetaData.java

示例9: readFieldDoc

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
public static FieldDoc readFieldDoc(StreamInput in) throws IOException {
    Comparable[] cFields = new Comparable[in.readVInt()];
    for (int j = 0; j < cFields.length; j++) {
        byte type = in.readByte();
        if (type == 0) {
            cFields[j] = null;
        } else if (type == 1) {
            cFields[j] = in.readString();
        } else if (type == 2) {
            cFields[j] = in.readInt();
        } else if (type == 3) {
            cFields[j] = in.readLong();
        } else if (type == 4) {
            cFields[j] = in.readFloat();
        } else if (type == 5) {
            cFields[j] = in.readDouble();
        } else if (type == 6) {
            cFields[j] = in.readByte();
        } else if (type == 7) {
            cFields[j] = in.readShort();
        } else if (type == 8) {
            cFields[j] = in.readBoolean();
        } else if (type == 9) {
            cFields[j] = in.readBytesRef();
        } else {
            throw new IOException("Can't match type [" + type + "]");
        }
    }
    return new FieldDoc(in.readVInt(), in.readFloat(), cFields);
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:31,代碼來源:Lucene.java

示例10: readValueFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public BytesRef readValueFrom(StreamInput in) throws IOException {
    int length = in.readVInt() -1 ;
    if (length == -1) {
        return null;
    }
    return in.readBytesRef(length);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:StringType.java

示例11: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    termBytes = in.readBytesRef();
    subsetDf = in.readVLong();
    supersetDf = in.readVLong();
    score = in.readDouble();
    aggregations = InternalAggregations.readAggregations(in);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:9,代碼來源:SignificantStringTerms.java

示例12: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    termBytes = in.readBytesRef();
    docCount = in.readVLong();
    docCountError = -1;
    if (showDocCountError) {
        docCountError = in.readLong();
    }
    aggregations = InternalAggregations.readAggregations(in);
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:StringTerms.java

示例13: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    int size = in.readVInt();
    termStatistics = HppcMaps.newMap(size);
    for (int i = 0; i < size; i++) {
        Term term = new Term(in.readString(), in.readBytesRef());
        TermStatistics stats = new TermStatistics(in.readBytesRef(), 
                in.readVLong(), 
                DfsSearchResult.subOne(in.readVLong()));
        termStatistics.put(term, stats);
    }
    fieldStatistics = DfsSearchResult.readFieldStats(in);
    maxDoc = in.readVLong();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:15,代碼來源:AggregatedDfs.java

示例14: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    name = in.readString();
    length = in.readVLong();
    checksum = in.readOptionalString();
    String versionString = in.readOptionalString();
    writtenBy = Lucene.parseVersionLenient(versionString, null);
    hash = in.readBytesRef();
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:10,代碼來源:StoreFileMetaData.java

示例15: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //導入方法依賴的package包/類
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    percolatorTypeId = in.readByte();
    requestedSize = in.readVInt();
    count = in.readVLong();
    matches = new BytesRef[in.readVInt()];
    for (int i = 0; i < matches.length; i++) {
        matches[i] = in.readBytesRef();
    }
    scores = new float[in.readVInt()];
    for (int i = 0; i < scores.length; i++) {
        scores[i] = in.readFloat();
    }
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        int mSize = in.readVInt();
        Map<String, HighlightField> fields = new HashMap<>();
        for (int j = 0; j < mSize; j++) {
            fields.put(in.readString(), HighlightField.readHighlightField(in));
        }
        hls.add(fields);
    }
    aggregations = InternalAggregations.readOptionalAggregations(in);
    if (in.readBoolean()) {
        int pipelineAggregatorsSize = in.readVInt();
        List<SiblingPipelineAggregator> pipelineAggregators = new ArrayList<>(pipelineAggregatorsSize);
        for (int i = 0; i < pipelineAggregatorsSize; i++) {
            BytesReference type = in.readBytesReference();
            PipelineAggregator pipelineAggregator = PipelineAggregatorStreams.stream(type).readResult(in);
            pipelineAggregators.add((SiblingPipelineAggregator) pipelineAggregator);
        }
        this.pipelineAggregators = pipelineAggregators;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:36,代碼來源:PercolateShardResponse.java


注:本文中的org.elasticsearch.common.io.stream.StreamInput.readBytesRef方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。