[FOray-commit] SF.net SVN: foray: [7824] trunk/foray/foray-pdf/src/java/org/foray/pdf/object
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-23 20:51:48
|
Revision: 7824 Author: victormote Date: 2006-07-23 13:51:25 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7824&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXObject.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXPostScript.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXReference.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNameTree.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -36,7 +36,7 @@ private Collection names; - public PDFNameTree(PDFDocument doc) { + public PDFNameTree(final PDFDocument doc) { super(doc); this.names = new ArrayList(); } @@ -46,12 +46,12 @@ * @return The PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/Names [" + EOL); - for (Iterator i = names.iterator(); i.hasNext(); ) { - PDFDestination dest = (PDFDestination)i.next(); + for (final Iterator i = names.iterator(); i.hasNext(); ) { + final PDFDestination dest = (PDFDestination)i.next(); p.append(dest.toPDF()); } p.append("]" + EOL); @@ -60,7 +60,7 @@ return p.toString(); } - public void add(PDFNamedDestination destination) { + public void add(final PDFNamedDestination destination) { this.names.add(destination); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFNamedDestination.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -49,8 +49,8 @@ * @param destination The PDFDestination that should be referred to by * this named destination. */ - public PDFNamedDestination(PDFDocument doc, String name, - PDFDestination destination) { + public PDFNamedDestination(final PDFDocument doc, final String name, + final PDFDestination destination) { super(doc); this.name = name; this.destination = destination; @@ -63,7 +63,7 @@ * the referred destination. */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append("(" + this.name + ") "); result.append(this.destination.pdfReference() + EOL); return result.toString(); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFObject.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -77,7 +77,7 @@ * Create an empty object. * @param doc The PDFDocument to which this object is attached. */ - public PDFObject(PDFDocument doc) { + public PDFObject(final PDFDocument doc) { this.document = doc; } @@ -85,7 +85,7 @@ // do nothing } - protected void setNumber(int number) { + protected void setNumber(final int number) { if (this.number > -1) { return; } @@ -112,12 +112,12 @@ * @param stream the stream to write the PDF to * @return the number of bytes written */ - protected int output(OutputStream stream) throws IOException { - String pdf = this.toPDF(); + protected int output(final OutputStream stream) throws IOException { + final String pdf = this.toPDF(); if (pdf == null) { return 0; } - byte[] bytes = PDFObject.stringToByteArray(pdf); + final byte[] bytes = PDFObject.stringToByteArray(pdf); stream.write(bytes); return bytes.length; } @@ -147,14 +147,14 @@ */ abstract String toPDF(); - protected static byte[] bufferToByteArray(StringBuffer buffer) { + protected static byte[] bufferToByteArray(final StringBuffer buffer) { return stringToByteArray(buffer.toString()); } - protected static byte[] stringToByteArray(String string) { + protected static byte[] stringToByteArray(final String string) { try { return string.getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return string.getBytes(); } } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutline.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -33,7 +33,7 @@ /** * @param doc {@inheritDoc} */ - public PDFOutline(PDFDocument doc) { + public PDFOutline(final PDFDocument doc) { super(doc); } @@ -46,7 +46,7 @@ * represent the object in PDF */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append(this.pdfID() + EOL); result.append("<<" + EOL); result.append(" /Type /Outlines" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineItem.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -83,8 +83,9 @@ * Private constructor to be used only by the public constructors in this * class. */ - private PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, Color color, boolean italic, boolean bold) { + private PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final Color color, final boolean italic, + final boolean bold) { super(doc); this.parent = parent; parent.addChild(this); @@ -104,9 +105,9 @@ * @param destinationString The name of the named destination that should * be accessed by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, String destinationString, Color color, - boolean italic, boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final String destinationString, + final Color color, final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.destinationString = new PDFTextString(doc, destinationString); } @@ -119,9 +120,9 @@ * @param destination The PDFDestination instance that should be accessed * by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, PDFDestination destination, Color color, - boolean italic, boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final PDFDestination destination, + final Color color, final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.destination = destination; } @@ -134,9 +135,9 @@ * @param action The PDFAction instance that should be accessed * by this Outline Item. */ - public PDFOutlineItem(PDFDocument doc, PDFOutlineParent parent, - String title, PDFAction action, Color color, boolean italic, - boolean bold) { + public PDFOutlineItem(final PDFDocument doc, final PDFOutlineParent parent, + final String title, final PDFAction action, final Color color, + final boolean italic, final boolean bold) { this(doc, parent, title, color, italic, bold); this.action = action; } @@ -155,7 +156,7 @@ if (parent == null) { return null; } - int siblingIndex = getSiblings().indexOf(this); + final int siblingIndex = getSiblings().indexOf(this); if (siblingIndex < 1 || siblingIndex >= getSiblings().size()) { return null; } @@ -166,7 +167,7 @@ if (parent == null) { return null; } - int siblingIndex = getSiblings().indexOf(this); + final int siblingIndex = getSiblings().indexOf(this); if (siblingIndex < 0 || siblingIndex >= getSiblings().size() - 1) { return null; @@ -180,7 +181,7 @@ } int descendants = getChildren().size(); for (int i = 0; i < getChildren().size(); i++) { - PDFOutlineItem child = (PDFOutlineItem) getChildren().get(i); + final PDFOutlineItem child = (PDFOutlineItem) getChildren().get(i); descendants += child.count(); } return descendants; @@ -206,9 +207,9 @@ * represent the object in PDF */ protected String toPDF() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); result.append(this.pdfID() + EOL + "<<" + EOL); - int countDescendants = this.count(); + final int countDescendants = this.count(); // subentry Outline object result.append(" /Title " + title.toPDF() + EOL); result.append(" /Parent " + parent.pdfReference() + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFOutlineParent.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -41,11 +41,11 @@ /** * @param doc {@inheritDoc} */ - public PDFOutlineParent(PDFDocument doc) { + public PDFOutlineParent(final PDFDocument doc) { super(doc); } - public void addChild(PDFOutlineItem child) { + public void addChild(final PDFOutlineItem child) { this.children.add(child); } @@ -72,9 +72,9 @@ /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFOutlineItem createPDFOutlineItem(String titleText, - String internalDestination, Color color, boolean italic, - boolean bold) { + public org.axsl.pdfW.PDFOutlineItem createPDFOutlineItem( + final String titleText, final String internalDestination, + final Color color, final boolean italic, final boolean bold) { return new org.foray.pdf.object.PDFOutlineItem(this.getPDFDocument(), this, titleText, internalDestination, color, italic, bold); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPage.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -76,8 +76,8 @@ * @param pagewidth the page's width in points * @param pageheight the page's height in points */ - public PDFPage(PDFDocument doc, PDFResources resources, int pagewidth, - int pageheight) { + public PDFPage(final PDFDocument doc, final PDFResources resources, + final int pagewidth, final int pageheight) { super(doc); /* add the page to the Root */ doc.getRoot().addPage(this); @@ -87,7 +87,7 @@ this.pageheight = pageheight; this.contents = new PDFContentStream(this.getPDFDocument(), this); this.contents.addDefaultFilters(); - PDFEncryption encryption = this.getPDFDocument().getEncryption(); + final PDFEncryption encryption = this.getPDFDocument().getEncryption(); if (encryption != null) { this.contents.addFilter(encryption.makeFilter()); } @@ -98,7 +98,7 @@ * * @param parent the /Pages object that is this page's parent */ - public void setParent(PDFPages parent) { + public void setParent(final PDFPages parent) { this.parent = parent.pdfReference(); } @@ -114,7 +114,7 @@ return this.annotList; } - public void addShading(PDFShading shading) { + public void addShading(final PDFShading shading) { this.resources.addShading(shading); } @@ -124,7 +124,7 @@ * @return the PDF string */ public String toPDF() { - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append(this.pdfID() + EOL + "<< /Type /Page" + EOL + "/Parent " @@ -146,16 +146,16 @@ * Add a PDFAnnotation to the collection of annotations on this page. * @param annotation The {@link PDFAnnotation} to add. */ - public void addAnnotation(PDFAnnotation annotation) { + public void addAnnotation(final PDFAnnotation annotation) { this.getAnnotList().addAnnotation(annotation); } /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFLink makeLink(Rectangle2D.Float rect, - String destination, boolean externalLink) { - PDFDocument pdfDoc = getPDFDocument(); + public org.axsl.pdfW.PDFLink makeLink(final Rectangle2D.Float rect, + final String destination, final boolean externalLink) { + final PDFDocument pdfDoc = getPDFDocument(); PDFAction action; PDFLink link = null; int index; @@ -163,18 +163,19 @@ if (externalLink) { // check destination if (destination.endsWith(".pdf")) { // FileSpec - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, destination); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, + destination); action = new PDFGoToRemote(pdfDoc, fileSpec); } else if ((index = destination.indexOf(".pdf#page=")) > 0) { - String file = destination.substring(0, index + 4); - int pageNum = Integer.parseInt(destination.substring( + final String file = destination.substring(0, index + 4); + final int pageNum = Integer.parseInt(destination.substring( index + 10)); - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); action = new PDFGoToRemote(pdfDoc, fileSpec, pageNum); } else if ((index = destination.indexOf(".pdf#dest=")) > 0) { - String file = destination.substring(0, index + 4); - String dest = destination.substring(index + 10); - PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); + final String file = destination.substring(0, index + 4); + final String dest = destination.substring(index + 10); + final PDFFileSpec fileSpec = new PDFFileSpec(pdfDoc, file); action = new PDFGoToRemote(pdfDoc, fileSpec, dest); } else { // URI action = new PDFUri(destination); @@ -197,9 +198,9 @@ /** * {@inheritDoc} */ - public PDFExplicitDestination createPDFExplicitDestination(float xPosition, - float yPosition) { - org.foray.pdf.object.PDFExplicitDestination destination + public PDFExplicitDestination createPDFExplicitDestination( + final float xPosition, final float yPosition) { + final org.foray.pdf.object.PDFExplicitDestination destination = new org.foray.pdf.object.PDFExplicitDestination( this.getPDFDocument(), this, xPosition, yPosition); this.getPDFDocument().registerIndirectObjectLast(destination); @@ -209,8 +210,8 @@ /** * {@inheritDoc} */ - public org.axsl.pdfW.PDFLink createPDFLink(Rectangle2D.Float linkRectangle, - String destination) { + public org.axsl.pdfW.PDFLink createPDFLink( + final Rectangle2D.Float linkRectangle, final String destination) { return new org.foray.pdf.object.PDFLink(this.getPDFDocument(), this, linkRectangle, destination); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPages.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -57,7 +57,7 @@ * * @param doc {@inheritDoc} */ - public PDFPages(PDFDocument doc) { + public PDFPages(final PDFDocument doc) { super(doc); } @@ -66,7 +66,7 @@ * * @param page the PDFPage to add. */ - public void addPage(PDFPage page) { + public void addPage(final PDFPage page) { this.kids.add(page.pdfReference()); page.setParent(this); this.incrementCount(); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPathPaint.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -32,7 +32,7 @@ // protected int colorspace = 0; //default is 0:RGB, not 1:CMYK protected ColorSpace colorSpace; - public PDFPathPaint(PDFDocument doc) { + public PDFPathPaint(final PDFDocument doc) { super(doc); } @@ -44,11 +44,11 @@ /** * {@inheritDoc} */ - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { return (""); } - public void setColorSpace(ColorSpace theColorSpace) { + public void setColorSpace(final ColorSpace theColorSpace) { this.colorSpace = theColorSpace; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFPattern.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -131,12 +131,11 @@ * pattern. * @param thePatternDataStream The stream of pattern data to be tiled. */ - public PDFPattern(PDFDocument doc, - PDFResources theResources, int thePatternType, // 1 - int thePaintType, int theTilingType, List theBBox, - double theXStep, double theYStep, - List theMatrix, List theXUID, - StringBuffer thePatternDataStream) { + public PDFPattern(final PDFDocument doc, final PDFResources theResources, + final int thePatternType, final int thePaintType, + final int theTilingType, final List theBBox, final double theXStep, + final double theYStep, final List theMatrix, final List theXUID, + final StringBuffer thePatternDataStream) { super(doc); this.patternCount = doc.registerPatternResource(this); this.resources = theResources; @@ -164,10 +163,9 @@ * @param theExtGState optional: the extended graphics state, if used. * @param theMatrix Optional:List of Doubles that specify the matrix. */ - public PDFPattern(PDFDocument doc, - int thePatternType, PDFShading theShading, - List theXUID, StringBuffer theExtGState, - List theMatrix) { + public PDFPattern(final PDFDocument doc, final int thePatternType, + final PDFShading theShading, final List theXUID, + final StringBuffer theExtGState, final List theMatrix) { super(doc); this.patternCount = doc.registerPatternResource(this); this.patternType = 2; // thePatternType; @@ -191,7 +189,7 @@ return "Pa" + this.patternCount; } - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { if (fillNotStroke) { // fill but no stroke return ("/Pattern cs /" + this.getName() + " scn" + EOL); @@ -200,20 +198,21 @@ return ("/Pattern CS /" + this.getName() + " SCN" + EOL); } - public static PDFPattern createGradient(boolean radial, - ColorSpace theColorSpace, List theColors, List theBounds, - List theCoords, PDFDocument document) { + public static PDFPattern createGradient(final boolean radial, + final ColorSpace theColorSpace, final List theColors, + final List theBounds, final List theCoords, + final PDFDocument document) { PDFShading myShad; PDFFunction myfunky; PDFFunction myfunc; List theCzero; List theCone; PDFPattern myPattern; - double interpolation = 1.000; - List theFunctions = new ArrayList(); + final double interpolation = 1.000; + final List theFunctions = new ArrayList(); int currentPosition; - int lastPosition = theColors.size() - 1; + final int lastPosition = theColors.size() - 1; // if 5 elements, the penultimate element is 3. @@ -222,9 +221,9 @@ for (currentPosition = 0; currentPosition < lastPosition; currentPosition++) { // for every consecutive color pair - PDFColor currentColor = + final PDFColor currentColor = (PDFColor)theColors.get(currentPosition); - PDFColor nextColor = (PDFColor)theColors.get(currentPosition + final PDFColor nextColor = (PDFColor)theColors.get(currentPosition + 1); // colorspace must be consistant if (theColorSpace.getType() @@ -258,7 +257,7 @@ } else { // if the center x, center y, and radius specifiy // the gradient, then assume the same center x, center y, // and radius of zero for the other necessary component - List newCoords = new ArrayList(); + final List newCoords = new ArrayList(); newCoords.add(theCoords.get(0)); newCoords.add(theCoords.get(1)); newCoords.add(theCoords.get(2)); @@ -278,12 +277,12 @@ return (myPattern); } - static ArrayList colorToDoubleList(Color theColor) { - ArrayList theColorVector = new ArrayList(); + static ArrayList colorToDoubleList(final Color theColor) { + final ArrayList theColorVector = new ArrayList(); if (theColor == null) { return theColorVector; } - float[] colorComponents = theColor.getColorComponents(null); + final float[] colorComponents = theColor.getColorComponents(null); for (int i = 0; i < colorComponents.length; i++) { theColorVector.add(new Double(colorComponents[i])); } @@ -304,7 +303,7 @@ public String toPDF() { int vectorSize = 0; int tempInt = 0; - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL + "<<" + EOL + "/Type /Pattern" + EOL); if (this.resources != null) { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRectangle.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -61,7 +61,8 @@ * @param urx upper right x coordinate * @param ury upper right y coordinate */ - public PDFRectangle(int llx, int lly, int urx, int ury) { + public PDFRectangle(final int llx, final int lly, final int urx, + final int ury) { this.llx = llx; this.lly = lly; this.urx = urx; @@ -73,7 +74,7 @@ * * @param array values in the order llx, lly, urx, ury */ - public PDFRectangle(int[] array) { + public PDFRectangle(final int[] array) { this.llx = array[0]; this.lly = array[1]; this.urx = array[2]; @@ -88,7 +89,7 @@ public byte[] toPDF() { try { return toPDFString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return toPDFString().getBytes(); } } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFResources.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -45,7 +45,7 @@ * * @param doc {@inheritDoc} */ - public PDFResources(PDFDocument doc) { + public PDFResources(final PDFDocument doc) { super(doc); } @@ -54,19 +54,19 @@ * * @param font the PDFFont to add */ - public void addFont(PDFFont font) { + public void addFont(final PDFFont font) { this.fonts.add(font); } - public void addXObject(PDFXObject theXObject) { + public void addXObject(final PDFXObject theXObject) { this.xObjects.add(theXObject); } - public void addShading(PDFShading theShading) { + public void addShading(final PDFShading theShading) { this.shadings.add(theShading); } - public void addPattern(PDFPattern thePattern) { + public void addPattern(final PDFPattern thePattern) { this.patterns.add(thePattern); } @@ -76,7 +76,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); if (! this.fonts.isEmpty()) { @@ -84,7 +84,7 @@ p.append("/Font" + EOL); p.append("<<" + EOL); for (int i = 0; i < fonts.size(); i++) { - PDFFont pdfFont = (PDFFont) fonts.get(i); + final PDFFont pdfFont = (PDFFont) fonts.get(i); p.append("/" + pdfFont.getName() + " " + pdfFont.pdfReference() + EOL); } @@ -129,7 +129,7 @@ p.append("/XObject" + EOL); p.append("<<" + EOL); for (int i = 0; i < this.xObjects.size(); i++) { - PDFXObject xObject = (PDFXObject) this.xObjects.get(i); + final PDFXObject xObject = (PDFXObject) this.xObjects.get(i); p.append("/" + xObject.getXObjectName() + " " + xObject.pdfReference() + EOL); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFRoot.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -48,7 +48,7 @@ * Create a Root (/Catalog) object. * @param doc {@inheritDoc} */ - public PDFRoot(PDFDocument doc) { + public PDFRoot(final PDFDocument doc) { super(doc); this.rootPages = new PDFPages(doc); doc.registerIndirectObjectLast(this.rootPages); @@ -60,7 +60,7 @@ * * @param page the /Page object to add */ - public void addPage(PDFPage page) { + public void addPage(final PDFPage page) { this.rootPages.addPage(page); } @@ -89,7 +89,7 @@ * @return The PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/Type /Catalog" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFShading.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -172,11 +172,11 @@ * @param theFunction The PDF Function that maps an (x,y) location to a * color. */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theDomain, - List theMatrix, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final List theDomain, final List theMatrix, + final PDFFunction theFunction) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 1 @@ -211,12 +211,11 @@ * colors past the start and end points. * The default is [false, false] */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, List theCoords, - List theDomain, PDFFunction theFunction, - List theExtend) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final List theCoords, final List theDomain, + final PDFFunction theFunction, final List theExtend) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 2 or 3 @@ -252,12 +251,12 @@ * @param theDecode List of Doubles see PDF 1.3 spec pages 303 to 312. * @param theFunction the PDFFunction */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, int theBitsPerFlag, - List theDecode, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, final int theShadingType, + final ColorSpace theColorSpace, final List theBackground, + final List theBBox, final boolean theAntiAlias, + final int theBitsPerCoordinate, final int theBitsPerComponent, + final int theBitsPerFlag, final List theDecode, + final PDFFunction theFunction) { super(doc); doc.getResources().addShading(this); this.shadingType = theShadingType; // 4,6 or 7 @@ -292,12 +291,12 @@ * @param theFunction The PDFFunction that's mapped on to this shape * @param doc The parent PDF document. */ - public PDFShading(PDFDocument doc, - int theShadingType, ColorSpace theColorSpace, - List theBackground, List theBBox, - boolean theAntiAlias, int theBitsPerCoordinate, - int theBitsPerComponent, List theDecode, - int theVerticesPerRow, PDFFunction theFunction) { + public PDFShading(final PDFDocument doc, + final int theShadingType, final ColorSpace theColorSpace, + final List theBackground, final List theBBox, + final boolean theAntiAlias, final int theBitsPerCoordinate, + final int theBitsPerComponent, final List theDecode, + final int theVerticesPerRow, final PDFFunction theFunction) { super(doc); this.shadingCount = doc.registerShadingResource(this); this.shadingType = theShadingType; // 5 @@ -330,7 +329,7 @@ public String toPDF() { int vectorSize; int tempInt; - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("<<" + EOL); p.append("/ShadingType " + this.shadingType + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFStream.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -73,7 +73,7 @@ * Constructor normally used. Creates an empty stream object. * @param doc The PDFDocument to which this stream is attached. */ - public PDFStream(PDFDocument doc) { + public PDFStream(final PDFDocument doc) { super(doc); initializeVariables(); } @@ -88,14 +88,14 @@ * * @param s the string of PDF to add */ - public void add(String s) { + public void add(final String s) { try { try { _data.write(s.getBytes(PDFDocument.ENCODING)); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { _data.write(s.getBytes()); } - } catch (IOException ex) { + } catch (final IOException ex) { ex.printStackTrace(); } @@ -108,14 +108,14 @@ * flag in the filter is marked true after it has been applied to the * data. */ - public void addFilter(PSFilter filter) { + public void addFilter(final PSFilter filter) { if (filter != null) { _filters.add(filter); } } - public void addFilter(String filterType) { + public void addFilter(final String filterType) { if (filterType == null) { return; } @@ -141,14 +141,14 @@ if (document == null) { return; } - List filters = document.getDefaultFilters(); + final List filters = document.getDefaultFilters(); for (int i = 0; i < filters.size(); i++) { - String filterToAdd = (String)filters.get(i); + final String filterToAdd = (String)filters.get(i); addFilter(filterToAdd); } } - public void setData(byte[] data) throws IOException { + public void setData(final byte[] data) throws IOException { _data.reset(); if (data != null) { _data.write(data); @@ -167,16 +167,16 @@ throw new RuntimeException(); } - protected int output(OutputStream stream) throws IOException { + protected int output(final OutputStream stream) throws IOException { int length = 0; - String filterEntry = applyFilters(); - String s = this.pdfID() + EOL + "<< /Length " + final String filterEntry = applyFilters(); + final String s = this.pdfID() + EOL + "<< /Length " + (_data.size() + 1) + " " + filterEntry + " >>" + EOL; byte[] p; try { p = s.getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = s.getBytes(); } stream.write(p); @@ -184,7 +184,7 @@ length += outputStreamData(stream); try { p = ("endobj" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = ("endobj" + EOL).getBytes(); } stream.write(p); @@ -196,12 +196,13 @@ /** * Output just the stream data enclosed by stream/endstream markers */ - protected int outputStreamData(OutputStream stream) throws IOException { + protected int outputStreamData(final OutputStream stream) + throws IOException { int length = 0; byte[] p; try { p = ("stream" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = ("stream" + EOL).getBytes(); } stream.write(p); @@ -210,7 +211,7 @@ length += _data.size(); try { p = (EOL + "endstream" + EOL).getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { p = (EOL + "endstream" + EOL).getBytes(); } stream.write(p); @@ -229,18 +230,18 @@ if (_filters.size() < 1) { return ""; } - List names = new ArrayList(); - List parms = new ArrayList(); + final List names = new ArrayList(); + final List parms = new ArrayList(); // run the filters for (int i = 0; i < _filters.size(); i++) { - PSFilter filter = (PSFilter)_filters.get(i); + final PSFilter filter = (PSFilter)_filters.get(i); // apply the filter encoding if neccessary if (!filter.isApplied()) { byte[] tmp = null; try { tmp = filter.encode(_data.toByteArray()); - } catch (PSFilterException e) { + } catch (final PSFilterException e) { throw new IOException(e.getMessage()); } _data.reset(); @@ -256,8 +257,8 @@ return buildFilterEntries(names) + buildDecodeParms(parms); } - private String buildFilterEntries(List names) { - StringBuffer sb = new StringBuffer(); + private String buildFilterEntries(final List names) { + final StringBuffer sb = new StringBuffer(); sb.append("/Filter "); if (names.size() > 1) { sb.append("[ "); @@ -273,8 +274,8 @@ return sb.toString(); } - private String buildDecodeParms(List parms) { - StringBuffer sb = new StringBuffer(); + private String buildDecodeParms(final List parms) { + final StringBuffer sb = new StringBuffer(); boolean needParmsEntry = false; sb.append("/DecodeParms "); @@ -282,7 +283,7 @@ sb.append("[ "); } for (int i = 0; i < parms.size(); i++) { - String s = (String)parms.get(i); + final String s = (String)parms.get(i); if (s != null) { sb.append(s); needParmsEntry = true; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFString.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -44,23 +44,24 @@ /** The Font that should be used to render this String */ protected PDFFont font; - public PDFString(PDFDocument doc, String string, PDFFont font) { + public PDFString(final PDFDocument doc, final String string, + final PDFFont font) { super(doc); this.theString = string; this.font = font; } public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("["); buffer.append(startTextDelimiter()); - FontUse font = this.font.getFontUse(); + final FontUse font = this.font.getFontUse(); for (int i = 0; i < theString.length(); i++) { - int codePoint = StringUtilPre5.codePointAt(theString, i); + final int codePoint = StringUtilPre5.codePointAt(theString, i); if (StringUtilPre5.isSupplementaryCodePoint(codePoint)) { i++; } - int ch = font.encodeCharacter(codePoint); + final int ch = font.encodeCharacter(codePoint); addCharToBuffer(buffer, ch); if (i + 1 < theString.length()) { addKerning(font.getFont(), theString.charAt(i), @@ -77,8 +78,8 @@ * @param buffer * @param glyphIndex */ - private void addCharToBuffer(StringBuffer buffer, int glyphIndex) { - Font font = this.font.getFontUse().getFont(); + private void addCharToBuffer(final StringBuffer buffer, int glyphIndex) { + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { buffer.append(PDFString.getUnicodeString(glyphIndex)); return; @@ -92,7 +93,7 @@ if (glyphIndex < 0) { glyphIndex = ' '; } - char c = (char) glyphIndex; + final char c = (char) glyphIndex; switch (c) { case '(': case ')': @@ -115,9 +116,9 @@ * @param buf The StringBuffer to which any kerning information should be * written. */ - private void addKerning(Font font, char char1, char char2, - StringBuffer buf) { - int kernAmount = font.kern(char1, char2); + private void addKerning(final Font font, final char char1, final char char2, + final StringBuffer buf) { + final int kernAmount = font.kern(char1, char2); if (kernAmount == 0) { return; } @@ -128,7 +129,7 @@ } private char startTextDelimiter() { - Font font = this.font.getFontUse().getFont(); + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { return '<'; } @@ -136,7 +137,7 @@ } private char endTextDelimiter() { - Font font = this.font.getFontUse().getFont(); + final Font font = this.font.getFontUse().getFont(); if (font.getFontComplexity() == Font.FONT_COMPOSITE) { return '>'; } @@ -157,18 +158,18 @@ || c > Character.MAX_VALUE) { c = ' '; } - char[] a = {(char) c}; + final char[] a = {(char) c}; try { uniBytes = new String(a).getBytes("UnicodeBigUnmarked"); - } catch (Exception e) { + } catch (final Exception e) { uniBytes = new String(a).getBytes(); } for (int i = 0; i < uniBytes.length; i++) { - int b = (uniBytes[i] < 0) ? (int) (256 + uniBytes[i]) + final int b = (uniBytes[i] < 0) ? (int) (256 + uniBytes[i]) : (int) uniBytes[i]; - String hexString = Integer.toHexString(b); + final String hexString = Integer.toHexString(b); if (hexString.length() == 1) { buf = buf.append("0" + hexString); } else { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFTextString.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -42,7 +42,7 @@ /** The encapsulated String. */ protected String theString; - public PDFTextString(PDFDocument doc, String string) { + public PDFTextString(final PDFDocument doc, final String string) { super(doc); this.theString = string; } @@ -60,10 +60,10 @@ if (this.theString == null) { return new String(); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("("); // Since it is more readable, try to use the PDFDocEncoding. - String pdfDoc = unicodeToPDFDocEncoding(this.theString); + final String pdfDoc = unicodeToPDFDocEncoding(this.theString); if (pdfDoc != null) { buffer.append(pdfDoc); } else { @@ -74,13 +74,13 @@ } private String toPDFUnicode() { - StringBuffer result = new StringBuffer(); + final StringBuffer result = new StringBuffer(); // byte order marker (0xfeff) result.append("\\376\\377"); for (int i = 0; i < this.theString.length(); i++) { - char ch = this.theString.charAt(i); - int high = (ch & 0xff00) >>> 8; - int low = ch & 0xff; + final char ch = this.theString.charAt(i); + final int high = (ch & 0xff00) >>> 8; + final int low = ch & 0xff; result.append("\\"); result.append(Integer.toOctalString(high)); result.append("\\"); @@ -95,11 +95,11 @@ * @return The converted String, or null if unicodeString contains one or * more chars that cannot be converted to PDFDocEncoding. */ - public static String unicodeToPDFDocEncoding(String unicodeString) { - StringBuffer pdfDocString = new StringBuffer(unicodeString); + public static String unicodeToPDFDocEncoding(final String unicodeString) { + final StringBuffer pdfDocString = new StringBuffer(unicodeString); for(int i = 0; i < unicodeString.length(); i++) { - char unicodeChar = unicodeString.charAt(i); - char pdfDocChar = unicodeToPDFDocEncoding(unicodeChar); + final char unicodeChar = unicodeString.charAt(i); + final char pdfDocChar = unicodeToPDFDocEncoding(unicodeChar); if (pdfDocChar == INVALID_PDF_DOC_ENCODING) { return null; } @@ -117,7 +117,7 @@ * @return The PDFDocEncoding equivalent of #unicodeChar if possible, * or #INVALID_PDF_DOC_ENCODING if it cannot be converted. */ - public static char unicodeToPDFDocEncoding(char unicodeChar) { + public static char unicodeToPDFDocEncoding(final char unicodeChar) { /* * This may not be right, but I am pretty sure that the ASCII chars * are the same. Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFToUnicodeCMap.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -51,27 +51,27 @@ * Reference, Second Edition. * @param sysInfo The attributes of the character collection of the CIDFont. */ - public PDFToUnicodeCMap(PDFDocument doc, String name, - PDFCIDSystemInfo sysInfo, FontUse fsFont) { + public PDFToUnicodeCMap(final PDFDocument doc, final String name, + final PDFCIDSystemInfo sysInfo, final FontUse fsFont) { super(doc, name, sysInfo); this.fsFont = fsFont; } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { writeCIDInit(p); writeCIDSystemInfo(p); writeVersionTypeName(p); writeCodeSpaceRange(p); - FontPDF fontPDF = (FontPDF) this.fsFont.getFontOutput( + final FontPDF fontPDF = (FontPDF) this.fsFont.getFontOutput( "application/pdf"); - String bfEntries = fontPDF.getToUnicodeBF(); + final String bfEntries = fontPDF.getToUnicodeBF(); p.append(bfEntries); writeBFEntries(p); writeWrapUp(p); add(p.toString()); } - protected void writeCIDSystemInfo(StringBuffer p) { + protected void writeCIDSystemInfo(final StringBuffer p) { p.append("/CIDSystemInfo" + EOL); p.append("<< /Registry (Adobe)" + EOL); p.append("/Ordering (UCS)" + EOL); @@ -79,7 +79,7 @@ p.append(">> def" + EOL); } - protected void writeVersionTypeName(StringBuffer p) { + protected void writeVersionTypeName(final StringBuffer p) { p.append("/CMapName /Adobe-Identity-UCS def" + EOL); p.append("/CMapType 2 def" + EOL); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFUri.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -37,7 +37,7 @@ * * @param uri the uri to which the link should point */ - public PDFUri(String uri) { + public PDFUri(final String uri) { this.uri = uri; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFWArray.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -48,7 +48,7 @@ * @param start the starting CID value. * @param metrics the metrics array. */ - public void addEntry(int start, int[] metrics) { + public void addEntry(final int start, final int[] metrics) { entries.add(new Entry(start, metrics)); } @@ -59,7 +59,7 @@ * @param last the last CID in the range * @param width the width for all CIDs in the range */ - public void addEntry(int first, int last, int width) { + public void addEntry(final int first, final int last, final int width) { entries.add(new int[] { first, last, width }); @@ -74,7 +74,8 @@ * @param posX the x component for the vertical position vector * @param posY the y component for the vertical position vector */ - public void addEntry(int first, int last, int width, int posX, int posY) { + public void addEntry(final int first, final int last, final int width, + final int posX, final int posY) { entries.add(new int[] { first, last, width, posX, posY }); @@ -83,19 +84,19 @@ public byte[] toPDF() { try { return toPDFString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return toPDFString().getBytes(); } } public String toPDFString() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append("[ "); - int len = entries.size(); + final int len = entries.size(); for (int i = 0; i < len; i++) { - Object entry = entries.get(i); + final Object entry = entries.get(i); if (entry instanceof int[]) { - int[] line = (int[])entry; + final int[] line = (int[])entry; for (int j = 0; j < line.length; j++) { p.append(line[j]); p.append(" "); @@ -114,12 +115,12 @@ private static class Entry { private int start; private int[] metrics; - public Entry(int s, int[] m) { + public Entry(final int s, final int[] m) { start = s; metrics = m; } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { // p.setLength(0); p.append(start); p.append(" ["); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXForm.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -45,9 +45,9 @@ * @param doc * @param img */ - public PDFXForm(PDFDocument doc, Graphic img, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle) - throws GraphicException { + public PDFXForm(final PDFDocument doc, final Graphic img, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle) throws GraphicException { super(doc, img, contentRectangle, clipRectangle); } @@ -55,17 +55,17 @@ return "Form"; } - protected void xObjectContent(PDFStream stream) throws GraphicException, - IOException { + protected void xObjectContent(final PDFStream stream) + throws GraphicException, IOException { if (graphic.getGraphicType() == Graphic.TYPE_EPS) { byte[] bytes = null; try { bytes = convertPStoPDF(); - } catch (GraphicException e) { + } catch (final GraphicException e) { // Ignore this. An error was already logged & fallback is below. } if (bytes == null || bytes.length < 1) { - String s = "0 0 m" + EOL + final String s = "0 0 m" + EOL + "0 1000 l" + EOL + "1000 1000 l" + EOL + "1000 0 l" + EOL @@ -79,28 +79,28 @@ } protected byte[] convertPStoPDF() throws GraphicException { - File file = new File(graphic.getURL().getFile()); + final File file = new File(graphic.getURL().getFile()); PSInputFile psInput = null; try { psInput = new PSInputFile(file); - } catch (IOException e) { + } catch (final IOException e) { throw new GraphicException("Cannot open EPS file."); } - PDFSystemDict systemDict = new PDFSystemDict(); + final PDFSystemDict systemDict = new PDFSystemDict(); PSInterpreter interpreter = null; try { interpreter = new PSInterpreter(getLogger(), psInput, systemDict); interpreter.process(); - } catch (PSException e1) { + } catch (final PSException e1) { getLogger().error(e1.getMessage()); throw new GraphicException("Cannot parse EPS file."); } - byte[] pdfBytes = systemDict.getOutputStream().toByteArray(); + final byte[] pdfBytes = systemDict.getOutputStream().toByteArray(); return pdfBytes; } protected String xObjectDictionary() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("/FormType 1" + EOL); buffer.append("/BBox ["); /* Use the clip rectangle for the bounding box if we have it. Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2006-07-23 20:30:33 UTC (rev 7823) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFXImage.java 2006-07-23 20:51:25 UTC (rev 7824) @@ -52,14 +52,14 @@ /** * Create a sampled-image Xobject. */ - public PDFXImage(PDFDocument doc, Graphic img, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle) - throws GraphicException { + public PDFXImage(final PDFDocument doc, final Graphic img, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle) throws GraphicException { super(doc, img, contentRectangle, clipRectangle); - ColorSpace cs = graphic.getColorSpace(); + final ColorSpace cs = graphic.getColorSpace(); if (graphic.getGraphicType() == Graphic.TYPE_JPEG && cs instanceof ICC_ColorSpace) { - ICC_ColorSpace icc_cs = (ICC_ColorSpace) cs; + final ICC_ColorSpace icc_cs = (ICC_ColorSpace) cs; pdfICCStream = new PDFICCStream(doc, icc_cs); pdfICCStream.addDefaultFilters(); if (doc.getEncryption() != null) { @@ -72,8 +72,8 @@ return "Image"; } - protected void xObjectContent(PDFStream stream) throws GraphicException, - IOException { + protected void xObjectContent(final PDFStream stream) + throws GraphicException, IOException { stream.setData(graphic.getContent()); } @@ -91,10 +91,10 @@ cs = graphic.getColorSpace(); isTransparent = graphic.isTransparent(); transp = graphic.getTransparentColor(); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error("Error in XObject:" + MSG_EOL + e.getMessage()); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); // The width, in pixels (aka samples), *not* points. buffer.append("/Width " + pixelWidth + EOL); // The width, in pixels ... [truncated message content] |