public class FastFloatParser extends Object
| Modifier and Type | Method and Description |
|---|---|
static float |
parseFloat(char[] str)
Convenience method for calling
parseFloat(char[], int, int). |
static float |
parseFloat(char[] str,
int offset,
int length)
Parses a
FloatingPointLiteral from a byte-Array and converts it
into a float value. |
static float |
parseFloat(CharSequence str)
Convenience method for calling
parseFloat(CharSequence, int, int). |
static float |
parseFloat(CharSequence str,
int offset,
int length)
|
static long |
parseFloatBits(char[] str,
int offset,
int length)
Parses a
FloatingPointLiteral from a byte-Array and converts it
into a bit pattern that encodes a float value. |
static long |
parseFloatBits(CharSequence str,
int offset,
int length)
Parses a
FloatingPointLiteral from a CharSequence and converts it
into a bit pattern that encodes a float value. |
public static float parseFloat(CharSequence str) throws NumberFormatException
parseFloat(CharSequence, int, int).str - the string to be parsedNumberFormatException - if the string can not be parsedpublic static float parseFloat(CharSequence str, int offset, int length) throws NumberFormatException
FloatingPointLiteral from a CharSequence and converts it
into a float 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 strlength - the length of FloatingPointLiteral in strNumberFormatException - if the string can not be parsedpublic static float parseFloat(char[] str)
throws NumberFormatException
parseFloat(char[], int, int).str - the string to be parsedNumberFormatException - if the string can not be parsedpublic static float parseFloat(char[] str,
int offset,
int length)
throws NumberFormatException
FloatingPointLiteral from a byte-Array and converts it
into a float 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 parseFloatBits(CharSequence str, int offset, int length)
FloatingPointLiteral from a CharSequence and converts it
into a bit pattern that encodes a float value.
See com.fasterxml.jackson.core.io.doubleparser for the syntax of FloatingPointLiteral.
Usage example:
long bitPattern = parseFloatBits("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 strlength - the length of FloatingPointLiteral in str-1L.public static long parseFloatBits(char[] str,
int offset,
int length)
FloatingPointLiteral from a byte-Array and converts it
into a bit pattern that encodes a float value.
See com.fasterxml.jackson.core.io.doubleparser for the syntax of FloatingPointLiteral.
See parseFloatBits(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–2023 FasterXML. All rights reserved.