Package ch.randelshofer.fastdoubleparser
Class JavaBigDecimalFromCharArray
java.lang.Object
ch.randelshofer.fastdoubleparser.AbstractNumberParser
ch.randelshofer.fastdoubleparser.AbstractBigDecimalParser
ch.randelshofer.fastdoubleparser.JavaBigDecimalFromCharArray
Parses a
double from a byte array.-
Field Summary
Fields inherited from class ch.randelshofer.fastdoubleparser.AbstractBigDecimalParser
MANY_DIGITS_THRESHOLD, MAX_DIGITS_WITHOUT_LEADING_ZEROS, MAX_EXPONENT_NUMBER, RECURSION_THRESHOLDFields inherited from class ch.randelshofer.fastdoubleparser.AbstractNumberParser
CHAR_TO_HEX_MAP, DECIMAL_POINT_CLASS, ILLEGAL_OFFSET_OR_ILLEGAL_LENGTH, OTHER_CLASS, SYNTAX_ERROR, SYNTAX_ERROR_BITS, VALUE_EXCEEDS_LIMITS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionparseBigDecimalString(char[] str, int offset, int length) Parses aBigDecimalStringas specified inJavaBigDecimalParser.(package private) BigDecimalparseBigDecimalStringWithManyDigits(char[] str, int offset, int length) Parses a big decimal string that has many digits.(package private) BigDecimalvalueOfBigDecimalString(char[] str, int integerPartIndex, int decimalPointIndex, int nonZeroFractionalPartIndex, int exponentIndicatorIndex, boolean isNegative, int exponent) Parses a big decimal string after we have identified the parts of the significand, and after we have obtained the exponent value.Methods inherited from class ch.randelshofer.fastdoubleparser.AbstractBigDecimalParser
checkParsedBigDecimalBounds, hasManyDigitsMethods inherited from class ch.randelshofer.fastdoubleparser.AbstractNumberParser
charAt, charAt, charAt, checkBounds, checkBounds, lookupHex, lookupHex
-
Constructor Details
-
JavaBigDecimalFromCharArray
public JavaBigDecimalFromCharArray()Creates a new instance.
-
-
Method Details
-
parseBigDecimalString
Parses aBigDecimalStringas specified inJavaBigDecimalParser.- Parameters:
str- the input stringoffset- start of the input datalength- length of the input data- Returns:
- the parsed
BigDecimal - Throws:
NullPointerException- if str is nullIllegalArgumentException- if offset or length are illegalNumberFormatException- if the input string can not be parsed successfully
-
parseBigDecimalStringWithManyDigits
Parses a big decimal string that has many digits. -
valueOfBigDecimalString
BigDecimal valueOfBigDecimalString(char[] str, int integerPartIndex, int decimalPointIndex, int nonZeroFractionalPartIndex, int exponentIndicatorIndex, boolean isNegative, int exponent) Parses a big decimal string after we have identified the parts of the significand, and after we have obtained the exponent value.integerPartIndex │ decimalPointIndex │ │ nonZeroFractionalPartIndex │ │ │ exponentIndicatorIndex ↓ ↓ ↓ ↓ "-123.00456e-789"- Parameters:
str- the input stringintegerPartIndex- the start index of the integer part of the significanddecimalPointIndex- the index of the decimal point in the significand (same as exponentIndicatorIndex if there is no decimal point)nonZeroFractionalPartIndex- the start index of the non-zero fractional part of the significandexponentIndicatorIndex- the index of the exponent indicator (same as end of string if there is no exponent indicator)isNegative- indicates that the significand is negativeexponent- the exponent value- Returns:
- the parsed big decimal
-