public class FastDoubleParser extends Object
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)
|
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. |
public static double parseDouble(CharSequence str) throws NumberFormatException
parseDouble(CharSequence, int, int)
.str
- the string to be parsedNumberFormatException
- if the string can not be parsedpublic static double parseDouble(CharSequence str, int offset, int length) throws NumberFormatException
FloatingPointLiteral
from a CharSequence
and converts it
into a double
value.
See com.fasterxml.jackson.core.io.doubleparser
for the syntax of FloatingPointLiteral
.
str
- the string to be parsedoffset
- the start offset of the FloatingPointLiteral
in str
length
- the length of FloatingPointLiteral
in str
NumberFormatException
- if the string can not be parsedpublic static double parseDouble(char[] str) throws NumberFormatException
parseDouble(char[], int, int)
.str
- the string to be parsedNumberFormatException
- if the string can not be parsedpublic static double parseDouble(char[] str, int offset, int length) throws NumberFormatException
FloatingPointLiteral
from a byte
-Array and converts it
into a double
value.
See com.fasterxml.jackson.core.io.doubleparser
for the syntax of FloatingPointLiteral
.
str
- the string to be parsed, a byte array with characters
in ISO-8859-1, ASCII or UTF-8 encodingoffset
- The index of the first character to parselength
- The number of characters to parseNumberFormatException
- if the string can not be parsedpublic static long parseDoubleBits(CharSequence str, int offset, int length)
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); }
str
- the string to be parsedoffset
- the start offset of the FloatingPointLiteral
in str
length
- the length of FloatingPointLiteral
in str
-1L
.public static long parseDoubleBits(char[] str, int offset, int length)
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.
str
- the string to be parsed, a byte array with characters
in ISO-8859-1, ASCII or UTF-8 encodingoffset
- The index of the first character to parselength
- The number of characters to parse-1L
.Copyright © 2008–2022 FasterXML. All rights reserved.