java.lang.StringBuffer , with
following differences:
| Modifier and Type | Field and Description |
|---|---|
| private final BufferRecycler | |
| private char[] | |
| private int | _currentSize
Number of characters in currently active (last) segment |
| private boolean | _hasSegments
Flag that indicates whether _seqments is non-empty |
| private char[] | _inputBuffer
Shared input buffer; stored here in case some input can be returned as is, without being copied to collector's own buffers. |
| private int | |
| private int | _inputStart
Character offset of first char in input buffer; -1 to indicate that input buffer currently does not contain any useful char data |
| private char[] | |
| private String | _resultString
String that will be constructed when the whole contents are needed; will be temporarily stored in case asked for again. |
| private ArrayList | _segments
List of segments prior to currently active segment. |
| private int | _segmentSize
Amount of characters in segments in |
| pack-priv static final int | MAX_SEGMENT_LEN
Let's limit maximum segment length to something sensible. |
| pack-priv static final int | MIN_SEGMENT_LEN
Let's start with sizable but not huge buffer, will grow as necessary Reduced from 1000 down to 500 in 2.10. |
| pack-priv static final char[] |
| Access | Constructor and Description |
|---|---|
| public | |
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private String | |
| protected void | |
| public void | |
| public void | append(char[]
char array to append c, int the start index within the array (from which we read chars to append) start, int number of chars to take from the array len)
|
| public void | |
| private char[] | |
| private char[] | |
| private void | |
| public char[] | |
| public BigDecimal | Returns: Buffered text value parsed as aBigDecimal, if possible
Deprecated
Since 2.15 just access String contents if necessary, call
NumberInput#parseBigDecimal(String, boolean) (or other overloads)
directly instead
|
| public double | Returns: Buffered text value parsed as aDouble, if possiblewhether to use useFastParser)FastDoubleParserConvenience method for converting contents of the buffer into a Double value. |
| public double | Returns: Buffered text value parsed as aDouble, if possible
Deprecated
use
Convenience method for converting contents of the buffer
into a Double value.
contentsAsDouble(boolean)
|
| public float | Returns: Buffered text value parsed as aFloat, if possible
Deprecated
use
Convenience method for converting contents of the buffer
into a Float value.
contentsAsFloat(boolean)
|
| public float | Returns: Buffered text value parsed as aFloat, if possiblewhether to use useFastParser)FastDoubleParserConvenience method for converting contents of the buffer into a Float value. |
| public int | Returns: Buffered text value parsed as anint using
NumberInput#parseInt(String) method (which does NOT validate input)Whether contents start with a minus sign neg)Specialized convenience method that will decode a 32-bit int, of at most 9 digits (and possible leading minus sign). |
| public long | Returns: Buffered text value parsed as anlong using
NumberInput#parseLong(String) method (which does NOT validate input)Whether contents start with a minus sign neg)Specialized convenience method that will decode a 64-bit int, of at most 18 digits (and possible leading minus sign). |
| public String | Returns: Aggregated buffered contents as ajava.Accessor that may be used to get the contents of this buffer as a single
|
| public int | Returns: Number of characters written (same assize())Writer to use for writing out buffered content w)Accessor that will write buffered contents using given |
| public char[] | |
| 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. |
| private void | |
| public char[] | Returns: Expanded current segmentMethod called to expand size of the current segment, to accommodate for more contiguous content. |
| public char[] | Returns: Expanded current segmentRequired minimum strength of the current segment minSize)Method called to expand size of the current segment, to accommodate for more contiguous content. |
| public String | Returns: token as textEnd offset in the currently active segment,
could be 0 in the case of first character is
delimiter or end-of-line lastSegmentEnd, boolean Whether trailing spaces should be trimmed or not trimTrailingSpaces)
|
| public char[] | |
| public static TextBuffer | Returns: TextBuffer constructedInitial, full segment to use for creating buffer (buffer
initialSegment)size() would return length of initialSegment)Factory method for constructing an instance with no allocator, and with initial full segment. |
| public char[] | Returns: Currently active (last) content segmentMethod for accessing the currently active (last) content segment without changing state of the buffer |
| public char[] | |
| public int | |
| public char[] | Returns: Aggregatedchar[] that contains all buffered contentAccessor that may be used to get the contents of this buffer as a single
|
| public int | |
| public boolean | Returns: True if access via getTextBuffer() would be efficient
(that is, content already available as aggregated char[])Method that can be used to check whether textual contents can
be efficiently accessed using |
| public void | releaseBuffers()
Method called to indicate that the underlying buffers should now be recycled if they haven't yet been recycled. |
| public void | |
| public void | resetWithCopy(char[]
Buffer that contains new contents buf, int Offset of the first content character in offset, int bufLength of content in len)buf
|
| public void | resetWithCopy(String
String that contains new contents text, int Offset of the first content character in start, int textLength of content in len)text
|
| public void | resetWithEmpty()
Method called to clear out any content text buffer may have, and initializes buffer to use non-shared data. |
| public void | resetWithShared(char[]
Buffer that contains shared contents buf, int Offset of the first content character in offset, int bufLength of content in len)bufMethod called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. |
| public void | |
| private char[] | |
| public String | Returns: String that contains all buffered contentLength of content (in characters) of the current active segment len)Convenience method that finishes the current active content segment
(by specifying how many characters within consists of valid content)
and aggregates and returns resulting contents (similar to a call
to |
| public void | |
| public int | |
| public String | toString()
Overrides java. Note calling this method may not be as efficient as calling
|
| private void | unshare(int needExtra)
Method called if/when we need to append content when we have been initialized to use shared buffer. |
| private void | |
| protected void | validateStringLength(int
Length of string in input units length)Convenience method that can be used to verify that a String
of specified length does not exceed maximum specific by this
constraints object: if it does, a
|
| _allocator | back to summary |
|---|---|
| private final BufferRecycler _allocator | |
| _currentSegment | back to summary |
|---|---|
| private char[] _currentSegment | |
| _currentSize | back to summary |
|---|---|
| private int _currentSize Number of characters in currently active (last) segment | |
| _hasSegments | back to summary |
|---|---|
| private boolean _hasSegments Flag that indicates whether _seqments is non-empty | |
| _inputBuffer | back to summary |
|---|---|
| private char[] _inputBuffer Shared input buffer; stored here in case some input can be returned as is, without being copied to collector's own buffers. Note that this is read-only for this Object. | |
| _inputLen | back to summary |
|---|---|
| private int _inputLen | |
| _inputStart | back to summary |
|---|---|
| private int _inputStart Character offset of first char in input buffer; -1 to indicate that input buffer currently does not contain any useful char data | |
| _resultArray | back to summary |
|---|---|
| private char[] _resultArray | |
| _resultString | back to summary |
|---|---|
| private String _resultString String that will be constructed when the whole contents are needed; will be temporarily stored in case asked for again. | |
| _segments | back to summary |
|---|---|
| private ArrayList<char[]> _segments List of segments prior to currently active segment. | |
| _segmentSize | back to summary |
|---|---|
| private int _segmentSize Amount of characters in segments in | |
| MAX_SEGMENT_LEN | back to summary |
|---|---|
| pack-priv static final int MAX_SEGMENT_LEN Let's limit maximum segment length to something sensible. For 2.10, let's limit to using 64kc chunks (128 kB) -- was 256kC/512kB up to 2.9 | |
| MIN_SEGMENT_LEN | back to summary |
|---|---|
| pack-priv static final int MIN_SEGMENT_LEN Let's start with sizable but not huge buffer, will grow as necessary Reduced from 1000 down to 500 in 2.10. | |
| NO_CHARS | back to summary |
|---|---|
| pack-priv static final char[] NO_CHARS | |
| TextBuffer | back to summary |
|---|---|
| public TextBuffer(BufferRecycler allocator) | |
| TextBuffer | back to summary |
|---|---|
| protected TextBuffer(BufferRecycler allocator, char[] initialSegment) | |
| _doTrim | back to summary |
|---|---|
| private String _doTrim(int ptr) throws IOException | |
| _reportBufferOverflow | back to summary |
|---|---|
| protected void _reportBufferOverflow(int prev, int curr) | |
| append | back to summary |
|---|---|
public void append(char c) throws IOException
| |
| append | back to summary |
|---|---|
public void append(char[] c, int start, int len) throws IOException
| |
| append | back to summary |
|---|---|
public void append(String str, int offset, int len) throws IOException
| |
| buf | back to summary |
|---|---|
| private char[] buf(int needed) | |
| carr | back to summary |
|---|---|
| private char[] carr(int len) | |
| clearSegments | back to summary |
|---|---|
| private void clearSegments() | |
| contentsAsArray | back to summary |
|---|---|
public char[] contentsAsArray() throws IOException
| |
| contentsAsDecimal | back to summary |
|---|---|
| public BigDecimal contentsAsDecimal() throws NumberFormatException
Deprecated Since 2.15 just access String contents if necessary, call
| |
| contentsAsDouble | back to summary |
|---|---|
| public double contentsAsDouble(final boolean useFastParser) throws NumberFormatException Convenience method for converting contents of the buffer into a Double value.
| |
| contentsAsDouble | back to summary |
|---|---|
| public double contentsAsDouble() throws NumberFormatException
Deprecated Convenience method for converting contents of the buffer into a Double value.
| |
| contentsAsFloat | back to summary |
|---|---|
| public float contentsAsFloat() throws NumberFormatException
Deprecated Convenience method for converting contents of the buffer into a Float value.
| |
| contentsAsFloat | back to summary |
|---|---|
| public float contentsAsFloat(final boolean useFastParser) throws NumberFormatException Convenience method for converting contents of the buffer into a Float value.
| |
| contentsAsInt | back to summary |
|---|---|
| public int contentsAsInt(boolean neg) Specialized convenience method that will decode a 32-bit int, of at most 9 digits (and possible leading minus sign). Note method DOES NOT verify that the contents actually are a valid
Java
| |
| contentsAsLong | back to summary |
|---|---|
| public long contentsAsLong(boolean neg) Specialized convenience method that will decode a 64-bit int, of at most 18 digits (and possible leading minus sign). Note method DOES NOT verify that the contents actually are a valid
Java
| |
| contentsAsString | back to summary |
|---|---|
| public String contentsAsString() throws IOException Accessor that may be used to get the contents of this buffer as a single
| |
| contentsToWriter | back to summary |
|---|---|
| public int contentsToWriter(Writer w) throws IOException Accessor that will write buffered contents using given
| |
| emptyAndGetCurrentSegment | back to summary |
|---|---|
| public char[] emptyAndGetCurrentSegment() | |
| ensureNotShared | back to summary |
|---|---|
| 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. | |
| expand | back to summary |
|---|---|
| private void expand() | |
| expandCurrentSegment | back to summary |
|---|---|
| public char[] expandCurrentSegment() Method called to expand size of the current segment, to accommodate for more contiguous content. Usually only used when parsing tokens like names if even then. Method will both expand the segment and return it
| |
| expandCurrentSegment | back to summary |
|---|---|
| public char[] expandCurrentSegment(int minSize) Method called to expand size of the current segment, to accommodate for more contiguous content. Usually only used when parsing tokens like names if even then.
| |
| finishAndReturn | back to summary |
|---|---|
public String finishAndReturn(int lastSegmentEnd, boolean trimTrailingSpaces) throws IOException
| |
| finishCurrentSegment | back to summary |
|---|---|
public char[] finishCurrentSegment() throws IOException
| |
| fromInitial | back to summary |
|---|---|
| public static TextBuffer fromInitial(char[] initialSegment) Factory method for constructing an instance with no allocator, and with initial full segment.
| |
| getBufferWithoutReset | back to summary |
|---|---|
| public char[] getBufferWithoutReset() Method for accessing the currently active (last) content segment without changing state of the buffer
| |
| getCurrentSegment | back to summary |
|---|---|
| public char[] getCurrentSegment() | |
| getCurrentSegmentSize | back to summary |
|---|---|
| public int getCurrentSegmentSize() | |
| getTextBuffer | back to summary |
|---|---|
| public char[] getTextBuffer() throws IOException Accessor that may be used to get the contents of this buffer as a single
| |
| getTextOffset | back to summary |
|---|---|
| public int getTextOffset() | |
| hasTextAsCharacters | back to summary |
|---|---|
| public boolean hasTextAsCharacters() Method that can be used to check whether textual contents can
be efficiently accessed using
| |
| releaseBuffers | back to summary |
|---|---|
| public void releaseBuffers() Method called to indicate that the underlying buffers should now be recycled if they haven't yet been recycled. Although caller can still use this text buffer, it is not advisable to call this method if that is likely, since next time a buffer is needed, buffers need to reallocated. Note since Jackson 2.11, calling this method will NOT clear already
aggregated contents (that is, | |
| resetWith | back to summary |
|---|---|
| public void resetWith(char ch) Method for clearing out possibly existing content, and replacing them with
a single-character content (so
| |
| resetWithCopy | back to summary |
|---|---|
public void resetWithCopy(char[] buf, int offset, int len) throws IOException
| |
| resetWithCopy | back to summary |
|---|---|
public void resetWithCopy(String text, int start, int len) throws IOException
| |
| resetWithEmpty | back to summary |
|---|---|
| public void resetWithEmpty() Method called to clear out any content text buffer may have, and initializes buffer to use non-shared data. | |
| resetWithShared | back to summary |
|---|---|
| public void resetWithShared(char[] buf, int offset, int len) Method called to initialize the buffer with a shared copy of data; this means that buffer will just have pointers to actual data. It also means that if anything is to be appended to the buffer, it will first have to unshare it (make a local copy).
| |
| resetWithString | back to summary |
|---|---|
public void resetWithString(String value) throws IOException
| |
| resultArray | back to summary |
|---|---|
| private char[] resultArray() throws IOException | |
| setCurrentAndReturn | back to summary |
|---|---|
| public String setCurrentAndReturn(int len) throws IOException Convenience method that finishes the current active content segment
(by specifying how many characters within consists of valid content)
and aggregates and returns resulting contents (similar to a call
to
| |
| setCurrentLength | back to summary |
|---|---|
| public void setCurrentLength(int len) | |
| size | back to summary |
|---|---|
public int size()
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Note calling this method may not be as efficient as calling
| |
| unshare | back to summary |
|---|---|
| private void unshare(int needExtra) Method called if/when we need to append content when we have been initialized to use shared buffer. | |
| validateAppend | back to summary |
|---|---|
| private void validateAppend(int toAppend) throws IOException | |
| validateStringLength | back to summary |
|---|---|
| protected void validateStringLength(int length) throws IOException Convenience method that can be used to verify that a String
of specified length does not exceed maximum specific by this
constraints object: if it does, a
| |