Top Description Fields Constructors Methods
ch.randelshofer.fastdoubleparser

public Class JavaFloatParser

extends Object
Class Inheritance

Parses a float value; the supported syntax is compatible with Float#valueOf(String).

See JavaDoubleParser for a description of the supported grammar.

Expected character lengths for values produced by Float#toString:

Maximal input length supported by this parser:

Field Summary

Modifier and TypeField and Description
private static final JavaFloatBitsFromByteArray
private static final JavaFloatBitsFromCharArray
private static final JavaFloatBitsFromCharSequence

Constructor Summary

AccessConstructor and Description
private
JavaFloatParser()

Don't let anyone instantiate this class.

Method Summary

Modifier and TypeMethod and Description
public static float

Returns:

the parsed value
parseFloat
(CharSequence
the string to be parsed
str
)

Convenience method for calling parseFloat(CharSequence, int, int).

public static float

Returns:

the parsed value
parseFloat
(CharSequence
the string to be parsed
str
,
int
the start offset of the FloatingPointLiteral in str
offset
,
int
the length of FloatingPointLiteral in str
length
)

Parses a FloatingPointLiteral from a CharSequence and converts it into a float value.

public static float

Returns:

the parsed value
parseFloat
(byte[]
the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding
str
)

Convenience method for calling parseFloat(byte[], int, int).

public static float

Returns:

the parsed value
parseFloat
(byte[]
the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding
str
,
int
The index of the first byte to parse
offset
,
int
The number of bytes to parse
length
)

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

public static float

Returns:

the parsed value
parseFloat
(char[]
the string to be parsed
str
)

Convenience method for calling parseFloat(char[], int, int).

public static float

Returns:

the parsed value
parseFloat
(char[]
the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding
str
,
int
The index of the first character to parse
offset
,
int
The number of characters to parse
length
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BYTE_ARRAY_PARSERback to summary
private static final JavaFloatBitsFromByteArray BYTE_ARRAY_PARSER
CHAR_ARRAY_PARSERback to summary
private static final JavaFloatBitsFromCharArray CHAR_ARRAY_PARSER
CHAR_SEQUENCE_PARSERback to summary
private static final JavaFloatBitsFromCharSequence CHAR_SEQUENCE_PARSER

Constructor Detail

JavaFloatParserback to summary
private JavaFloatParser()

Don't let anyone instantiate this class.

Method Detail

parseFloatback to summary
public static float parseFloat(CharSequence str) throws NumberFormatException

Convenience method for calling parseFloat(CharSequence, int, int).

Parameters
str:CharSequence

the string to be parsed

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
parseFloatback to summary
public static float parseFloat(CharSequence str, int offset, int length) throws NumberFormatException

Parses a FloatingPointLiteral from a CharSequence and converts it into a float value.

Parameters
str:CharSequence

the string to be parsed

offset:int

the start offset of the FloatingPointLiteral in str

length:int

the length of FloatingPointLiteral in str

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
IllegalArgumentException:
if offset or length are illegal
parseFloatback to summary
public static float parseFloat(byte[] str) throws NumberFormatException

Convenience method for calling parseFloat(byte[], int, int).

Parameters
str:byte[]

the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
parseFloatback to summary
public static float parseFloat(byte[] str, int offset, int length) throws NumberFormatException

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

Parameters
str:byte[]

the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding

offset:int

The index of the first byte to parse

length:int

The number of bytes to parse

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
IllegalArgumentException:
if offset or length are illegal
parseFloatback to summary
public static float parseFloat(char[] str) throws NumberFormatException

Convenience method for calling parseFloat(char[], int, int).

Parameters
str:char[]

the string to be parsed

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
parseFloatback to summary
public static float parseFloat(char[] str, int offset, int length) throws NumberFormatException

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

Parameters
str:char[]

the string to be parsed, a byte array with characters in ISO-8859-1, ASCII or UTF-8 encoding

offset:int

The index of the first character to parse

length:int

The number of characters to parse

Returns:float

the parsed value

Exceptions
NumberFormatException:
if the string can not be parsed successfully
NullPointerException:
if the string is null
IllegalArgumentException:
if offset or length are illegal