• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StringObservable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: decode

import rx.observables.StringObservable; //导入依赖的package包/类
@Test
public void decode() {
    byte[] bytes = new byte[16];
    Arrays.fill(bytes, (byte)65);

    byte[] bytes2 = new byte[16];
    Arrays.fill(bytes, (byte)65);
    bytes[15] = 10;

    Observable<byte[]> data = Observable.just(bytes, bytes, bytes2).repeat(500);

    StringObservable.decode(data, StandardCharsets.UTF_8)
    .observeOn(Schedulers.computation(), false, 1)
    .toBlocking()
    .subscribe(System.out::println);
}
 
开发者ID:akarnokd,项目名称:akarnokd-misc,代码行数:17,代码来源:LinesBackpressure.java


示例2: create

import rx.observables.StringObservable; //导入依赖的package包/类
/**
 * Creates a DocumentServiceRequest with a query.
 *
 * @param resourceType           the resource type.
 * @param relativePath           the relative URI path.
 * @param querySpec              the query.
 * @param queryCompatibilityMode the QueryCompatibilityMode mode.
 * @param headers                the request headers.
 * @return the created document service request.
 */
public static RxDocumentServiceRequest create(ResourceType resourceType,
        String relativePath,
        SqlQuerySpec querySpec,
        QueryCompatibilityMode queryCompatibilityMode,
        Map<String, String> headers) {
    OperationType operation;
    String queryText;
    switch (queryCompatibilityMode) {
    case SqlQuery:
        if (querySpec.getParameters() != null && querySpec.getParameters().size() > 0) {
            throw new IllegalArgumentException(
                    String.format("Unsupported argument in query compatibility mode '{%s}'",
                            queryCompatibilityMode.name()));
        }

        operation = OperationType.SqlQuery;
        queryText = querySpec.getQueryText();
        break;

    case Default:
    case Query:
    default:
        operation = OperationType.Query;
        queryText = querySpec.toJson();
        break;
    }

    Observable<byte[]> body = StringObservable.encode(Observable.just(queryText), StandardCharsets.UTF_8);
    return new RxDocumentServiceRequest(operation, resourceType, relativePath, body, headers);
}
 
开发者ID:Azure,项目名称:azure-documentdb-rxjava,代码行数:41,代码来源:RxDocumentServiceRequest.java


示例3: splitRxJavaStringTake5

import rx.observables.StringObservable; //导入依赖的package包/类
@Benchmark
public String splitRxJavaStringTake5() {
    return Observable.just(lines).compose(new Transformer<String, String>() {
        @Override
        public Observable<String> call(Observable<String> o) {
            return StringObservable.split(o, "\n");
        }
    }).take(5).last().toBlocking().last();
}
 
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:10,代码来源:Benchmarks.java


示例4: splitRxJavaString

import rx.observables.StringObservable; //导入依赖的package包/类
@Benchmark
public String splitRxJavaString() {
    return Observable.just(lines).compose(new Transformer<String, String>() {
        @Override
        public Observable<String> call(Observable<String> o) {
            return StringObservable.split(o, "\n");
        }
    }).last().toBlocking().last();
}
 
开发者ID:davidmoten,项目名称:rxjava2-extras,代码行数:10,代码来源:Benchmarks.java


示例5: testSplitOnStreamThatThrowsExceptionImmediately

import rx.observables.StringObservable; //导入依赖的package包/类
public void testSplitOnStreamThatThrowsExceptionImmediately() {
    RuntimeException ex = new RuntimeException("boo");
    try {
        StringObservable.split(Observable.<String> error(ex), "\n").count().toBlocking()
                .single();
        fail();
    } catch (RuntimeException e) {
        assertEquals(ex, e);
    }
}
 
开发者ID:davidmoten,项目名称:rtree-3d,代码行数:11,代码来源:StringSplitTest.java


示例6: assertEquals

import rx.observables.StringObservable; //导入依赖的package包/类
public static void assertEquals(Observable<JsonToken> in, String out) {
  TestSubscriber<Object> ts = new TestSubscriber<>();

  in.compose(RxJson.toJson())
    .compose(StringObservable::stringConcat)
    .map(s -> gson.fromJson(s, Object.class))
    .subscribe(ts);

  ts.awaitTerminalEvent();

  ts.assertNoErrors();
  ts.assertCompleted();
  ts.assertValue(gson.fromJson(out, Object.class));
}
 
开发者ID:Trunkplatform,项目名称:rxjava-json,代码行数:15,代码来源:Assert.java


示例7: assertEqualsString

