Class NumberInput

java.lang.Object
com.fasterxml.jackson.dataformat.csv.impl.NumberInput

public final class NumberInput extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final long
    Constants needed for parsing longs from basic int parsing methods
    (package private) static final String
     
    (package private) static final String
     
    static final String
    Textual representation of a double constant that can cause nasty problems with JDK (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308).
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final boolean
    inLongRange(char[] digitChars, int offset, int len, boolean negative)
    Helper method for determining if given String representation of an integral number would fit in 64-bit Java long or not.
    static final double
     
    static final int
    parseInt(char[] digitChars, int offset, int len)
    Fast method for parsing integers that are known to fit into regular 32-bit signed int type.
    static final long
    parseLong(char[] digitChars, int offset, int len)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NASTY_SMALL_DOUBLE

      public static final String NASTY_SMALL_DOUBLE
      Textual representation of a double constant that can cause nasty problems with JDK (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308).
      See Also:
    • L_BILLION

      static final long L_BILLION
      Constants needed for parsing longs from basic int parsing methods
      See Also:
    • MIN_LONG_STR_NO_SIGN

      static final String MIN_LONG_STR_NO_SIGN
    • MAX_LONG_STR

      static final String MAX_LONG_STR
  • Constructor Details

    • NumberInput

      public NumberInput()
  • Method Details

    • parseInt

      public static final int parseInt(char[] digitChars, int offset, int len)
      Fast method for parsing integers that are known to fit into regular 32-bit signed int type. This means that length is between 1 and 9 digits (inclusive)

      Note: public to let unit tests call it

    • parseLong

      public static final long parseLong(char[] digitChars, int offset, int len)
    • inLongRange

      public static final boolean inLongRange(char[] digitChars, int offset, int len, boolean negative)
      Helper method for determining if given String representation of an integral number would fit in 64-bit Java long or not. Note that input String must NOT contain leading minus sign (even if 'negative' is set to true).
      Parameters:
      negative - Whether original number had a minus sign (which is NOT passed to this method) or not
    • parseDouble

      public static final double parseDouble(String numStr) throws NumberFormatException
      Throws:
      NumberFormatException