From 29290e1b26ffdf806624cdc4b39a9996f6c57116 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 27 Mar 2003 10:42:00 +0000 Subject: 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 --- src/java/org/apache/fop/pdf/PDFNumber.java | 39 +++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src/java/org/apache/fop/pdf') 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(); + } + } -- cgit v1.2.3