RxJava



rx.observables
Class StringObservable

java.lang.Object
  extended by rx.observables.StringObservable

public class StringObservable
extends java.lang.Object


Nested Class Summary
static class StringObservable.Line
           
 
Constructor Summary
StringObservable()
           
 
Method Summary
static rx.Observable<StringObservable.Line> byLine(rx.Observable<java.lang.String> source)
          Splits the Observable of Strings by lines and numbers them (zero based index)
static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src, java.nio.charset.Charset charset)
          Decodes a stream the 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 the multibyte chunks into a stream of strings that works on infinite streams and where it 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 the 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 possible infinite stream of strings into a Observable of byte arrays.
static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src, java.nio.charset.CharsetEncoder charsetEncoder)
          Encodes a possible infinite stream of strings into a Observable of byte arrays.
static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src, java.lang.String charsetName)
          Encodes a possible infinite stream of strings into a Observable of byte arrays.
static rx.Observable<byte[]> from(java.io.InputStream i)
          Reads from the bytes from a source InputStream and outputs Observable of byte[]s
static rx.Observable<byte[]> from(java.io.InputStream i, int size)
          Reads from the bytes from a source InputStream and outputs Observable of byte[]s
static rx.Observable<java.lang.String> from(java.io.Reader i)
          Reads from the characters from a source Reader and outputs Observable of Strings
static rx.Observable<java.lang.String> from(java.io.Reader i, int size)
          Reads from the characters from a source Reader and outputs Observable of Strings
static
<T> rx.Observable<java.lang.String>
join(rx.Observable<T> 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.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringObservable

public StringObservable()
Method Detail

from

public static rx.Observable<byte[]> from(java.io.InputStream i)
Reads from the bytes from a source InputStream and outputs Observable of byte[]s

Parameters:
i - Source InputStream
Returns:

from

public static rx.Observable<byte[]> from(java.io.InputStream i,
                                         int size)
Reads from the bytes from a source InputStream and outputs Observable of byte[]s

Parameters:
i - Source InputStream
size - internal buffer size
Returns:

from

public static rx.Observable<java.lang.String> from(java.io.Reader i)
Reads from the characters from a source Reader and outputs Observable of Strings

Parameters:
i - Source Reader
Returns:

from

public static rx.Observable<java.lang.String> from(java.io.Reader i,
                                                   int size)
Reads from the characters from a source Reader and outputs Observable of Strings

Parameters:
i - Source Reader
size - internal buffer size
Returns:

decode

public static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
                                                     java.lang.String charsetName)
Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where handles when a multibyte character spans two chunks.

Parameters:
src -
charsetName -
Returns:

decode

public static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
                                                     java.nio.charset.Charset charset)
Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where handles when a multibyte character spans two chunks.

Parameters:
src -
charset -
Returns:

decode

public static rx.Observable<java.lang.String> decode(rx.Observable<byte[]> src,
                                                     java.nio.charset.CharsetDecoder charsetDecoder)
Decodes a stream the multibyte chunks into a stream of strings that works on infinite streams and where it handles when a multibyte character spans two chunks. This method allows for more control over how malformed and unmappable characters are handled.

Parameters:
src -
charsetDecoder -
Returns:

encode

public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
                                           java.lang.String charsetName)
Encodes a possible infinite stream of strings into a Observable of byte arrays.

Parameters:
src -
charsetName -
Returns:

encode

public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
                                           java.nio.charset.Charset charset)
Encodes a possible infinite stream of strings into a Observable of byte arrays.

Parameters:
src -
charset -
Returns:

encode

public static rx.Observable<byte[]> encode(rx.Observable<java.lang.String> src,
                                           java.nio.charset.CharsetEncoder charsetEncoder)
Encodes a possible infinite stream of strings into a Observable of byte arrays. This method allows for more control over how malformed and unmappable characters are handled.

Parameters:
src -
charsetEncoder -
Returns:

stringConcat

public 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. Don't use this on infinite streams.

Parameters:
src -
Returns:

split

public 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.
 split(["boo:an", "d:foo"], ":") --> ["boo", "and", "foo"]
 split(["boo:an", "d:foo"], "o") --> ["b", "", ":and:f", "", ""]
 
See Pattern

Parameters:
src -
regex -
Returns:

join

public static <T> rx.Observable<java.lang.String> join(rx.Observable<T> source,
                                                       java.lang.CharSequence separator)
Concatenates the sequence of values by adding a separator between them and emitting the result once the source completes.

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".

Parameters:
source - the source sequence of CharSequence values
separator - the separator to a
Returns:
an Observable which emits a single String value having the concatenated values of the source observable with the separator between elements

byLine

public static rx.Observable<StringObservable.Line> byLine(rx.Observable<java.lang.String> source)
Splits the Observable of Strings by lines and numbers them (zero based index)

Parameters:
source -
Returns: