[FOray-commit] SF.net SVN: foray: [9122] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-04-06 01:06:10
|
Revision: 9122
http://svn.sourceforge.net/foray/?rev=9122&view=rev
Author: victormote
Date: 2007-04-05 18:06:12 -0700 (Thu, 05 Apr 2007)
Log Message:
-----------
Conform to axsl changes removing OutputStream parameters from PDFDocument methods.
Modified Paths:
--------------
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-04-06 00:51:26 UTC (rev 9121)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-04-06 01:06:12 UTC (rev 9122)
@@ -287,13 +287,9 @@
}
/**
- * Writes any used but unwritten indirect objects into the stream.
- * This can be done as often as desired.
- * @param stream The OutputStream to which the output should be written.
- * @throws IOException For I/O errors while writing to the output stream.
+ * {@inheritDoc}
*/
- public void writeIndirectObjects(final OutputStream stream)
- throws IOException {
+ public void writeIndirectObjects() throws IOException {
/*
* Use a "while" loop here, because as each object is written, it has
* potential to reference another object indirectly, which will add an
@@ -334,7 +330,7 @@
/**
* {@inheritDoc}
*/
- public void outputHeader(final OutputStream stream) throws IOException {
+ public void writeHeader() throws IOException {
this.position = 0;
final StringBuilder buffer = new StringBuilder();
// The PDF identifier comment.
@@ -342,30 +338,29 @@
+ PDFObject.EOL);
buffer.append("%" + BINARY_COMMENT + PDFObject.EOL);
final byte[] bytes = PDFObject.bufferToByteArray(buffer);
- stream.write(bytes);
+ this.outputStream.write(bytes);
this.position += bytes.length;
}
/**
* {@inheritDoc}
*/
- public void close(final OutputStream stream) throws IOException {
- outputTrailer(stream);
+ public void close() throws IOException {
+ outputTrailer();
}
/**
* Write the document trailer.
- * @param stream The OutputStream to which the trailer should be written.
* @throws IOException For errors while writing to the output stream.
*/
- private void outputTrailer(final OutputStream stream) throws IOException {
- writeIndirectObjects(stream);
+ private void outputTrailer() throws IOException {
+ writeIndirectObjects();
for (int i = 0; i < indirectObjectsLast.size(); i++) {
final PDFObject o = indirectObjectsLast.get(i);
recordLocation(o);
- this.position += o.output(stream);
+ this.position += o.output(this.outputStream);
}
- writeIndirectObjects(stream);
+ writeIndirectObjects();
/* remember position of xref table */
final int xrefPosition = this.position;
@@ -373,7 +368,7 @@
/* output the xref table and increment the character position
by the table's length */
- this.position += outputXref(stream);
+ this.position += outputXref(this.outputStream);
/* construct the trailer */
final StringBuilder buffer = new StringBuilder();
@@ -389,7 +384,7 @@
} catch (final UnsupportedEncodingException ue) {
trailer = buffer.toString().getBytes();
}
- stream.write(trailer);
+ this.outputStream.write(trailer);
}
/**
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2007-04-06 00:51:26 UTC (rev 9121)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/svg/batik/PDFDocumentGraphics2D.java 2007-04-06 01:06:12 UTC (rev 9122)
@@ -57,9 +57,6 @@
*/
public class PDFDocumentGraphics2D extends PDFGraphics2D {
- /** The output stream to which the graphic is written. */
- private OutputStream stream;
-
/** The height of the graphic, in millipoints. */
private int width;
@@ -85,7 +82,6 @@
final String appName, final FontConsumer fontConsumer) {
super(textAsShapes);
- this.stream = stream;
setPdfDoc(new PDFDocument(stream, getLogger()));
getPdfDoc().getInfo().setProducer(appName + " SVG Renderer");
this.width = width;
@@ -150,9 +146,9 @@
if (getCurrentAnnotList() != null) {
currentPage.addAnnotationList(getCurrentAnnotList());
}
- getPdfDoc().outputHeader(stream);
- getPdfDoc().writeIndirectObjects(stream);
- getPdfDoc().close(stream);
+ getPdfDoc().writeHeader();
+ getPdfDoc().writeIndirectObjects();
+ getPdfDoc().close();
}
/**
Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-04-06 00:51:26 UTC (rev 9121)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-04-06 01:06:12 UTC (rev 9122)
@@ -168,7 +168,7 @@
final String filter = (String) filters.get(i);
pdfDoc.addDefaultFilter(filter);
}
- pdfDoc.outputHeader(this.getOutputStream());
+ pdfDoc.writeHeader();
}
/**
@@ -180,7 +180,7 @@
* PageCollection.
*/
renderDocumentNodes();
- pdfDoc.close(this.getOutputStream());
+ pdfDoc.close();
// this frees up memory and makes the renderer reusable
this.pdfDoc = null;
@@ -420,7 +420,7 @@
renderDestinations(page);
getLogger().debug("Writing out PDF.");
- this.pdfDoc.writeIndirectObjects(this.getOutputStream());
+ this.pdfDoc.writeIndirectObjects();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|