com.fasterxml.jackson.dataformat.csv.impl
Class TextBuffer

java.lang.Object
  extended by com.fasterxml.jackson.dataformat.csv.impl.TextBuffer

public final class TextBuffer
extends Object

Helper class for efficiently aggregating parsed and decoded textual content


Constructor Summary
TextBuffer(com.fasterxml.jackson.core.util.BufferRecycler allocator)
           
 
Method Summary
 char[] contentsAsArray()
           
 BigDecimal contentsAsDecimal()
          Convenience method for converting contents of the buffer into a BigDecimal.
 double contentsAsDouble()
          Convenience method for converting contents of the buffer into a Double value.
 String contentsAsString()
           
 char[] emptyAndGetCurrentSegment()
           
 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.
 String finishAndReturn(int lastSegmentEnd, boolean trimTrailingSpaces)
           
 char[] finishCurrentSegment()
           
 char[] getCurrentSegment()
           
 int getCurrentSegmentSize()
           
 char[] getTextBuffer()
           
 int getTextOffset()
           
 boolean hasTextAsCharacters()
           
 void releaseBuffers()
           
 void reset()
           
 void resetWithShared(char[] buf, int start, int len)
           
 void resetWithString(String value)
           
 int size()
           
 String toString()
          Note: calling this method may not be as efficient as calling contentsAsString(), since it's not guaranteed that resulting String is cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextBuffer

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

releaseBuffers

public void releaseBuffers()

reset

public void reset()

resetWithShared

public void resetWithShared(char[] buf,
                            int start,
                            int len)

resetWithString

public void resetWithString(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 String contentsAsString()

contentsAsArray

public char[] contentsAsArray()

contentsAsDecimal

public BigDecimal contentsAsDecimal()
                             throws NumberFormatException
Convenience method for converting contents of the buffer into a BigDecimal.

Throws:
NumberFormatException

contentsAsDouble

public double contentsAsDouble()
                        throws NumberFormatException
Convenience method for converting contents of the buffer into a Double value.

Throws:
NumberFormatException

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 String finishAndReturn(int lastSegmentEnd,
                              boolean trimTrailingSpaces)
Parameters:
lastSegmentEnd - End offset in the currently active segment
trimTrailingSpaces - Whether trailing spaces should be trimmed or not

finishCurrentSegment

public char[] finishCurrentSegment()

toString

public String toString()
Note: calling this method may not be as efficient as calling contentsAsString(), since it's not guaranteed that resulting String is cached.

Overrides:
toString in class Object


Copyright © 2012 fasterxml.com. All Rights Reserved.