diff options
author | Jeremias Maerki <jeremias@apache.org> | 2003-03-27 11:03:26 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2003-03-27 11:03:26 +0000 |
commit | 05d6a1943c642a95f1e852f2b66eab830024c5c1 (patch) | |
tree | 0d365479c0d62ff98df80de5201574f0b3329426 /src/java/org/apache/fop/pdf/PDFICCStream.java | |
parent | ee8e0333a8a4c781d30b78216b19d2e3c57e33fa (diff) | |
download | xmlgraphics-fop-05d6a1943c642a95f1e852f2b66eab830024c5c1.tar.gz xmlgraphics-fop-05d6a1943c642a95f1e852f2b66eab830024c5c1.zip |
Adjust to the PDF Stream changes.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196166 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/pdf/PDFICCStream.java')
-rw-r--r-- | src/java/org/apache/fop/pdf/PDFICCStream.java | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/src/java/org/apache/fop/pdf/PDFICCStream.java b/src/java/org/apache/fop/pdf/PDFICCStream.java index 039a82fff..80263b552 100644 --- a/src/java/org/apache/fop/pdf/PDFICCStream.java +++ b/src/java/org/apache/fop/pdf/PDFICCStream.java @@ -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 @@ public class PDFICCStream extends PDFStream { 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 @@ public class PDFICCStream extends PDFStream { * @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(); } + } |