com.github.davidmoten.rx.Strings Java Examples

The following examples show how to use com.github.davidmoten.rx.Strings. 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 File: StringsMoreTest.java    From rxjava-extras with 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 File: StringSplitMoreTest.java    From rxjava-extras with 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 File: StringsTest.java    From rxjava-extras with 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 File: StringsTest.java    From rxjava-extras with Apache License 2.0 4 votes vote down vote up
@Test
public void testTrimOnNullInputReturnsNull() {
    assertNull(Strings.trim().call(null));
}
 
Example #5
Source File: StringsTest.java    From rxjava-extras with 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 File: StringsTest.java    From rxjava-extras with 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 File: StringsTest.java    From rxjava-extras with 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 File: Database.java    From rxjava-jdbc with 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());
}