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


Java StreamInput.readByte方法代码示例

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


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

示例1: readOrder

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
/**
 * Reads an order from the given input (based on the id of the order).
 *
 * @see Streams#writeOrder(InternalOrder, org.elasticsearch.common.io.stream.StreamOutput)
 */
public static InternalOrder readOrder(StreamInput in) throws IOException {
    byte id = in.readByte();
    switch (id) {
        case 1: return (InternalOrder) Histogram.Order.KEY_ASC;
        case 2: return (InternalOrder) Histogram.Order.KEY_DESC;
        case 3: return (InternalOrder) Histogram.Order.COUNT_ASC;
        case 4: return (InternalOrder) Histogram.Order.COUNT_DESC;
        case 0:
            boolean asc = in.readBoolean();
            String key = in.readString();
            return new InternalOrder.Aggregation(key, asc);
        default:
            throw new RuntimeException("unknown histogram order");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:InternalOrder.java

示例2: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public static AllocationStatus readFrom(StreamInput in) throws IOException {
    byte id = in.readByte();
    switch (id) {
        case 0:
            return DECIDERS_NO;
        case 1:
            return NO_VALID_SHARD_COPY;
        case 2:
            return DECIDERS_THROTTLED;
        case 3:
            return FETCHING_SHARD_DATA;
        case 4:
            return DELAYED_ALLOCATION;
        case 5:
            return NO_ATTEMPT;
        default:
            throw new IllegalArgumentException("Unknown AllocationStatus value [" + id + "]");
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:UnassignedInfo.java

示例3: read

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public static FieldStats read(StreamInput in) throws IOException {
    FieldStats stats;
    byte type = in.readByte();
    switch (type) {
        case 0:
            stats = new Long();
            break;
        case 1:
            stats = new Float();
            break;
        case 2:
            stats = new Double();
            break;
        case 3:
            stats = new Text();
            break;
        case 4:
            stats = new Date();
            break;
        default:
            throw new IllegalArgumentException("Illegal type [" + type + "]");
    }
    stats.type = type;
    stats.readFrom(in);
    return stats;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:27,代码来源:FieldStats.java

示例4: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    preference = in.readOptionalString();
    refresh = in.readBoolean();
    byte realtime = in.readByte();
    if (realtime == 0) {
        this.realtime = false;
    } else if (realtime == 1) {
        this.realtime = true;
    }
    ignoreErrorsOnGeneratedFields = in.readBoolean();

    int size = in.readVInt();
    items = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        items.add(Item.readItem(in));
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:20,代码来源:MultiGetRequest.java

示例5: 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

示例6: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public static Result readFrom(StreamInput in) throws IOException{
    Byte opcode = in.readByte();
    switch(opcode){
        case 0:
            return CREATED;
        case 1:
            return UPDATED;
        case 2:
            return DELETED;
        case 3:
            return NOT_FOUND;
        case 4:
            return NOOP;
        default:
            throw new IllegalArgumentException("Unknown result code: " + opcode);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:DocWriteResponse.java

示例7: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
/**
 * Deserialize the SeasonalityType from the input stream
 *
 * @param in  the input stream
 * @return    SeasonalityType Enum
 */
public static SeasonalityType readFrom(StreamInput in) throws IOException {
    byte id = in.readByte();
    for (SeasonalityType seasonalityType : values()) {
        if (id == seasonalityType.id) {
            return seasonalityType;
        }
    }
    throw new IllegalStateException("Unknown Seasonality Type with id [" + id + "]");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:HoltWintersModel.java

示例8: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
/**
 * Deserialize the GapPolicy from the input stream
 *
 * @return    GapPolicy Enum
 */
public static GapPolicy readFrom(StreamInput in) throws IOException {
    byte id = in.readByte();
    for (GapPolicy gapPolicy : values()) {
        if (id == gapPolicy.id) {
            return gapPolicy;
        }
    }
    throw new IllegalStateException("Unknown GapPolicy with id [" + id + "]");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:BucketHelpers.java

示例9: readFrom

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    executionPhase = ExecutionPhases.fromStream(in);
    downstreamExecutionPhaseId = in.readVInt();
    downstreamExecutionPhaseInputId = in.readByte();
    int numExecutionNodes = in.readVInt();

    List<String> executionNodes = new ArrayList<>();
    for (int i = 0; i < numExecutionNodes; i++) {
        executionNodes.add(in.readString());
    }
    this.downstreamNodes = executionNodes;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:NodeOperation.java

示例10: UnassignedInfo

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
UnassignedInfo(StreamInput in) throws IOException {
    this.reason = Reason.values()[(int) in.readByte()];
    this.unassignedTimeMillis = in.readLong();
    // As System.nanoTime() cannot be compared across different JVMs, reset it to now.
    // This means that in master failover situations, elapsed delay time is forgotten.
    this.unassignedTimeNanos = System.nanoTime();
    this.message = in.readOptionalString();
    this.failure = in.readThrowable();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:UnassignedInfo.java

示例11: SearchSortValues

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public SearchSortValues(StreamInput in) throws IOException {
    int size = in.readVInt();
    if (size > 0) {
        sortValues = new Object[size];
        for (int i = 0; i < sortValues.length; i++) {
            byte type = in.readByte();
            if (type == 0) {
                sortValues[i] = null;
            } else if (type == 1) {
                sortValues[i] = in.readString();
            } else if (type == 2) {
                sortValues[i] = in.readInt();
            } else if (type == 3) {
                sortValues[i] = in.readLong();
            } else if (type == 4) {
                sortValues[i] = in.readFloat();
            } else if (type == 5) {
                sortValues[i] = in.readDouble();
            } else if (type == 6) {
                sortValues[i] = in.readByte();
            } else if (type == 7) {
                sortValues[i] = in.readShort();
            } else if (type == 8) {
                sortValues[i] = in.readBoolean();
            } else {
                throw new IOException("Can't match type [" + type + "]");
            }
        }
    } else {
        sortValues = new Object[0];
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:33,代码来源:SearchSortValues.java

示例12: read

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public static ValueFormatter read(StreamInput in) throws IOException {
    byte id = in.readByte();
    ValueFormatter formatter = null;
    switch (id) {
        case ValueFormatter.Raw.ID: return ValueFormatter.RAW;
        case ValueFormatter.IPv4Formatter.ID: return ValueFormatter.IPv4;
        case ValueFormatter.DateTime.ID: formatter = new ValueFormatter.DateTime(); break;
        case ValueFormatter.Number.Pattern.ID: formatter = new ValueFormatter.Number.Pattern(); break;
        case ValueFormatter.GeoHash.ID: formatter = ValueFormatter.GEOHASH; break;
        case ValueFormatter.BooleanFormatter.ID: formatter = ValueFormatter.BOOLEAN; break;
        default: throw new IllegalArgumentException("Unknown value formatter with id [" + id + "]");
    }
    formatter.readFrom(in);
    return formatter;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:ValueFormatterStreams.java

示例13: InetSocketTransportAddress

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public InetSocketTransportAddress(StreamInput in) throws IOException {
    final int len = in.readByte();
    final byte[] a = new byte[len]; // 4 bytes (IPv4) or 16 bytes (IPv6)
    in.readFully(a);
    InetAddress inetAddress = InetAddress.getByAddress(a);
    int port = in.readInt();
    this.address = new InetSocketAddress(inetAddress, port);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:9,代码来源:InetSocketTransportAddress.java

示例14: 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:baidu,项目名称:Elasticsearch,代码行数:31,代码来源:Lucene.java

示例15: readIndicesOptions

import org.elasticsearch.common.io.stream.StreamInput; //导入方法依赖的package包/类
public static IndicesOptions readIndicesOptions(StreamInput in) throws IOException {
    //if we read from a node that doesn't support the newly added flag (allowAliasesToMultipleIndices)
    //we just receive the old corresponding value with the new flag set to true (default)
    byte id = in.readByte();
    if (id >= VALUES.length) {
        throw new IllegalArgumentException("No valid missing index type id: " + id);
    }
    return VALUES[id];
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:10,代码来源:IndicesOptions.java


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