Package io.vertx.httpproxy

## Interface BodyTransformers

-     public interface BodyTransformers

  Range of transformers ready to be used.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `DEFAULT_MAX_BUFFERED_SIZE` | The default maximum amount of bytes synchronous transformers apply

  - ### Method Summary

    Static Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static BodyTransformer` | `discard()` | Create a transformer that discards the body, the transformer consumes any media type.
    `static BodyTransformer` | `jsonArray​(long maxBufferedBytes, Function<JsonArray,​JsonArray> transformer)` | Create a body transformer that transforms JSON array to JSON array, the transformer consumes and produces `application/json`.
    `static BodyTransformer` | `jsonArray​(Function<JsonArray,​JsonArray> transformer)` | Like `jsonArray(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.
    `static BodyTransformer` | `jsonObject​(long maxBufferedBytes, Function<JsonObject,​JsonObject> transformer)` | Create a body transformer that transforms JSON object to JSON object, the transformer consumes and produces `application/json`.
    `static BodyTransformer` | `jsonObject​(Function<JsonObject,​JsonObject> transformer)` | Like `jsonObject(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.
    `static BodyTransformer` | `jsonValue​(long maxBufferedBytes, Function<Object,​Object> transformer)` | Create a body transformer that transforms JSON value to JSON value, the transformer consumes and produces `application/json`.
    `static BodyTransformer` | `jsonValue​(Function<Object,​Object> transformer)` | Like `jsonValue(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.
    `static BodyTransformer` | `text​(long maxBufferedBytes, Function<String,​String> transformer, String encoding)` | Create a transformer that transforms text to text, the transformer consumes and produces `text/plain`.
    `static BodyTransformer` | `text​(Function<String,​String> transformer, String encoding)` | Like `text(long, Function, String)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.
    `static BodyTransformer` | `transform​(MediaType consumes, MediaType produces, long maxBufferedBytes, Function<Buffer,​Buffer> transformer)` | Create a body transformer that transforms `consumes` media type to the `produces` media type, by applying the `transformer` function.
    `static BodyTransformer` | `transform​(MediaType consumes, MediaType produces, Function<Buffer,​Buffer> transformer)` | Like `transform(MediaType, MediaType, long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

- - ### Field Detail

    - #### DEFAULT_MAX_BUFFERED_SIZE

          static final long DEFAULT_MAX_BUFFERED_SIZE

      The default maximum amount of bytes synchronous transformers apply
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### transform

          static BodyTransformer transform​(MediaType consumes,
                                           MediaType produces,
                                           Function<Buffer,​Buffer> transformer)

      Like `transform(MediaType, MediaType, long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

    - #### transform

          static BodyTransformer transform​(MediaType consumes,
                                           MediaType produces,
                                           long maxBufferedBytes,
                                           Function<Buffer,​Buffer> transformer)

      Create a body transformer that transforms `consumes` media type to the `produces` media type, by applying the `transformer` function.

      The transformer buffers up to `maxBufferedBytes` and then apply the `transformer` function. When the body exceeds the limit, the transformes signal an error and fail the transformation.

      Parameters:
        `consumes` - the consumed media type
        `produces` - the produced media type
        `maxBufferedBytes` - the maximum amount of bytes buffered by the body transformer
        `transformer` - the transformer
      Returns:
        the body transformer

    - #### jsonObject

          static BodyTransformer jsonObject​(long maxBufferedBytes,
                                            Function<JsonObject,​JsonObject> transformer)

      Create a body transformer that transforms JSON object to JSON object, the transformer consumes and produces `application/json`.
      Parameters:
        `maxBufferedBytes` - the maximum amount of bytes buffered by the body transformer
        `transformer` - the transformer function
      Returns:
        the transformer instance

    - #### jsonObject

          static BodyTransformer jsonObject​(Function<JsonObject,​JsonObject> transformer)

      Like `jsonObject(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

    - #### jsonArray

          static BodyTransformer jsonArray​(long maxBufferedBytes,
                                           Function<JsonArray,​JsonArray> transformer)

      Create a body transformer that transforms JSON array to JSON array, the transformer consumes and produces `application/json`.
      Parameters:
        `maxBufferedBytes` - the maximum amount of bytes buffered by the body transformer
        `transformer` - the transformer function
      Returns:
        the transformer instance

    - #### jsonArray

          static BodyTransformer jsonArray​(Function<JsonArray,​JsonArray> transformer)

      Like `jsonArray(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

    - #### jsonValue

          static BodyTransformer jsonValue​(long maxBufferedBytes,
                                           Function<Object,​Object> transformer)

      Create a body transformer that transforms JSON value to JSON value, the transformer consumes and produces `application/json`.
      Parameters:
        `maxBufferedBytes` - the maximum amount of bytes buffered by the body transformer
        `transformer` - the transformer function
      Returns:
        the transformer instance

    - #### jsonValue

          static BodyTransformer jsonValue​(Function<Object,​Object> transformer)

      Like `jsonValue(long, Function)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

    - #### text

          static BodyTransformer text​(long maxBufferedBytes,
                                      Function<String,​String> transformer,
                                      String encoding)

      Create a transformer that transforms text to text, the transformer consumes and produces `text/plain`.
      Parameters:
        `maxBufferedBytes` - the maximum amount of bytes buffered by the body transformer
        `transformer` - the transformer function
      Returns:
        the transformer instance

    - #### text

          static BodyTransformer text​(Function<String,​String> transformer,
                                      String encoding)

      Like `text(long, Function, String)` with `DEFAULT_MAX_BUFFERED_SIZE` maximum buffered bytes.

    - #### discard

          static BodyTransformer discard()

      Create a transformer that discards the body, the transformer consumes any media type.
      Returns:
        the transformer instance