本文整理汇总了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;未经允许,请勿转载。 |
请发表评论