aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/pdf
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2003-03-27 10:42:00 +0000
committerJeremias Maerki <jeremias@apache.org>2003-03-27 10:42:00 +0000
commit29290e1b26ffdf806624cdc4b39a9996f6c57116 (patch)
tree33bad58be2751ebc44cc81384af3028506637cd6 /src/java/org/apache/fop/pdf
parent6b5a07a300c998f5f9f657346fb08c5674ce08e2 (diff)
downloadxmlgraphics-fop-29290e1b26ffdf806624cdc4b39a9996f6c57116.tar.gz
xmlgraphics-fop-29290e1b26ffdf806624cdc4b39a9996f6c57116.zip
Support as independant PDF object. Used for on-the-fly stream output.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196158 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf')
-rw-r--r--src/java/org/apache/fop/pdf/PDFNumber.java39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFNumber.java b/src/java/org/apache/fop/pdf/PDFNumber.java
index 806a2b8d6..6f1c143a7 100644
--- a/src/java/org/apache/fop/pdf/PDFNumber.java
+++ b/src/java/org/apache/fop/pdf/PDFNumber.java
@@ -51,12 +51,28 @@
package org.apache.fop.pdf;
/**
- * This class contains some utility methods for outputing numbers to PDF.
+ * This class represents a simple number object. It also contains contains some
+ * utility methods for outputing numbers to PDF.
*/
-public class PDFNumber {
+public class PDFNumber extends PDFObject {
- /** prevent instantiation */
- private PDFNumber() { }
+ private Number number;
+
+ /**
+ * Returns the number.
+ * @return the number
+ */
+ public Number getNumber() {
+ return this.number;
+ }
+
+ /**
+ * Sets the number.
+ * @param number the number
+ */
+ public void setNumber(Number number) {
+ this.number = number;
+ }
/**
* Output a Double value to a string suitable for PDF.
@@ -143,5 +159,20 @@ public class PDFNumber {
return (p.toString());
}
+ /**
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
+ */
+ protected String toPDFString() {
+ if (getNumber() == null) {
+ throw new IllegalArgumentException(
+ "The number of this PDFNumber must not be empty");
+ }
+ StringBuffer sb = new StringBuffer(64);
+ sb.append(getObjectID());
+ sb.append(getNumber().toString());
+ sb.append("\nendobj\n");
+ return sb.toString();
+ }
+
}