Class COSFloat

  • All Implemented Interfaces:
    COSObjectable

    public class COSFloat
    extends COSNumber
    This class represents a floating point number in a PDF document.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.math.BigDecimal value  
      private java.lang.String valueAsString  
    • Constructor Summary

      Constructors 
      Constructor Description
      COSFloat​(float aFloat)
      Constructor.
      COSFloat​(java.lang.String aFloat)
      Constructor.
    • Field Detail

      • value

        private java.math.BigDecimal value
      • valueAsString

        private java.lang.String valueAsString
    • Constructor Detail

      • COSFloat

        public COSFloat​(float aFloat)
        Constructor.
        Parameters:
        aFloat - The primitive float object that this object wraps.
      • COSFloat

        public COSFloat​(java.lang.String aFloat)
                 throws java.io.IOException
        Constructor.
        Parameters:
        aFloat - The primitive float object that this object wraps.
        Throws:
        java.io.IOException - If aFloat is not a float.
    • Method Detail

      • checkMinMaxValues

        private void checkMinMaxValues()
      • removeNullDigits

        private java.lang.String removeNullDigits​(java.lang.String plainStringValue)
      • floatValue

        public float floatValue()
        The value of the float object that this one wraps.
        Specified by:
        floatValue in class COSNumber
        Returns:
        The value of this object.
      • doubleValue

        public double doubleValue()
        Deprecated.
        will be removed in a future release
        The value of the double object that this one wraps.
        Specified by:
        doubleValue in class COSNumber
        Returns:
        The double of this object.
      • longValue

        public long longValue()
        This will get the long value of this object.
        Specified by:
        longValue in class COSNumber
        Returns:
        The long value of this object,
      • intValue

        public int intValue()
        This will get the integer value of this object.
        Specified by:
        intValue in class COSNumber
        Returns:
        The int value of this object,
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • accept

        public java.lang.Object accept​(ICOSVisitor visitor)
                                throws java.io.IOException
        visitor pattern double dispatch method.
        Specified by:
        accept in class COSBase
        Parameters:
        visitor - The object to notify when visiting this object.
        Returns:
        any object, depending on the visitor implementation, or null
        Throws:
        java.io.IOException - If an error occurs while visiting this object.
      • writePDF

        public void writePDF​(java.io.OutputStream output)
                      throws java.io.IOException
        This will output this string as a PDF object.
        Parameters:
        output - The stream to write to.
        Throws:
        java.io.IOException - If there is an error writing to the stream.