com.fasterxml.jackson.core.util

Class 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
    • Constructor Detail

      • BufferRecyclers

        public BufferRecyclers()
    • Method Detail

      • getBufferRecycler

        public static BufferRecycler getBufferRecycler()
        Main accessor to call for accessing possibly recycled BufferRecycler instance.
      • releaseBuffers

        public static int releaseBuffers()
        Specialized method that will release all recycled BufferRecycler if (and only if) recycler tracking has been enabled (see SYSTEM_PROPERTY_TRACK_REUSABLE_BUFFERS). This method is usually called on shutdown of the container like Application Server to ensure that no references are reachable via ThreadLocals as this may cause unintentional retention of sizable amounts of memory. It may also be called regularly if GC for some reason does not clear up SoftReferences aggressively enough.
        Returns:
        Number of buffers released, if tracking enabled (zero or more); -1 if tracking not enabled.
        Since:
        2.9.6
      • 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
      • quoteAsJsonUTF8

        public static byte[] quoteAsJsonUTF8(String rawText)
        Since:
        2.9.4

Copyright © 2008–2019 FasterXML. All rights reserved.