org.codehaus.jackson.io
Class NumberInput

java.lang.Object
  extended by org.codehaus.jackson.io.NumberInput

public final class NumberInput
extends Object


Constructor Summary
NumberInput()
           
 
Method Summary
static 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 boolean inLongRange(String numberStr, boolean negative)
          Similar to inLongRange(char[],int,int,boolean), but with String argument
static 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 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
 

Constructor Detail

NumberInput

public NumberInput()
Method Detail

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

inLongRange

public static final boolean inLongRange(String numberStr,
                                        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
Since:
1.5.0