Class TextBuffer


  • public final class TextBuffer
    extends java.lang.Object
    Helper class for efficiently aggregating parsed and decoded textual content
    • Constructor Detail

      • TextBuffer

        public TextBuffer​(com.fasterxml.jackson.core.util.BufferRecycler allocator)
    • Method Detail

      • releaseBuffers

        public void releaseBuffers()
      • reset

        public void reset()
      • resetWithString

        public void resetWithString​(java.lang.String value)
      • size

        public int size()
        Returns:
        Number of characters currently stored by this collector
      • getTextOffset

        public int getTextOffset()
      • hasTextAsCharacters

        public boolean hasTextAsCharacters()
      • getTextBuffer

        public char[] getTextBuffer()
      • contentsAsString

        public java.lang.String contentsAsString()
      • contentsAsArray

        public char[] contentsAsArray()
      • contentsAsDecimal

        public java.math.BigDecimal contentsAsDecimal()
                                               throws java.lang.NumberFormatException
        Convenience method for converting contents of the buffer into a BigDecimal.
        Throws:
        java.lang.NumberFormatException
      • contentsAsDouble

        public double contentsAsDouble()
                                throws java.lang.NumberFormatException
        Convenience method for converting contents of the buffer into a Double value.
        Throws:
        java.lang.NumberFormatException
      • looksLikeInt

        public boolean looksLikeInt()
      • ensureNotShared

        public void ensureNotShared()
        Method called to make sure that buffer is not using shared input buffer; if it is, it will copy such contents to private buffer.
      • getCurrentSegment

        public char[] getCurrentSegment()
      • emptyAndGetCurrentSegment

        public final char[] emptyAndGetCurrentSegment()
      • getCurrentSegmentSize

        public int getCurrentSegmentSize()
      • finishAndReturn

        public java.lang.String finishAndReturn​(int lastSegmentEnd,
                                                boolean trimTrailingSpaces)
        Parameters:
        lastSegmentEnd - End offset in the currently active segment, could be 0 in the case of first character is delimiter or end-of-line
        trimTrailingSpaces - Whether trailing spaces should be trimmed or not
      • finishCurrentSegment

        public char[] finishCurrentSegment()