Package org.apache.pdfbox.cos
Class COSFloat
java.lang.Object
org.apache.pdfbox.cos.COSBase
org.apache.pdfbox.cos.COSNumber
org.apache.pdfbox.cos.COSFloat
- All Implemented Interfaces:
COSObjectable
This class represents a floating point number in a PDF document.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ICOSVisitor visitor) Visitor pattern double dispatch method.private floatcoerce(float floatValue) Check and coerce the value field to be between MIN_NORMAL and MAX_VALUE.booleanfloatThe value of the float object that this one wraps.private StringBuilds, if needed, and returns the string representation of the current value.inthashCode()intintValue()This will get the integer value of this object.longThis will get the long value of this object.toString()voidwritePDF(OutputStream output) This will output this string as a PDF object.
-
Field Details
-
value
private final float value -
valueAsString
-
ZERO
-
ONE
-
-
Constructor Details
-
COSFloat
public COSFloat(float aFloat) Constructor.- Parameters:
aFloat- The primitive float object that this object wraps.
-
COSFloat
An internal constructor to avoid formatting for the predefined constants.- Parameters:
aFloat-valueString-
-
COSFloat
Constructor.- Parameters:
aFloat- The primitive float object that this object wraps.- Throws:
IOException- If aFloat is not a float.
-
-
Method Details
-
coerce
private float coerce(float floatValue) Check and coerce the value field to be between MIN_NORMAL and MAX_VALUE.- Parameters:
floatValue- the value to be checked- Returns:
- the coerced value
-
floatValue
public float floatValue()The value of the float object that this one wraps.- Specified by:
floatValuein classCOSNumber- Returns:
- The value of this object.
-
longValue
public long longValue()This will get the long value of this object. -
intValue
public int intValue()This will get the integer value of this object. -
equals
-
hashCode
public int hashCode() -
toString
-
formatString
Builds, if needed, and returns the string representation of the current value.- Returns:
- current value as string.
-
accept
Visitor pattern double dispatch method.- Specified by:
acceptin classCOSBase- Parameters:
visitor- The object to notify when visiting this object.- Throws:
IOException- If an error occurs while visiting this object.
-
writePDF
This will output this string as a PDF object.- Parameters:
output- The stream to write to.- Throws:
IOException- If there is an error writing to the stream.
-