FastDoubleParser (Jackson-core 2.14.0 API)

com.fasterxml.jackson.core.io.doubleparser

## Class FastDoubleParser

- java.lang.Object
- - com.fasterxml.jackson.core.io.doubleparser.FastDoubleParser

-     public class FastDoubleParser
      extends Object

  Provides static method for parsing a `double` from a `CharSequence`, `char` array or `byte` array.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `parseDouble(char[] str)` Convenience method for calling `parseDouble(char[], int, int)`.
    `static double` | `parseDouble(char[] str, int offset, int length)` Parses a `FloatingPointLiteral` from a `byte`-Array and converts it into a `double` value.
    `static double` | `parseDouble(CharSequence str)` Convenience method for calling `parseDouble(CharSequence, int, int)`.
    `static double` | `parseDouble(CharSequence str, int offset, int length)` Parses a `FloatingPointLiteral` from a `CharSequence` and converts it into a `double` value.
    `static long` | `parseDoubleBits(char[] str, int offset, int length)` Parses a `FloatingPointLiteral` from a `byte`-Array and converts it into a bit pattern that encodes a `double` value.
    `static long` | `parseDoubleBits(CharSequence str, int offset, int length)` Parses a `FloatingPointLiteral` from a `CharSequence` and converts it into a bit pattern that encodes a `double` value.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### parseDouble

          public static double parseDouble(CharSequence str)
                                    throws NumberFormatException

      Convenience method for calling `parseDouble(CharSequence, int, int)`.
      Parameters:
        `str` - the string to be parsed
      Returns:
        the parsed double value
      Throws:
        `NumberFormatException` - if the string can not be parsed

    - #### parseDouble

          public static double parseDouble(CharSequence str,
                                           int offset,
                                           int length)
                                    throws NumberFormatException

      Parses a `FloatingPointLiteral` from a `CharSequence` and converts it into a `double` value.

      See `com.fasterxml.jackson.core.io.doubleparser` for the syntax of `FloatingPointLiteral`.

      Parameters:
        `str` - the string to be parsed
        `offset` - the start offset of the `FloatingPointLiteral` in `str`
        `length` - the length of `FloatingPointLiteral` in `str`
      Returns:
        the parsed double value
      Throws:
        `NumberFormatException` - if the string can not be parsed

    - #### parseDouble

          public static double parseDouble(char[] str)
                                    throws NumberFormatException

      Convenience method for calling `parseDouble(char[], int, int)`.
      Parameters:
        `str` - the string to be parsed
      Returns:
        the parsed double value
      Throws:
        `NumberFormatException` - if the string can not be parsed

    - #### parseDouble

          public static double parseDouble(char[] str,
                                           int offset,
                                           int length)
                                    throws NumberFormatException

      Parses a `FloatingPointLiteral` from a `byte`-Array and converts it into a `double` value.

      See `com.fasterxml.jackson.core.io.doubleparser` for the syntax of `FloatingPointLiteral`.

      Parameters:
        `str` - the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding
        `offset` - The index of the first character to parse
        `length` - The number of characters to parse
      Returns:
        the parsed double value
      Throws:
        `NumberFormatException` - if the string can not be parsed

    - #### parseDoubleBits

          public static long parseDoubleBits(CharSequence str,
                                             int offset,
                                             int length)

      Parses a `FloatingPointLiteral` from a `CharSequence` and converts it into a bit pattern that encodes a `double` value.

      See `com.fasterxml.jackson.core.io.doubleparser` for the syntax of `FloatingPointLiteral`.

      Usage example:

               long bitPattern = parseDoubleBits("3.14", 0, 4);
               if (bitPattern == -1L) {
                   ...handle parse error...
               } else {
                   double d = Double.longBitsToDouble(bitPattern);
               }

      Parameters:
        `str` - the string to be parsed
        `offset` - the start offset of the `FloatingPointLiteral` in `str`
        `length` - the length of `FloatingPointLiteral` in `str`
      Returns:
        the bit pattern of the parsed value, if the input is legal; otherwise, `-1L`.

    - #### parseDoubleBits

          public static long parseDoubleBits(char[] str,
                                             int offset,
                                             int length)

      Parses a `FloatingPointLiteral` from a `byte`-Array and converts it into a bit pattern that encodes a `double` value.

      See `com.fasterxml.jackson.core.io.doubleparser` for the syntax of `FloatingPointLiteral`.

      See `parseDoubleBits(CharSequence, int, int)` for a usage example.

      Parameters:
        `str` - the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding
        `offset` - The index of the first character to parse
        `length` - The number of characters to parse
      Returns:
        the bit pattern of the parsed value, if the input is legal; otherwise, `-1L`.

Copyright © 2008–2022 FasterXML. All rights reserved.