public class PdfNumber extends PdfPrimitiveObject
PdfNumber
-class is the PDF-equivalent of a Double
-object.
PDF provides two types of numeric objects: integer and real. Integer objects represent mathematical integers. Real objects represent mathematical real numbers. The range and precision of numbers may be limited by the internal representations used in the computer on which the PDF processor is running. An integer shall be written as one or more decimal digits optionally preceded by a sign. The value shall be interpreted as a signed decimal integer and shall be converted to an integer object. A real value shall be written as one or more decimal digits with an optional sign and a leading, trailing, or embedded period (decimal point).
content, directOnly
ARRAY, BOOLEAN, DICTIONARY, FLUSHED, FORBID_RELEASE, FREE, INDIRECT_REFERENCE, indirectReference, LITERAL, MODIFIED, MUST_BE_FLUSHED, MUST_BE_INDIRECT, NAME, NULL, NUMBER, ORIGINAL_OBJECT_STREAM, READ_ONLY, READING, STREAM, STRING, UNENCRYPTED
Constructor and Description |
---|
PdfNumber(byte[] content)
Creates an instance of
PdfNumber with provided content. |
PdfNumber(double value)
Creates an instance of
PdfNumber and sets value. |
PdfNumber(int value)
Creates an instance of
PdfNumber and sets value. |
Modifier and Type | Method and Description |
---|---|
protected void |
copyContent(PdfObject from,
PdfDocument document,
ICopyFilter copyFilter)
Copies object content from object 'from'.
|
void |
decrement()
Decrements current value.
|
double |
doubleValue()
Returns double value of current instance of
PdfNumber . |
boolean |
equals(Object o) |
float |
floatValue()
Returns value and converts it to float.
|
protected void |
generateContent() |
protected void |
generateValue() |
byte |
getType()
Gets object type.
|
double |
getValue()
Returns value of current instance of
PdfNumber . |
boolean |
hasDecimalPoint()
Checks if string representation of the value contains decimal point.
|
int |
hashCode() |
void |
increment()
Increments current value.
|
int |
intValue()
Returns value and converts it to an int.
|
protected boolean |
isDoubleNumber() |
long |
longValue()
Returns value and converts it to long.
|
protected PdfObject |
newInstance()
Creates new instance of object.
|
void |
setValue(double value)
Sets value.
|
void |
setValue(int value)
Sets value and convert it to double.
|
String |
toString() |
compareContent, getInternalContent, hasContent, makeIndirect, setIndirectReference
checkState, clearState, clone, clone, copyContent, copyTo, copyTo, copyTo, copyTo, flush, flush, getIndirectReference, isArray, isBoolean, isDictionary, isFlushed, isIndirect, isIndirectReference, isLiteral, isModified, isName, isNull, isNumber, isReleaseForbidden, isStream, isString, makeIndirect, release, setModified, setState
public PdfNumber(double value)
PdfNumber
and sets value.value
- double value to setpublic PdfNumber(int value)
PdfNumber
and sets value.value
- int value to setpublic PdfNumber(byte[] content)
PdfNumber
with provided content.content
- byte array content to setpublic byte getType()
PdfObject
public double getValue()
PdfNumber
.PdfNumber
instancepublic double doubleValue()
PdfNumber
.PdfNumber
instancepublic float floatValue()
public long longValue()
public int intValue()
Integer.MAX_VALUE
, Integer.MAX_VALUE
would be return.public void setValue(int value)
value
- to setpublic void setValue(double value)
value
- to setpublic void increment()
public void decrement()
public boolean hasDecimalPoint()
protected PdfObject newInstance()
PdfObject
newInstance
in class PdfObject
protected boolean isDoubleNumber()
protected void generateContent()
generateContent
in class PdfPrimitiveObject
protected void generateValue()
protected void copyContent(PdfObject from, PdfDocument document, ICopyFilter copyFilter)
PdfObject
copyContent
in class PdfPrimitiveObject
from
- object to copy content from.document
- document to copy object to.copyFilter
- ICopyFilter
a filter that will apply on dictionaries and array
Use NullCopyFilter
for no filteringCopyright © 1998–2023 Apryse Group NV. All rights reserved.