Package org.postgresql.util
Class NumberParser
- java.lang.Object
-
- org.postgresql.util.NumberParser
-
public class NumberParser extends java.lang.Object
Optimised byte[] to number parser.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.NumberFormatException
FAST_NUMBER_FAILED
private static long
MAX_LONG_DIV_TEN
-
Constructor Summary
Constructors Constructor Description NumberParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getFastLong(byte[] bytes, long minVal, long maxVal)
Optimised byte[] to number parser.
-
-
-
Field Detail
-
FAST_NUMBER_FAILED
private static final java.lang.NumberFormatException FAST_NUMBER_FAILED
-
MAX_LONG_DIV_TEN
private static final long MAX_LONG_DIV_TEN
- See Also:
- Constant Field Values
-
-
Method Detail
-
getFastLong
public static long getFastLong(byte[] bytes, long minVal, long maxVal) throws java.lang.NumberFormatException
Optimised byte[] to number parser. This code does not handle null values, so the caller must do checkResultSet and handle null values prior to calling this function. Fraction part is discarded.- Parameters:
bytes
- integer represented as a sequence of ASCII bytes- Returns:
- The parsed number.
- Throws:
java.lang.NumberFormatException
- If the number is invalid or the out of range for fast parsing. The value must then be parsed by another (less optimised) method.
-
-