Class COSInteger

  • All Implemented Interfaces:
    COSObjectable

    public final class COSInteger
    extends COSNumber
    This class represents an integer number in a PDF document.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private COSInteger​(long val, boolean valid)
      constructor.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.lang.Object accept​(ICOSVisitor visitor)
      visitor pattern double dispatch method.
      double doubleValue()
      Deprecated.
      will be removed in a future release
      boolean equals​(java.lang.Object o)
      float floatValue()
      polymorphic access to value as float.
      static COSInteger get​(long val)
      Returns a COSInteger instance with the given value.
      private static COSInteger getInvalid​(boolean maxValue)  
      int hashCode()
      int intValue()
      Polymorphic access to value as int This will get the integer value of this object.
      boolean isValid()
      Indicates whether this instance represents a valid value.
      long longValue()
      Polymorphic access to value as int This will get the integer value of this object.
      java.lang.String toString()
      void writePDF​(java.io.OutputStream output)
      This will output this string as a PDF object.
      • Methods inherited from class org.apache.pdfbox.cos.COSNumber

        get
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • STATIC

        private static final COSInteger[] STATIC
        Static instances of all COSIntegers in the range from LOW to HIGH.
      • ZERO

        public static final COSInteger ZERO
        Constant for the number zero.
        Since:
        Apache PDFBox 1.1.0
      • ONE

        public static final COSInteger ONE
        Constant for the number one.
        Since:
        Apache PDFBox 1.1.0
      • TWO

        public static final COSInteger TWO
        Constant for the number two.
        Since:
        Apache PDFBox 1.1.0
      • THREE

        public static final COSInteger THREE
        Constant for the number three.
        Since:
        Apache PDFBox 1.1.0
      • OUT_OF_RANGE_MAX

        protected static final COSInteger OUT_OF_RANGE_MAX
        Constant for an out of range value which is bigger than Log.MAX_VALUE.
      • OUT_OF_RANGE_MIN

        protected static final COSInteger OUT_OF_RANGE_MIN
        Constant for an out of range value which is smaller than Log.MIN_VALUE.
      • value

        private final long value
      • isValid

        private final boolean isValid
    • Constructor Detail

      • COSInteger

        private COSInteger​(long val,
                           boolean valid)
        constructor.
        Parameters:
        val - The integer value of this object.
    • Method Detail

      • get

        public static COSInteger get​(long val)
        Returns a COSInteger instance with the given value.
        Parameters:
        val - integer value
        Returns:
        COSInteger instance
      • getInvalid

        private static COSInteger getInvalid​(boolean maxValue)
      • 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
      • floatValue

        public float floatValue()
        polymorphic access to value as float.
        Specified by:
        floatValue in class COSNumber
        Returns:
        The float value of this object.
      • doubleValue

        public double doubleValue()
        Deprecated.
        will be removed in a future release
        polymorphic access to value as float.
        Specified by:
        doubleValue in class COSNumber
        Returns:
        The double value of this object.
      • intValue

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

        public long longValue()
        Polymorphic access to value as int This will get the integer value of this object.
        Specified by:
        longValue in class COSNumber
        Returns:
        The int value of this object,
      • isValid

        public boolean isValid()
        Indicates whether this instance represents a valid value.
        Returns:
        true if the value is valid
      • 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.