Package org.apache.pdfbox.cos
Class COSInteger
- java.lang.Object
-
- org.apache.pdfbox.cos.COSBase
-
- org.apache.pdfbox.cos.COSNumber
-
- org.apache.pdfbox.cos.COSInteger
-
- All Implemented Interfaces:
COSObjectable
public class COSInteger extends COSNumber
This class represents an integer number in a PDF document.- Version:
- $Revision: 1.12 $
- Author:
- Ben Litchfield
-
-
Field Summary
Fields Modifier and Type Field Description static COSIntegerONEConstant for the number one.static COSIntegerTHREEConstant for the number three.static COSIntegerTWOConstant for the number two.static COSIntegerZEROConstant for the number zero.
-
Constructor Summary
Constructors Constructor Description COSInteger(int val)Deprecated.use the staticget(long)method insteadCOSInteger(long val)Deprecated.use the staticget(long)method insteadCOSInteger(java.lang.String val)Deprecated.use the staticget(long)method instead
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectaccept(ICOSVisitor visitor)visitor pattern double dispatch method.doubledoubleValue()polymorphic access to value as float.booleanequals(java.lang.Object o)floatfloatValue()polymorphic access to value as float.static COSIntegerget(long val)Returns a COSInteger instance with the given value.inthashCode()intintValue()Polymorphic access to value as int This will get the integer value of this object.longlongValue()Polymorphic access to value as int This will get the integer value of this object.voidsetValue(long newValue)Change the value of this reference.java.lang.StringtoString()voidwritePDF(java.io.OutputStream output)This will output this string as a PDF object.-
Methods inherited from class org.apache.pdfbox.cos.COSBase
getCOSObject, getFilterManager, isDirect, isNeedToBeUpdate, setDirect, setNeedToBeUpdate
-
-
-
-
Field Detail
-
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
-
-
Constructor Detail
-
COSInteger
public COSInteger(long val)
Deprecated.use the staticget(long)method insteadconstructor.- Parameters:
val- The integer value of this object.
-
COSInteger
public COSInteger(int val)
Deprecated.use the staticget(long)method insteadconstructor.- Parameters:
val- The integer value of this object.
-
COSInteger
public COSInteger(java.lang.String val) throws java.io.IOExceptionDeprecated.use the staticget(long)method insteadThis will create a new PDF Int object using a string.- Parameters:
val- The string value of the integer.- Throws:
java.io.IOException- If the val is not an integer type.
-
-
Method Detail
-
get
public static COSInteger get(long val)
Returns a COSInteger instance with the given value.- Parameters:
val- integer value- Returns:
- COSInteger instance
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
setValue
public void setValue(long newValue)
Change the value of this reference.- Parameters:
newValue- The new value.
-
floatValue
public float floatValue()
polymorphic access to value as float.- Specified by:
floatValuein classCOSNumber- Returns:
- The float value of this object.
-
doubleValue
public double doubleValue()
polymorphic access to value as float.- Specified by:
doubleValuein classCOSNumber- 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.
-
longValue
public long longValue()
Polymorphic access to value as int This will get the integer value of this object.
-
accept
public java.lang.Object accept(ICOSVisitor visitor) throws COSVisitorException
visitor pattern double dispatch method.- Specified by:
acceptin classCOSBase- Parameters:
visitor- The object to notify when visiting this object.- Returns:
- any object, depending on the visitor implementation, or null
- Throws:
COSVisitorException- If an error occurs while visiting this object.
-
writePDF
public void writePDF(java.io.OutputStream output) throws java.io.IOExceptionThis 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.
-
-