Java Code Examples for com.github.davidmoten.rx.Strings

The following examples show how to use com.github.davidmoten.rx.Strings. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: rxjava-extras   Source File: StringsMoreTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Observable<String> call(Observable<String> o) {
    return o.flatMap(new Func1<String, Observable<String>>() {

        @Override
        public Observable<String> call(String filename) {
            return Strings.from(new File(filename));
        }
    });
}
 
Example 2
Source Project: rxjava-extras   Source File: StringSplitMoreTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public Observable<String> call(Observable<String> o) {
    return Strings.split(o, ":");
}
 
Example 3
Source Project: rxjava-extras   Source File: StringsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testTrim() {
    assertEquals("trimmed", Strings.trim().call("  \ttrimmed\r\n   "));
}
 
Example 4
Source Project: rxjava-extras   Source File: StringsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testTrimOnNullInputReturnsNull() {
    assertNull(Strings.trim().call(null));
}
 
Example 5
Source Project: rxjava-extras   Source File: StringsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testJoinTwo() {
    assertEquals("a,b", Strings.join(just("a", "b"), ",").toBlocking().single());
}
 
Example 6
Source Project: rxjava-extras   Source File: StringsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testJoinOne() {
    assertEquals("a", Strings.join(just("a")).toBlocking().single());
}
 
Example 7
Source Project: rxjava-extras   Source File: StringsTest.java    License: Apache License 2.0 4 votes vote down vote up
@Test
public void testJoinNone() {
    assertEquals(0,
            Strings.join(Observable.<String> empty()).toList().toBlocking().single().size());
}
 
Example 8
Source Project: rxjava-jdbc   Source File: Database.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns an {@link Observable} that is the result of running a sequence of
 * update commands (insert/update/delete, ddl) commands read from an
 * {@link InputStream} with the given {@link Charset} using the given
 * delimiter as the statement delimiter (for example semicolon).
 * 
 * @param is
 * @param delimiter
 * @return
 */
public Observable<Integer> run(InputStream is, Charset charset, String delimiter) {
    return Strings.split(Strings.from(new InputStreamReader(is, charset)), ";") //
            .compose(run());
}