import rx.observables.StringObservable; //导入依赖的package包/类
public static void assertEqualsString(Observable<JsonToken> in, String out) {
  TestSubscriber<Object> ts = new TestSubscriber<>();

  in.compose(RxJson.toJson())
    .compose(StringObservable::stringConcat)
    .subscribe(ts);

  ts.assertNoErrors();
  ts.assertCompleted();
  ts.assertValue(out);
}
 
开发者ID:Trunkplatform,项目名称:rxjava-json,代码行数:12,代码来源:Assert.java


示例8: shouldEmitComplexObjects

import rx.observables.StringObservable; //导入依赖的package包/类
@Test
public void shouldEmitComplexObjects() throws Exception {
  TestSubscriber<String> ts = new TestSubscriber<>();

  JsonArray.of(Observable.just("foo", Collections.singletonList("bar")).compose(RxJsonGson.toJsonElements()))
    .compose(RxJson.toJson())
    .compose(StringObservable::stringConcat)
    .subscribe(ts);

  ts.assertCompleted();
  ts.assertValue("[\"foo\",[\"bar\"]]");
}
 
开发者ID:Trunkplatform,项目名称:rxjava-json,代码行数:13,代码来源:TransformerRxJsonGsonTest.java


示例9: assertEquals

import rx.observables.StringObservable; //导入依赖的package包/类
private void assertEquals(Observable<JsonToken> in, String out) {
  TestSubscriber<String> ts = new TestSubscriber<>();

  in.compose(RxJson.toJson()).compose(StringObservable::stringConcat).subscribe(ts);

  ts.assertCompleted();
  ts.assertValue(out);
}
 
开发者ID:Trunkplatform,项目名称:rxjava-json,代码行数:9,代码来源:HalLinkTest.java


示例10: runFunction

import rx.observables.StringObservable; //导入依赖的package包/类
private void runFunction() {
    try {
        final String[] command = buildCommand();
        logger.debug("Executing command: {}", print(command));
        final Process process = runtime.exec(command);
        final InputStreamReader processOutputReader = new InputStreamReader(process.getInputStream());
        StringObservable.from(processOutputReader)
                .flatMap(s -> Observable.from(s.split("\n")))
                .subscribe(output);
    } catch (final IOException e) {
        logger.error("Failed to run command " + this.getClass().getName(), e);
    }
}
 
开发者ID:ekholabs,项目名称:rod,代码行数:14,代码来源:TerminalCommand.java


示例11: preprocess

import rx.observables.StringObservable; //导入依赖的package包/类
static String preprocess(Path hpp) throws IOException {
	Observable<String> globals_hpp = StringObservable.from(Files
			.newBufferedReader(hpp));
	Observable<String> o = StringObservable.split(globals_hpp, "\r?\n")
			.skipWhile(line -> BEGIN.matcher(line).matches() == false)
			.skip(2).map(line -> line.replaceAll("\\\\$", ""))
			.map(line -> line.replaceAll("/\\*.*?\\*/", ""))
			.filter(line -> line.matches("^[ ]+$") == false);
	String all = StringObservable.join(o, "").toBlockingObservable()
			.first();
	return all.replaceAll("EMBEDDED_ONLY\\(\\w*\\(.*?\\)\\)", "");
}
 
开发者ID:taichi,项目名称:joa,代码行数:13,代码来源:OptionAnalyzer.java


示例12: observeRuntimeLog

import rx.observables.StringObservable; //导入依赖的package包/类
public Observable<String> observeRuntimeLog(final Pod pod) {
	final LogWatch watcher = withDefaultUserPod(pod).watchLog();
	return StringObservable.byLine(StringObservable
			.from(new InputStreamReader(watcher.getOutput())));
}
 
开发者ID:syndesisio,项目名称:syndesis-qe,代码行数:6,代码来源:OpenShiftUtils.java


示例13: observePodLog

import rx.observables.StringObservable; //导入依赖的package包/类
public Observable<String> observePodLog(String name) {
	LogWatch watcher = client.pods().withName(name).watchLog();
	return StringObservable.byLine(StringObservable.from(new InputStreamReader(watcher.getOutput())));
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:5,代码来源:OpenShiftUtil.java


示例14: testSplitOnEmptyStream

import rx.observables.StringObservable; //导入依赖的package包/类
public void testSplitOnEmptyStream() {
    assertEquals(0, (int) StringObservable.split(Observable.<String> empty(), "\n").count()
            .toBlocking().single());
}
 
开发者ID:davidmoten,项目名称:rtree-3d,代码行数:5,代码来源:StringSplitTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PrintStreamProviderFactory类代码示例发布时间:2022-05-22
下一篇:
Java TaskHandle类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap