org.apache.pdfbox.cos

## Class COSNumber

- java.lang.Object
- - org.apache.pdfbox.cos.COSBase
  - - org.apache.pdfbox.cos.COSNumber

All Implemented Interfaces:
  COSObjectable

Direct Known Subclasses:
  COSFloat, COSInteger

    public abstract class COSNumber
    extends COSBase

This class represents an abstract number in a PDF document.

Author:
  Ben Litchfield

### Field Summary

Fields
`static COSInteger` `ONE` Deprecated. Use the `COSInteger.ONE` constant instead
`static COSInteger` `ZERO` Deprecated. Use the `COSInteger.ZERO` constant instead

### Constructor Summary

Constructors
Constructor and Description
`COSNumber()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
`abstract double` `doubleValue()` Deprecated. will be removed in a future release
`abstract float` `floatValue()` This will get the float value of this number.
`static COSNumber` `get(String number)` This factory method will get the appropriate number object.
`abstract int` `intValue()` This will get the integer value of this number.
`abstract long` `longValue()` This will get the long value of this number.

### Methods inherited from class org.apache.pdfbox.cos.COSBase

`accept, getCOSObject, isDirect, setDirect`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### ZERO

    @Deprecated
    public static final COSInteger ZERO

Deprecated. Use the `COSInteger.ZERO` constant instead

#### ONE

    @Deprecated
    public static final COSInteger ONE

Deprecated. Use the `COSInteger.ONE` constant instead

### Constructor Detail

#### COSNumber

    public COSNumber()

### Method Detail

#### floatValue

    public abstract float floatValue()

This will get the float value of this number.

Returns:
  The float value of this object.

#### doubleValue

    public abstract double doubleValue()

Deprecated. will be removed in a future release
This will get the double value of this number.

Returns:
  The double value of this number.

#### intValue

    public abstract int intValue()

This will get the integer value of this number.

Returns:
  The integer value of this number.

#### longValue

    public abstract long longValue()

This will get the long value of this number.

Returns:
  The long value of this number.

#### get

    public static COSNumber get(String number)
                         throws IOException

This factory method will get the appropriate number object.

Parameters:
  `number` - The string representation of the number.
Returns:
  A number object, either float or int.
Throws:
  `IOException` - If the string is not a number.