public class StringObservable
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
StringObservable.UnsafeFunc0<R>
Func0 that allows throwing an
IOExceptions commonly thrown during IO operations. |
| Constructor and Description |
|---|
StringObservable() |
| Modifier and Type | Method and Description |
|---|---|
static rx.Observable<java.lang.String> |
byCharacter(rx.Observable<java.lang.String> source)
Converts a String into an Observable that emits the chars in the String.
|
static rx.Observable<java.lang.String> |
byLine(rx.Observable<java.lang.String> source)
Splits the
Observable of Strings by line ending characters in a platform independent way. |
static rx.Observable<java.lang.String> |
decode(rx.Observable<byte[]> src,
java.nio.charset.Charset charset)
Decodes a stream of multibyte chunks into a stream of strings that works on infinite streams
and where handles when a multibyte character spans two chunks.
|
static rx.Observable<java.lang.String> |
decode(rx.Observable<byte[]> src,
java.nio.charset.CharsetDecoder charsetDecoder)
Decodes a stream of multibyte chunks into a stream of strings that works on infinite streams
and handles when a multibyte character spans two chunks.
|
static rx.Observable<java.lang.String> |
decode(rx.Observable<byte[]> src,
java.lang.String charsetName)
Decodes a stream of multibyte chunks into a stream of strings that works on infinite streams
and where handles when a multibyte character spans two chunks.
|
static rx.Observable<byte[]> |
encode(rx.Observable<java.lang.String> src,
java.nio.charset.Charset charset)
Encodes a possibly infinite stream of strings into an Observable of byte arrays.
|
static rx.Observable<byte[]> |
encode(rx.Observable<java.lang.String> src,
java.nio.charset.CharsetEncoder charsetEncoder)
Encodes a possibly infinite stream of strings into an Observable of byte arrays.
|
static rx.Observable<byte[]> |
encode(rx.Observable<java.lang.String> src,
java.lang.String charsetName)
Encodes a possibly infinite stream of strings into an Observable of byte arrays.
|
static rx.Observable<byte[]> |
from(java.io.InputStream i)
Reads bytes from a source
InputStream and outputs Observable of
byte[]s. |
static rx.Observable<byte[]> |
from(java.io.InputStream is,
int size)
Reads bytes from a source
InputStream and outputs Observable of
byte[]s. |
static rx.Observable<java.lang.String> |
from(java.io.Reader i)
Reads characters from a source
Reader and outputs Observable of
Strings. |
static rx.Observable<java.lang.String> |
from(java.io.Reader reader,
int size)
Reads characters from a source
Reader and outputs Observable of
Strings. |
static rx.Observable<java.lang.String> |
join(rx.Observable<java.lang.String> source,
java.lang.CharSequence separator)
Concatenates the sequence of values by adding a separator
between them and emitting the result once the source completes.
|
static rx.Observable<java.lang.String> |
split(rx.Observable<java.lang.String> src,
java.util.regex.Pattern pattern)
Rechunks the strings based on a regex pattern and works on infinite stream.
|
static rx.Observable<java.lang.String> |
split(rx.Observable<java.lang.String> src,
java.lang.String regex)
Rechunks the strings based on a regex pattern and works on infinite stream.
|
static rx.Observable<java.lang.String> |
stringConcat(rx.Observable<java.lang.String> src)
Gather up all of the strings in to one string to be able to use it as one message.
|
static rx.Observable<java.lang.String> |
toString(rx.Observable<?> src)
Maps
Observable<Object> to Observable<String> by using String.valueOf(Object) |
static <R,S extends java.io.Closeable> |
using(StringObservable.UnsafeFunc0<S> resourceFactory,
rx.functions.Func1<S,rx.Observable<R>> observableFactory)
Helps in creating an Observable that automatically calls
Closeable.close() on completion, error or unsubscribe. |
public static rx.Observable<byte[]> from(java.io.InputStream i)
InputStream and outputs Observable of
byte[]s. Supports backpressure.

i - Source InputStreampublic static <R,S extends java.io.Closeable> rx.Observable<R> using(StringObservable.UnsafeFunc0<S> resourceFactory, rx.functions.Func1<S,rx.Observable<R>> observableFactory)
Closeable.close() on completion, error or unsubscribe.
StringObservable.using(() -> new FileReader(file), (reader) -> StringObservable.from(reader))
resourceFactory - Generates a new Closeable resource for each new subscription to the returned ObservableobservableFactory - Converts the Closeable resource into a Observable with from(InputStream) or from(Reader)Observable that automatically closes the resource when done.public static rx.Observable<byte[]> from(java.io.InputStream is,
int size)
InputStream and outputs Observable of
byte[]s. Supports backpressure.

is - Source InputStreamsize - internal buffer sizepublic static rx.Observable<java.lang.String> from(java.io.Reader i)
Reader and outputs Observable of
Strings. Supports backpressure.

i - Source Readerpublic static rx.Observable<java.lang.String> from(java.io.Reader reader,
int size)
Reader and outputs Observable of
Strings. Supports backpressure.

i - Source Readersize - internal buffer sizepublic static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
java.lang.String charsetName)

src - charsetName - public static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
java.nio.charset.Charset charset)

src - charset - public static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
java.nio.charset.CharsetDecoder charsetDecoder)

src - charsetDecoder - public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
java.lang.String charsetName)

src - charsetName - public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
java.nio.charset.Charset charset)

src - charset - public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
java.nio.charset.CharsetEncoder charsetEncoder)

src - charsetEncoder - public static rx.Observable<java.lang.String> stringConcat(rx.Observable<java.lang.String> src)

src - public static rx.Observable<java.lang.String> toString(rx.Observable<?> src)
Observable<Object> to Observable<String> by using String.valueOf(Object)src - Observable of only Strings.public static rx.Observable<java.lang.String> split(rx.Observable<java.lang.String> src,
java.lang.String regex)
split(["boo:an", "d:foo"], ":") --> ["boo", "and", "foo"] split(["boo:an", "d:foo"], "o") --> ["b", "", ":and:f", "", ""]See
Pattern

src - the source that should be use for the splitregex - a string that build regular expression modifierpublic static rx.Observable<java.lang.String> split(rx.Observable<java.lang.String> src,
java.util.regex.Pattern pattern)
split(["boo:an", "d:foo"], ":") --> ["boo", "and", "foo"] split(["boo:an", "d:foo"], "o") --> ["b", "", ":and:f", "", ""]See
Pattern

src - the source that should be use for the splitpattern - pre compiled regular expression pattern for the split functionalitypublic static rx.Observable<java.lang.String> join(rx.Observable<java.lang.String> source,
java.lang.CharSequence separator)
The conversion from the value type to String is performed via
String.valueOf(java.lang.Object) calls.
For example:
Observable<Object> source = Observable.from("a", 1, "c");
Observable<String> result = join(source, ", ");
will yield a single element equal to "a, 1, c".source - the source sequence of CharSequence valuesseparator - the separator to apublic static rx.Observable<java.lang.String> byLine(rx.Observable<java.lang.String> source)
Observable of Strings by line ending characters in a platform independent way. It is equivalent to
split(src, "(\\r\\n)|\\n|\\r|\\u0085|\\u2028|\\u2029")

source - split(Observable, Pattern)public static rx.Observable<java.lang.String> byCharacter(rx.Observable<java.lang.String> source)

str - the source String