jeremias 2003/03/27 03:01:33
Modified: src/java/org/apache/fop/pdf PDFICCStream.java
Log:
Adjust to the PDF Stream changes.
Revision Changes Path
1.2 +33 -23 xml-fop/src/java/org/apache/fop/pdf/PDFICCStream.java
Index: PDFICCStream.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFICCStream.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PDFICCStream.java 11 Mar 2003 13:05:09 -0000 1.1
+++ PDFICCStream.java 27 Mar 2003 11:01:33 -0000 1.2
@@ -51,6 +51,8 @@
package org.apache.fop.pdf;
import java.awt.color.ICC_Profile;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* Special PDFStream for ICC profiles (color profiles).
@@ -64,10 +66,10 @@
private PDFColorSpace pdfColorSpace;
/**
- * @see org.apache.fop.pdf.PDFObject#PDFObject(int)
+ * @see org.apache.fop.pdf.PDFObject#PDFObject()
*/
- public PDFICCStream(int num) {
- super(num);
+ public PDFICCStream() {
+ super();
cp = null;
}
@@ -87,29 +89,37 @@
* @see org.apache.fop.pdf.PDFObject#output(OutputStream)
*/
protected int output(java.io.OutputStream stream)
- throws java.io.IOException {
-
- setData(cp.getData());
-
- int length = 0;
- String filterEntry = applyFilters();
- StringBuffer pb = new StringBuffer();
- pb.append(this.number).append(" ").append(this.generation).append(" obj\n<<
");
- pb.append("/N ").append(cp.getNumComponents()).append(" ");
+ throws java.io.IOException {
+ int length = super.output(stream);
+ this.cp = null; //Free ICC stream when it's not used anymore
+ return length;
+ }
+
+ /**
+ * @see org.apache.fop.pdf.PDFStream#outputRawStreamData(OutputStream)
+ */
+ protected void outputRawStreamData(OutputStream out) throws IOException {
+ cp.write(out);
+ }
+
+ /**
+ * @see org.apache.fop.pdf.AbstractPDFStream#buildStreamDict(String)
+ */
+ protected String buildStreamDict(String lengthEntry) {
+ final String filterEntry = getFilterList().buildFilterDictEntries();
+ final StringBuffer sb = new StringBuffer(128);
+ sb.append(getObjectID());
+ sb.append("<< ");
+ sb.append("/N " + cp.getNumComponents());
if (pdfColorSpace != null) {
- pb.append("/Alternate
/").append(pdfColorSpace.getColorSpacePDFString()).append(" ");
+ sb.append("\n/Alternate /" + pdfColorSpace.getColorSpacePDFString() + "
");
}
- pb.append("/Length ").append((data.getSize() + 1)).append("
").append(filterEntry);
- pb.append(" >>\n");
- byte[] p = pb.toString().getBytes();
- stream.write(p);
- length += p.length;
- length += outputStreamData(stream);
- p = "endobj\n".getBytes();
- stream.write(p);
- length += p.length;
- return length;
+ sb.append("\n/Length " + lengthEntry);
+ sb.append("\n" + filterEntry);
+ sb.append("\n>>\n");
+ return sb.toString();
}
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]