org.apache.hc.core5.testing.reactive

## Class ReactiveTestUtils

- java.lang.Object
- - org.apache.hc.core5.testing.reactive.ReactiveTestUtils

-     public class ReactiveTestUtils
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ReactiveTestUtils.StreamDescription`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ReactiveTestUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static io.reactivex.Single<ReactiveTestUtils.StreamDescription>` | `consumeStream(org.reactivestreams.Publisher<ByteBuffer> publisher)` Consumes the given stream and returns a data structure containing its length and digest.
    `static String` | `getStreamHash(long length)` Computes the hash of the deterministic stream (as produced by `produceStream(long)`).
    `static io.reactivex.Flowable<ByteBuffer>` | `produceStream(long length)` Produces a deterministic stream of bytes, in randomly sized chunks of up to 128kB.
    `static io.reactivex.Flowable<ByteBuffer>` | `produceStream(long length, AtomicReference<String> hash)` Produces a deterministic stream of bytes, in randomly sized chunks of up to 128kB, while computing the hash of the random data.
    `static io.reactivex.Flowable<ByteBuffer>` | `produceStream(long length, int maximumBlockSize, AtomicReference<String> hash)` Produces a deterministic stream of bytes, in randomly sized chunks, while computing the hash of the random data.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ReactiveTestUtils

          public ReactiveTestUtils()

  - ### Method Detail

    - #### produceStream

          public static io.reactivex.Flowable<ByteBuffer> produceStream(long length)

      Produces a deterministic stream of bytes, in randomly sized chunks of up to 128kB.
      Parameters:
        `length` - the number of bytes in the stream
      Returns:
        a reactive stream of bytes

    - #### produceStream

          public static io.reactivex.Flowable<ByteBuffer> produceStream(long length,
                                                        AtomicReference<String> hash)

      Produces a deterministic stream of bytes, in randomly sized chunks of up to 128kB, while computing the hash of the random data.
      Parameters:
        `length` - the number of bytes in the stream
        `hash` - an output argument for the hash, set when the end of the stream is reached; if `null`, the hash will not be computed
      Returns:
        a reactive stream of bytes

    - #### produceStream

          public static io.reactivex.Flowable<ByteBuffer> produceStream(long length,
                                                        int maximumBlockSize,
                                                        AtomicReference<String> hash)

      Produces a deterministic stream of bytes, in randomly sized chunks, while computing the hash of the random data.
      Parameters:
        `length` - the number of bytes in the stream
        `maximumBlockSize` - the maximum size of any `ByteBuffer in the stream`
        `hash` - an output argument for the hash, set when the end of the stream is reached; if `null`, the hash will not be computed
      Returns:
        a reactive stream of bytes

    - #### getStreamHash

          public static String getStreamHash(long length)

      Computes the hash of the deterministic stream (as produced by `produceStream(long)`).

    - #### consumeStream

          public static io.reactivex.Single<ReactiveTestUtils.StreamDescription> consumeStream(org.reactivestreams.Publisher<ByteBuffer> publisher)

      Consumes the given stream and returns a data structure containing its length and digest.

Copyright © 2005–2020 The Apache Software Foundation. All rights reserved.