Top Description Fields Constructors Methods
org.jruby.util

public final Class SafeFloatParser

extends SafeDecimalParser
Class Inheritance
Imports
java.math.BigDecimal

A safer way to parse float values

Prevents brute force attacks using the famous Java bug.

Field Summary

Inherited from org.jruby.util.SafeDecimalParser:
LOWERMIDDLETWOUPPER

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static float

Returns:

the float value
floatValue
(Number number)

Safe way of getting the float value prevents BigDecimal from calling Float.parseFloat()

public static float

Returns:

the float value
floatValue
(BigDecimal bigDecimal)

Safe way of getting the float value Prevents BigDecimal from calling Float.parseFloat()

public static Float

Returns:

the Float value
parseFloat
(String
The input String
s
)

Safe way of parsing a Float value from a String

public static Float

Returns:

the Float value
valueOf
(String
The input String
s
)

Safe way of parsing a Float value from a String

Inherited from org.jruby.util.SafeDecimalParser:
decimalValuedecimalValuedecimalValueOfisSuspicious

Constructor Detail

SafeFloatParserback to summary
public SafeFloatParser()

Method Detail

floatValueback to summary
public static float floatValue(Number number)

Safe way of getting the float value
prevents BigDecimal from calling Float.parseFloat()

Returns:float

the float value

floatValueback to summary
public static float floatValue(BigDecimal bigDecimal)

Safe way of getting the float value
Prevents BigDecimal from calling Float.parseFloat()

Returns:float

the float value

parseFloatback to summary
public static Float parseFloat(String s)

Safe way of parsing a Float value from a String

Parameters
s:String

The input String

Returns:Float

the Float value

valueOfback to summary
public static Float valueOf(String s)

Safe way of parsing a Float value from a String

Parameters
s:String

The input String

Returns:Float

the Float value