BufferRecyclers (Jackson-core 2.9.0 API)
Date: 2018-01-23

com.fasterxml.jackson.core.util

## Class BufferRecyclers

- java.lang.Object
- - com.fasterxml.jackson.core.util.BufferRecyclers

-     public class BufferRecyclers
      extends Object

  Helper entity used to control access to simple buffer recyling scheme used for some encoding, decoding tasks.
  Since:
    2.9.2
  See Also:
    `BufferRecycler`, `JsonStringEncoder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static ThreadLocal<SoftReference<JsonStringEncoder>>` | `_encoderRef` This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.
    `protected static ThreadLocal<SoftReference<BufferRecycler>>` | `_recyclerRef` This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferRecyclers()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static byte[]` | `encodeAsUTF8(String text)` Helper method for encoding given String as UTF-8 encoded
    `static BufferRecycler` | `getBufferRecycler()`
    `static JsonStringEncoder` | `getJsonStringEncoder()`
    `static void` | `quoteAsJsonText(CharSequence input, StringBuilder output)`
    `static char[]` | `quoteAsJsonText(String rawText)`
    `static byte[]` | `quoteAsJsonUTF8(String rawText)`

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

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

- - ### Field Detail

    - #### _recyclerRef

          protected static final ThreadLocal<SoftReference<BufferRecycler>> _recyclerRef

      This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.

    - #### _encoderRef

          protected static final ThreadLocal<SoftReference<JsonStringEncoder>> _encoderRef

      This `ThreadLocal` contains a `SoftReference` to a `BufferRecycler` used to provide a low-cost buffer recycling between reader and writer instances.

  - ### Constructor Detail

    - #### BufferRecyclers

          public BufferRecyclers()

  - ### Method Detail

    - #### getBufferRecycler

          public static BufferRecycler getBufferRecycler()

    - #### getJsonStringEncoder

          public static JsonStringEncoder getJsonStringEncoder()

    - #### encodeAsUTF8

          public static byte[] encodeAsUTF8(String text)

      Helper method for encoding given String as UTF-8 encoded
      Since:
        2.9.4

    - #### quoteAsJsonText

          public static char[] quoteAsJsonText(String rawText)

      Since:
        2.9.4

    - #### quoteAsJsonText

          public static void quoteAsJsonText(CharSequence input,
                                             StringBuilder output)

      Since:
        2.9.4

    - #### quoteAsJsonUTF8

          public static byte[] quoteAsJsonUTF8(String rawText)

      Since:
        2.9.4

Copyright © 2008–2018 FasterXML. All rights reserved.