Class BigDecimalParser

java.lang.Object
tools.jackson.core.io.BigDecimalParser

public final class BigDecimalParser extends Object
Internal Jackson Helper class used to implement more optimized parsing of BigDecimal for REALLY big values (over 500 characters).

This class is not meant to be used directly. It is designed to be used by Jackson JSON parsers (and parsers for other Jackson supported data formats). The parsers check for invalid characters and the length of the number. Without these checks, this parser is susceptible to performing badly with invalid inputs. If you need to parse numbers directly, please use JavaBigDecimalParser in fastdoubleparser instead.

Based on ideas from this this git commit.

  • Field Details

    • MAX_CHARS_TO_REPORT

      static final int MAX_CHARS_TO_REPORT
      See Also:
    • SIZE_FOR_SWITCH_TO_FASTDOUBLEPARSER

      private static final int SIZE_FOR_SWITCH_TO_FASTDOUBLEPARSER
      See Also:
  • Constructor Details

    • BigDecimalParser

      private BigDecimalParser()
  • Method Details

    • parse

      public static BigDecimal parse(String valueStr)
      Internal Jackson method. Please do not use.

      Note: Caller MUST pre-validate that given String represents a valid representation of BigDecimal value: parsers in jackson-core do that; other code must do the same.

      Parameters:
      valueStr - Value to parse
      Returns:
      BigDecimal value
      Throws:
      NumberFormatException - for decoding failures
    • parse

      public static BigDecimal parse(char[] chars, int off, int len)
      Internal Jackson method. Please do not use.

      Note: Caller MUST pre-validate that given String represents a valid representation of BigDecimal value: parsers in jackson-core do that; other code must do the same.

      Parameters:
      chars - Buffer that contains value to parse
      off - Offset of the first character to decode
      len - Length of value to parse in buffer
      Returns:
      BigDecimal value
      Throws:
      NumberFormatException - for decoding failures
    • parse

      public static BigDecimal parse(char[] chars)
      Internal Jackson method. Please do not use.

      Note: Caller MUST pre-validate that given String represents a valid representation of BigDecimal value: parsers in jackson-core do that; other code must do the same.

      Parameters:
      chars - Value to parse
      Returns:
      BigDecimal value
      Throws:
      NumberFormatException - for decoding failures
    • parseWithFastParser

      public static BigDecimal parseWithFastParser(String valueStr)
      Internal Jackson method. Please do not use.

      Note: Caller MUST pre-validate that given String represents a valid representation of BigDecimal value: parsers in jackson-core do that; other code must do the same.

      Parameters:
      valueStr - Value to parse
      Returns:
      BigDecimal value
      Throws:
      NumberFormatException - for decoding failures
    • parseWithFastParser

      public static BigDecimal parseWithFastParser(char[] ch, int off, int len)
      Internal Jackson method. Please do not use.

      Note: Caller MUST pre-validate that given String represents a valid representation of BigDecimal value: parsers in jackson-core do that; other code must do the same.

      Returns:
      BigDecimal value
      Throws:
      NumberFormatException - for decoding failures
    • _parseFailure

      private static NumberFormatException _parseFailure(Exception e, String fullValue)
    • _parseFailure

      private static NumberFormatException _parseFailure(Exception e, char[] array, int offset, int len)
    • _getValueDesc

      private static String _getValueDesc(String fullValue)
    • _getValueDesc

      private static String _getValueDesc(char[] array, int offset, int len)
    • _generateExceptionMessage

      private static String _generateExceptionMessage(String valueToReport, String desc)