NumberInput (Jackson-core 2.6.0 API)
Date: 2015-07-16

com.fasterxml.jackson.core.io

## Class NumberInput

- java.lang.Object
- - com.fasterxml.jackson.core.io.NumberInput

-     public final class NumberInput
      extends Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static 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).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumberInput()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `inLongRange(char[] ch, int off, 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 boolean` | `inLongRange(String s, boolean negative)` Similar to `inLongRange(char[],int,int,boolean)`, but with String argument
    `static double` | `parseAsDouble(String s, double def)`
    `static int` | `parseAsInt(String s, int def)`
    `static long` | `parseAsLong(String s, long def)`
    `static BigDecimal` | `parseBigDecimal(char[] b)`
    `static BigDecimal` | `parseBigDecimal(char[] b, int off, int len)`
    `static BigDecimal` | `parseBigDecimal(String s)`
    `static double` | `parseDouble(String s)`
    `static int` | `parseInt(char[] ch, int off, int len)` Fast method for parsing integers that are known to fit into regular 32-bit signed int type.
    `static int` | `parseInt(String s)` Helper method to (more) efficiently parse integer numbers from String values.
    `static long` | `parseLong(char[] ch, int off, int len)`
    `static long` | `parseLong(String s)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### 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:
        Constant Field Values

  - ### Constructor Detail

    - #### NumberInput

          public NumberInput()

  - ### Method Detail

    - #### parseInt

          public static int parseInt(char[] ch,
                     int off,
                     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

    - #### parseInt

          public static int parseInt(String s)

      Helper method to (more) efficiently parse integer numbers from String values.

    - #### parseLong

          public static long parseLong(char[] ch,
                       int off,
                       int len)

    - #### parseLong

          public static long parseLong(String s)

    - #### inLongRange

          public static boolean inLongRange(char[] ch,
                            int off,
                            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

    - #### inLongRange

          public static boolean inLongRange(String s,
                            boolean negative)

      Similar to `inLongRange(char[],int,int,boolean)`, but with String argument
      Parameters:
        `negative` - Whether original number had a minus sign (which is NOT passed to this method) or not

    - #### parseAsInt

          public static int parseAsInt(String s,
                       int def)

    - #### parseAsLong

          public static long parseAsLong(String s,
                         long def)

    - #### parseAsDouble

          public static double parseAsDouble(String s,
                             double def)

    - #### parseDouble

          public static double parseDouble(String s)
                                    throws NumberFormatException

      Throws:
        `NumberFormatException`

    - #### parseBigDecimal

          public static BigDecimal parseBigDecimal(String s)
                                            throws NumberFormatException

      Throws:
        `NumberFormatException`

    - #### parseBigDecimal

          public static BigDecimal parseBigDecimal(char[] b)
                                            throws NumberFormatException

      Throws:
        `NumberFormatException`

    - #### parseBigDecimal

          public static BigDecimal parseBigDecimal(char[] b,
                                   int off,
                                   int len)
                                            throws NumberFormatException

      Throws:
        `NumberFormatException`

Copyright © 2014-2015 FasterXML. All Rights Reserved.