本文整理汇总了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);
}
示例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();
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例8: action
import org.elasticsearch.common.io.stream.Streamable; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public <T extends Streamable> T action() {
return (T) action;
}
示例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;
}