io.vertx.rxjava.ext.auth

## Class VertxContextPRNG

- java.lang.Object
- - io.vertx.rxjava.ext.auth.VertxContextPRNG

-     public class VertxContextPRNG
      extends Object

  A secure non blocking random number generator isolated to the current context. The PRNG is bound to the vert.x context and setup to close when the context shuts down.

  When applicable, use of VertxContextPRNG rather than create new PRNG objects is helpful to keep the system entropy usage to the minimum avoiding potential blocking across the application.

  The use of VertxContextPRNG is particularly appropriate when multiple handlers use random numbers.

  NOTE: This class has been automatically generated from the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static TypeArg<VertxContextPRNG>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VertxContextPRNG(VertxContextPRNG delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static VertxContextPRNG` | `current()` Get or create a secure non blocking random number generator using the current vert.x context.
    `static VertxContextPRNG` | `current(Vertx vertx)` Get or create a secure non blocking random number generator using the current vert.x instance.
    `VertxContextPRNG` | `getDelegate()`
    `static VertxContextPRNG` | `newInstance(VertxContextPRNG arg)`
    `int` | `nextInt()` Returns a secure random int
    `String` | `nextString(int length)` Returns a Base64 mime encoded String of random data with the given length.

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

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

- - ### Field Detail

    - #### __TYPE_ARG

          public static final TypeArg<VertxContextPRNG> __TYPE_ARG

  - ### Constructor Detail

    - #### VertxContextPRNG

          public VertxContextPRNG(VertxContextPRNG delegate)

  - ### Method Detail

    - #### getDelegate

          public VertxContextPRNG getDelegate()

    - #### current

          public static VertxContextPRNG current()

      Get or create a secure non blocking random number generator using the current vert.x context. If there is no current context (i.e.: not running on the eventloop) then a `IllegalStateException` is thrown.
      Returns:
        A secure non blocking random number generator.

    - #### current

          public static VertxContextPRNG current(Vertx vertx)

      Get or create a secure non blocking random number generator using the current vert.x instance. Since the context might be different this method will attempt to use the current context first if available and then fall back to create a new instance of the PRNG.
      Parameters:
        `vertx` - a Vert.x instance.
      Returns:
        A secure non blocking random number generator.

    - #### nextString

          public String nextString(int length)

      Returns a Base64 mime encoded String of random data with the given length. The length parameter refers to the length of the String before the encoding step.
      Parameters:
        `length` - the desired string length before Base64 encoding.
      Returns:
        A base 64 encoded string.

    - #### nextInt

          public int nextInt()

      Returns a secure random int
      Returns:
        random int.

    - #### newInstance

          public static VertxContextPRNG newInstance(VertxContextPRNG arg)

Copyright © 2017. All rights reserved.