Class NumberInput
java.lang.Object
org.codehaus.jackson.io.NumberInput
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringTextual 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 -
Method Summary
Modifier and TypeMethodDescriptionstatic final booleaninLongRange(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 booleaninLongRange(String numberStr, boolean negative) Similar toinLongRange(char[],int,int,boolean), but with String argumentstatic doubleparseAsDouble(String input, double defaultValue) static intparseAsInt(String input, int defaultValue) static longparseAsLong(String input, long defaultValue) static final doubleparseDouble(String numStr) static final intparseInt(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 intHelper method to (more) efficiently parse integer numbers from String values.static final longparseLong(char[] digitChars, int offset, int len) static final long
-
Field Details
-
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:
-
-
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
-
parseInt
Helper method to (more) efficiently parse integer numbers from String values.- Since:
- 1.7
-
parseLong
public static final long parseLong(char[] digitChars, int offset, int len) -
parseLong
-
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
Similar toinLongRange(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
-
parseAsInt
- Since:
- 1.6
-
parseAsLong
- Since:
- 1.6
-
parseAsDouble
- Since:
- 1.6
-
parseDouble
- Throws:
NumberFormatException- Since:
- 1.8
-