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


Java Streamable类代码示例

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


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

示例1: roundTrip

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
private void roundTrip(Version version, Streamable example, Streamable empty) throws IOException {
    BytesStreamOutput out = new BytesStreamOutput();
    out.setVersion(version);
    example.writeTo(out);
    StreamInput in = out.bytes().streamInput();
    in.setVersion(version);
    empty.readFrom(in);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:RoundTripTests.java

示例2: serialize

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
private static BytesReference serialize(Version version, Streamable streamable) throws IOException {
    BytesStreamOutput output = new BytesStreamOutput();
    output.setVersion(version);
    streamable.writeTo(output);
    output.flush();
    return output.bytes();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:ElasticsearchAssertions.java

示例3: tryCreateNewInstance

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
private static Streamable tryCreateNewInstance(Streamable streamable) throws NoSuchMethodException, InstantiationException,
        IllegalAccessException, InvocationTargetException {
    try {
        Class<? extends Streamable> clazz = streamable.getClass();
        Constructor<? extends Streamable> constructor = clazz.getConstructor();
        assertThat(constructor, Matchers.notNullValue());
        Streamable newInstance = constructor.newInstance();
        return newInstance;
    } catch (Exception e) {
        return null;
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:ElasticsearchAssertions.java

示例4: testAssertVersionSerializableIsOkWithIllegalArgumentException

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
public void testAssertVersionSerializableIsOkWithIllegalArgumentException() {
    Version version = randomVersion(random());
    NamedWriteableRegistry registry = new NamedWriteableRegistry(emptyList());
    Streamable testStreamable = new TestStreamable();

    // Should catch the exception and do nothing.
    assertVersionSerializable(version, testStreamable, registry);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:ElasticsearchAssertionsTests.java

示例5: assertVersionSerializable

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
private void assertVersionSerializable(Streamable streamable) {
    Version version = VersionUtils.randomVersionBetween(random, Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
    ElasticsearchAssertions.assertVersionSerializable(version, streamable, namedWriteableRegistry);

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:6,代码来源:AssertingTransportInterceptor.java

示例6: assertVersionSerializable

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
public static void assertVersionSerializable(Streamable streamable) {
    assertTrue(Version.CURRENT.after(VersionUtils.getPreviousVersion()));
    assertVersionSerializable(randomVersion(random()), streamable);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:ElasticsearchAssertions.java

示例7: Result

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
public Result(Streamable action, DocWriteResponse.Result result, Map<String, Object> updatedSourceAsMap, XContentType updateSourceContentType) {
    this.action = action;
    this.result = result;
    this.updatedSourceAsMap = updatedSourceAsMap;
    this.updateSourceContentType = updateSourceContentType;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:UpdateHelper.java

示例8: action

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Streamable> T action() {
    return (T) action;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:UpdateHelper.java

示例9: Result

import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
public Result(Streamable action, Operation operation, Map<String, Object> updatedSourceAsMap, XContentType updateSourceContentType) {
    this.action = action;
    this.operation = operation;
    this.updatedSourceAsMap = updatedSourceAsMap;
    this.updateSourceContentType = updateSourceContentType;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:7,代码来源:UpdateHelper.java


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