[FOray-commit] SF.net SVN: foray: [7823] 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:30:58
|
Revision: 7823 Author: victormote Date: 2006-07-23 13:30:33 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7823&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/PDFAction.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontDescriptor.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontFileStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFontType0.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFunction.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoTo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFGoToRemote.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFICCStream.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFInfo.java trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFLink.java Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAction.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,7 +33,7 @@ * Create an Action object. * @param doc The parent PDFDocument. */ - public PDFAction(PDFDocument doc) { + public PDFAction(final PDFDocument doc) { super(doc); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotList.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -38,7 +38,7 @@ * Create a PDFAnnotList object. * @param doc The parent PDF document. */ - public PDFAnnotList(PDFDocument doc) { + public PDFAnnotList(final PDFDocument doc) { super(doc); } @@ -46,7 +46,7 @@ * Add a PDFAnnotation to the collection. * @param annotation The {@link PDFAnnotation} to add. */ - public void addAnnotation(PDFAnnotation annotation) { + public void addAnnotation(final PDFAnnotation annotation) { if (annotation == null) { return; } @@ -58,12 +58,12 @@ * @param listToAdd The PDFAnnotList whose contents are to be added * to this. */ - public void addAnnotationList(PDFAnnotList listToAdd) { + public void addAnnotationList(final PDFAnnotList listToAdd) { if (listToAdd == null) { return; } for (int i = 0; i < listToAdd.annotations.size(); i++) { - PDFAnnotation annotationToAdd = + final PDFAnnotation annotationToAdd = (PDFAnnotation) listToAdd.annotations.get(i); this.addAnnotation(annotationToAdd); } @@ -74,11 +74,11 @@ * @return the PDF string */ public String toPDF() { - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(this.pdfID() + EOL); p.append("[" + EOL); for (int i = 0; i < annotations.size(); i++) { - PDFAnnotation child = (PDFAnnotation)annotations.get(i); + final PDFAnnotation child = (PDFAnnotation)annotations.get(i); p.append(child.pdfReference() + EOL); } p.append("] endobj" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFAnnotation.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -40,7 +40,8 @@ * @param doc {@inheritDoc} * @param r The rectangle which outlines the link. */ - public PDFAnnotation(PDFDocument doc, PDFPage page, Rectangle2D.Float r) { + public PDFAnnotation(final PDFDocument doc, final PDFPage page, + final Rectangle2D.Float r) { super(doc); this.page = page; this.rectangle = r; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFArray.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -38,7 +38,7 @@ * @param doc The parent PDF document. * @param arrayContents the actual array wrapped by this object */ - public PDFArray(PDFDocument doc, Object arrayContents) { + public PDFArray(final PDFDocument doc, final Object arrayContents) { super(doc); this.arrayContents = arrayContents; } @@ -49,7 +49,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("[" + EOL); buffer.append(addContents()); @@ -60,9 +60,9 @@ } private StringBuffer addContents() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); if (arrayContents instanceof int[]) { - int[] intValues = (int[]) arrayContents; + final int[] intValues = (int[]) arrayContents; for (int i = 0; i < intValues.length; i++) { if (i != 0) { buffer.append(" "); @@ -70,7 +70,7 @@ buffer.append(intValues[i]); } } else if (arrayContents instanceof short[]) { - short[] shortValues = (short[]) arrayContents; + final short[] shortValues = (short[]) arrayContents; for (int i = 0; i < shortValues.length; i++) { if (i != 0) { buffer.append(" "); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFBorderStyle.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -57,7 +57,8 @@ * {@link PDFBorderStyle#STYLE_INSET}, * or {@link PDFBorderStyle#STYLE_UNDERLINE}. */ - public PDFBorderStyle(PDFDocument doc, float width, byte style) { + public PDFBorderStyle(final PDFDocument doc, final float width, + final byte style) { super(doc); this.width = width; this.style = style; @@ -72,7 +73,7 @@ * @return The text that should be placed in the PDF for this object. */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("<< /Type /Border" + EOL); if (this.width >= 0) { Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFont.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -74,8 +74,9 @@ /** * Constructor. */ - public PDFCIDFont(PDFDocument doc, FontUse fsFont, - PDFCIDSystemInfo systemInfo, PDFCIDFontDescriptor descriptor) { + public PDFCIDFont(final PDFDocument doc, final FontUse fsFont, + final PDFCIDSystemInfo systemInfo, + final PDFCIDFontDescriptor descriptor) { super(doc); this.fsFont = fsFont; this.dw2 = null; @@ -91,8 +92,8 @@ * @return the PDF */ public String toPDF() { - Font font = fsFont.getFont(); - StringBuffer p = new StringBuffer(); + final Font font = fsFont.getFont(); + final StringBuffer p = new StringBuffer(); p.append(pdfID() + EOL); p.append("<< /Type /Font"); p.append(EOL + "/BaseFont /"); @@ -132,14 +133,14 @@ return p.toString(); } - protected static byte getCidType(Font fsFont) { + protected static byte getCidType(final Font fsFont) { if (fsFont.getFontFormat() == Font.FORMAT_TRUETYPE) { return PDFCIDFont.CID_TYPE2; } return PDFCIDFont.CID_TYPE0; } - private static String getCidTypeName(Font fsFont) { + private static String getCidTypeName(final Font fsFont) { return TYPE_NAMES[PDFCIDFont.getCidType(fsFont)]; } @@ -147,7 +148,7 @@ if (! fsFont.getFont().isEmbeddable()) { return null; } - FontPDF outputHelper = (FontPDF) fsFont.getFontOutput( + final FontPDF outputHelper = (FontPDF) fsFont.getFontOutput( "application/pdf"); return outputHelper.getWidths(); } @@ -160,16 +161,17 @@ * entry. * @return The String containing the /W entry. */ - public static String widthArrayToPDFString(short[] widthArray) { + public static String widthArrayToPDFString(final short[] widthArray) { if (widthArray.length == 0) { return ""; } - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(EOL + "/W ["); int start = 0; int end = 0; while (start < widthArray.length) { - int nextEqualRunStarts = findStartOfNextEqualRun(widthArray, start); + final int nextEqualRunStarts = findStartOfNextEqualRun(widthArray, + start); if (nextEqualRunStarts < 0) { /* * There are no more Equal Runs. Therefore, write the remaining @@ -199,8 +201,8 @@ return p.toString(); } - private static void writeWidthArrayUnequalRun(StringBuffer p, - short[] widthArray, int start, int end) { + private static void writeWidthArrayUnequalRun(final StringBuffer p, + final short[] widthArray, final int start, final int end) { p.append(" " + start + " ["); for (int i = start; i <= end; i++) { p.append(widthArray[i]); @@ -211,8 +213,8 @@ p.append("]"); } - private static int writeWidthArrayEqualRun(StringBuffer p, - short[] widthArray, int start) { + private static int writeWidthArrayEqualRun(final StringBuffer p, + final short[] widthArray, final int start) { // First, compute the end-point of the run. int end = -1; for (int i = start; i < widthArray.length && end < 0; i++) { @@ -238,7 +240,8 @@ * @return The index to the first array element that starts a run of 3 or * more equal values in the array, or -1 if there is not one. */ - private static int findStartOfNextEqualRun(short[] widthArray, int start) { + private static int findStartOfNextEqualRun(final short[] widthArray, + final int start) { int returnValue = -1; for (int i = start; i < widthArray.length - 2 && returnValue < 0; i++) { if ((widthArray[i] == widthArray[i + 1]) Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDFontDescriptor.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -43,17 +43,17 @@ * @param font The PDF Font for which this FontDescript is created. * @param lang the language. */ - public PDFCIDFontDescriptor(PDFDocument doc, PDFFont font, - String lang) { + public PDFCIDFontDescriptor(final PDFDocument doc, final PDFFont font, + final String lang) { super(doc, font); this.lang = lang; } - public void setCIDSet(PDFStream cidSet) { + public void setCIDSet(final PDFStream cidSet) { this.cidSet = cidSet; } - protected void fillInPDF(StringBuffer p) { + protected void fillInPDF(final StringBuffer p) { p.append(EOL + "/MissingWidth 500" + EOL); if (lang != null) { p.append(EOL + "/Lang /"); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCIDSystemInfo.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -37,8 +37,8 @@ protected String ordering; protected int supplement; - public PDFCIDSystemInfo(String registry, String ordering, - int supplement) { + public PDFCIDSystemInfo(final String registry, final String ordering, + final int supplement) { this.registry = registry; this.ordering = ordering; this.supplement = supplement; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCMap.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -139,7 +139,8 @@ * @param name one the registered names (see Table 7.20 on p 215) * @param sysInfo the attributes of the character collection of the CIDFont */ - public PDFCMap(PDFDocument doc, String name, PDFCIDSystemInfo sysInfo) { + public PDFCMap(final PDFDocument doc, final String name, + final PDFCIDSystemInfo sysInfo) { super(doc); this.name = name; this.sysInfo = sysInfo; @@ -152,7 +153,7 @@ * @param mode is either <code>WMODE_HORIZONTAL</code> * or <code>WMODE_VERTICAL</code> */ - public void setWMode(byte mode) { + public void setWMode(final byte mode) { this.wMode = mode; } @@ -161,7 +162,7 @@ * * @param base the name of the base CMap (see Table 7.20) */ - public void setUseCMap(String base) { + public void setUseCMap(final String base) { this.base = base; } @@ -170,16 +171,16 @@ * * @param base the stream to be used as base CMap */ - public void setUseCMap(PDFStream base) { + public void setUseCMap(final PDFStream base) { this.base = base; } - protected int output(OutputStream stream) throws IOException { + protected int output(final OutputStream stream) throws IOException { fillInPDF(new StringBuffer()); return super.output(stream); } - public void fillInPDF(StringBuffer p) { + public void fillInPDF(final StringBuffer p) { writePreStream(p); writeStreamComments(p); writeCIDInit(p); @@ -194,13 +195,13 @@ add(p.toString()); } - protected void writePreStream(StringBuffer p) { + protected void writePreStream(final StringBuffer p) { // p.append("/Type /CMap" + EOL); // p.append(sysInfo.toPDFString()); // p.append("/CMapName /" + name + EOL); } - protected void writeStreamComments(StringBuffer p) { + protected void writeStreamComments(final StringBuffer p) { p.append("%!PS-Adobe-3.0 Resource-CMap" + EOL); p.append("%%DocumentNeededResources: ProcSet (CIDInit)" + EOL); p.append("%%IncludeResource: ProcSet (CIDInit)" + EOL); @@ -208,13 +209,13 @@ p.append("%%EndComments" + EOL); } - protected void writeCIDInit(StringBuffer p) { + protected void writeCIDInit(final StringBuffer p) { p.append("/CIDInit /ProcSet findresource begin" + EOL); p.append("12 dict begin" + EOL); p.append("begincmap" + EOL); } - protected void writeCIDSystemInfo(StringBuffer p) { + protected void writeCIDSystemInfo(final StringBuffer p) { p.append("/CIDSystemInfo 3 dict dup begin" + EOL); p.append(" /Registry (Adobe) def" + EOL); p.append(" /Ordering (Identity) def" + EOL); @@ -222,43 +223,43 @@ p.append("end def" + EOL); } - protected void writeVersionTypeName(StringBuffer p) { + protected void writeVersionTypeName(final StringBuffer p) { p.append("/CMapVersion 1 def" + EOL); p.append("/CMapType 1 def" + EOL); p.append("/CMapName /" + name + " def" + EOL); } - protected void writeCodeSpaceRange(StringBuffer p) { + protected void writeCodeSpaceRange(final StringBuffer p) { p.append("1 begincodespacerange" + EOL); p.append("<0000> <FFFF>" + EOL); p.append("endcodespacerange" + EOL); } - protected void writeCIDRange(StringBuffer p) { + protected void writeCIDRange(final StringBuffer p) { p.append("1 begincidrange" + EOL); p.append("<0000> <FFFF> 0" + EOL); p.append("endcidrange" + EOL); } - protected void writeBFEntries(StringBuffer p) { + protected void writeBFEntries(final StringBuffer p) { // p.append("1 beginbfrange" + EOL); // p.append("<0020> <0100> <0000>" + EOL); // p.append("endbfrange" + EOL); } - protected void writeWrapUp(StringBuffer p) { + protected void writeWrapUp(final StringBuffer p) { p.append("endcmap" + EOL); p.append("CMapName currentdict /CMap defineresource pop" + EOL); p.append("end" + EOL); p.append("end" + EOL); } - protected void writeStreamAfterComments(StringBuffer p) { + protected void writeStreamAfterComments(final StringBuffer p) { p.append("%%EndResource" + EOL); p.append("%%EOF" + EOL); } - protected void writeUseCMap(StringBuffer p) { + protected void writeUseCMap(final StringBuffer p) { /* * p.append(" /Type /CMap"); * p.append("/CMapName /" + name + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFCharProcs.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -52,7 +52,7 @@ * @param name the character name * @param stream the stream that draws the character */ - public void addCharacter(String name, PDFStream stream) { + public void addCharacter(final String name, final PDFStream stream) { keys.put(name, stream); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFColor.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,17 +33,17 @@ protected Color color; - public PDFColor(Color theColor) { + public PDFColor(final Color theColor) { this.color = theColor; this.colorSpace = this.color.getColorSpace(); } - public String getColorSpaceOut(boolean fillNotStroke) { + public String getColorSpaceOut(final boolean fillNotStroke) { return PSColor.toPS(this.color, fillNotStroke, "\n"); } String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("["); buffer.append(getRed() + " "); buffer.append(getGreen() + " "); @@ -52,15 +52,15 @@ return buffer.toString(); } - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (!(obj instanceof PDFColor)) { return false; } - PDFColor otherColor = (PDFColor) obj; + final PDFColor otherColor = (PDFColor) obj; return this.getColor().equals(otherColor.getColor()); } - public static String getColorSpacePDFString(ColorSpace colorSpace) { + public static String getColorSpacePDFString(final ColorSpace colorSpace) { if (colorSpace == null) { return null; } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFContentStream.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -67,7 +67,7 @@ /** * Create a PDFContentStream. */ - public PDFContentStream(PDFDocument doc, PDFPage page) { + public PDFContentStream(final PDFDocument doc, final PDFPage page) { super(doc); this.page = page; } @@ -104,22 +104,23 @@ } } - public synchronized void setCursor(float originX, float originY) { + public synchronized void setCursor(final float originX, + final float originY) { openTextObject(); add("1 0 0 1 " + originX + " " + originY + " Tm" + EOL); } - public synchronized void drawText(String text) { + public synchronized void drawText(final String text) { if (text.length() < 1) { return; } openTextObject(); - PDFString pdfString = new PDFString(this.getPDFDocument(), text, + final PDFString pdfString = new PDFString(this.getPDFDocument(), text, this.getGS().getFont()); add(pdfString.toPDF()); } - public void setFont(PDFFont newFont, float newFontSize) { + public void setFont(final PDFFont newFont, final float newFontSize) { openTextObject(); boolean anyChange = false; anyChange |= this.getGS().setFont(newFont); @@ -128,11 +129,11 @@ // Nothing needs to change. return; } - String psStyleName = newFont.getName(); + final String psStyleName = newFont.getName(); add("/" + psStyleName + " " + newFontSize + " Tf" + EOL); } - public void setStrokeColor(PDFColor newStrokeColor) { + public void setStrokeColor(final PDFColor newStrokeColor) { if (! this.getGS().setStrokeColor(newStrokeColor)) { // Nothing needs to change. return; @@ -140,7 +141,7 @@ add(newStrokeColor.getColorSpaceOut(true)); } - public void setWordSpacing(float newWordSpacing) { + public void setWordSpacing(final float newWordSpacing) { openTextObject(); if (! this.getGS().setWordSpacing(newWordSpacing)) { // Nothing needs to change. @@ -149,7 +150,7 @@ add(newWordSpacing + " Tw" + EOL); } - public void setCharacterSpacing(float newCharacterSpacing) { + public void setCharacterSpacing(final float newCharacterSpacing) { openTextObject(); if (! this.getGS().setCharacterSpacing(newCharacterSpacing)) { // Nothing needs to change. @@ -158,7 +159,8 @@ add(newCharacterSpacing + " Tc" + EOL); } - public void setLineDashPattern(float[] dashArray, float dashPhase) { + public void setLineDashPattern(final float[] dashArray, + final float dashPhase) { if (! this.getGS().setLineDashPattern(dashArray, dashPhase)) { // Nothing needs to change. return; @@ -178,8 +180,9 @@ /** * {@inheritDoc} */ - public void drawLine(Line2D.Float line, float thickness, float[] dashArray, - float dashPhase, PDFPathPaint stroke) { + public void drawLine(final Line2D.Float line, final float thickness, + final float[] dashArray, final float dashPhase, + final PDFPathPaint stroke) { closeTextObject(); add("q" + EOL); add(stroke.getColorSpaceOut(false)); @@ -193,8 +196,9 @@ /** * {@inheritDoc} */ - public void drawRectangle(Rectangle2D.Float rectangle, boolean stroke, - PDFPathPaint strokePaint, boolean fill, PDFPathPaint fillPaint) { + public void drawRectangle(final Rectangle2D.Float rectangle, + final boolean stroke, final PDFPathPaint strokePaint, + final boolean fill, final PDFPathPaint fillPaint) { // Bail out if stroke and fill are both missing. if (stroke == false && fill == false) { return; @@ -229,8 +233,8 @@ /** * {@inheritDoc} */ - public void drawGraphic(Rectangle2D.Float contentRectangle, - Rectangle2D.Float clipRectangle, Graphic image) { + public void drawGraphic(final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle, final Graphic image) { /* Use drawSVG() method for SVG. */ if (image instanceof SVGGraphic) { return; @@ -239,7 +243,7 @@ try { xObject = PDFXObject.makeXObject(this.getPDFDocument(), image, contentRectangle, clipRectangle); - } catch (GraphicException e) { + } catch (final GraphicException e) { getLogger().error(e.getMessage()); return; } @@ -266,11 +270,13 @@ /** * {@inheritDoc} */ - public void drawSVGDocument(SVGDocument doc, - Rectangle2D.Float contentRectangle, Rectangle2D.Float clipRectangle, - FontConsumer fontConsumer, boolean strokeSVGText) { + public void drawSVGDocument(final SVGDocument doc, + final Rectangle2D.Float contentRectangle, + final Rectangle2D.Float clipRectangle, + final FontConsumer fontConsumer, + final boolean strokeSVGText) { closeTextObject(); - PDFGraphics2D graphics = getPDFContent4SVG(contentRectangle, + final PDFGraphics2D graphics = getPDFContent4SVG(contentRectangle, fontConsumer, doc, strokeSVGText); if (graphics == null) { // Error messages have already been logged. @@ -300,8 +306,8 @@ this.page.getAnnotList().addAnnotationList(graphics.getAnnotList()); } - private void clip(Rectangle2D.Float clipRectangle, - Rectangle2D.Float contentRectangle) { + private void clip(final Rectangle2D.Float clipRectangle, + final Rectangle2D.Float contentRectangle) { if (clipRectangle == null || contentRectangle == null) { return; } @@ -326,9 +332,10 @@ add("h W n" + EOL); } - public PDFGraphics2D getPDFContent4SVG(Rectangle2D.Float contentRectangle, - FontConsumer fontConsumer, - SVGDocument svgDocument, boolean strokeSVGText) { + public PDFGraphics2D getPDFContent4SVG( + final Rectangle2D.Float contentRectangle, + final FontConsumer fontConsumer, + final SVGDocument svgDocument, final boolean strokeSVGText) { /* If not running in a graphical environment, log an error message * and skip the SVG. */ if (! Environment.isGraphicalEnvironment()) { @@ -336,7 +343,7 @@ + "to process SVG. Skipping."); return null; } - SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); + final SVGUserAgent userAgent = new SVGUserAgent(new AffineTransform()); userAgent.setLogger(getLogger()); BridgeContext ctx = new BridgeContext(userAgent); GVTBuilder builder = new GVTBuilder(); @@ -348,7 +355,7 @@ } ctx.setTextPainter(textPainter); - PDFAElementBridge aBridge = new PDFAElementBridge(); + final PDFAElementBridge aBridge = new PDFAElementBridge(); aBridge.setCurrentTransform(new AffineTransform(1, 0, 0, -1, contentRectangle.x, contentRectangle.y)); ctx.putBridge(aBridge); @@ -356,7 +363,7 @@ GraphicsNode root; try { root = builder.build(ctx, svgDocument); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be built: " + e.getMessage()); getLogger().error(e.getMessage()); @@ -365,13 +372,14 @@ ctx = null; builder = null; - PDFGraphics2D graphics = new PDFGraphics2D(true, this.getPDFDocument(), + final PDFGraphics2D graphics = new PDFGraphics2D(true, + this.getPDFDocument(), contentRectangle, svgDocument, fontConsumer); graphics.setGraphicContext(new GraphicContext()); try { root.paint(graphics); - } catch (Exception e) { + } catch (final Exception e) { getLogger().error("svg graphic could not be rendered: " + e.getMessage()); getLogger().error(e.getMessage()); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDate.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -45,7 +45,7 @@ /** * Create a PDFDate instance. */ - public PDFDate(PDFDocument doc, Date date) { + public PDFDate(final PDFDocument doc, final Date date) { super(doc); this.date = date; } @@ -54,12 +54,13 @@ if (this.date == null) { return new String(); } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("(D:"); - SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); + final SimpleDateFormat formatter = new SimpleDateFormat( + "yyyyMMddHHmmss"); buffer.append(formatter.format(this.date)); formatter.applyPattern("Z"); - String tzOffset = formatter.format(this.date); + final String tzOffset = formatter.format(this.date); buffer.append(tzOffset.substring(0, 3)); buffer.append("'"); buffer.append(tzOffset.substring(3, 5)); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDestination.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -31,7 +31,7 @@ */ public abstract class PDFDestination extends PDFObject { - public PDFDestination(PDFDocument doc) { + public PDFDestination(final PDFDocument doc) { super(doc); } 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 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -194,7 +194,7 @@ * updated later. This allows Pages to refer to their * Parent before we write it out. */ - public PDFDocument(Log logger) { + public PDFDocument(final Log logger) { this.logger = logger; // Create the Root object @@ -220,7 +220,7 @@ * {@inheritDoc} * If not set, the default value is PDF_VERSION_1_6. */ - public void setVersion(int newVersion) throws PDFException { + public void setVersion(final int newVersion) throws PDFException { if (newVersion >= 0 && newVersion < validVersions.length) { this.pdfVersion = newVersion; return; @@ -236,7 +236,7 @@ return this.colorspace; } - public void setColorSpace(ColorSpace theColorspace) { + public void setColorSpace(final ColorSpace theColorspace) { this.colorspace = theColorspace; } @@ -269,7 +269,8 @@ * This can be done as often as desired. * @param stream The OutputStream to which the output should be written. */ - public void writeIndirectObjects(OutputStream stream) throws IOException { + public void writeIndirectObjects(final OutputStream stream) + 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 @@ -277,7 +278,7 @@ */ while (indirectObjects.size() > 0) { /* retrieve the object with the current number */ - PDFObject object = (PDFObject) indirectObjects.get(0); + final PDFObject object = (PDFObject) indirectObjects.get(0); recordLocation(object); /* @@ -292,7 +293,7 @@ /** * @param object */ - private void recordLocation(PDFObject object) { + private void recordLocation(final PDFObject object) { /* Ensure there is room in the locations xref for the number of * objects that have been created. */ while(location.size() < lastIndirectObjectAssigned + 1) { @@ -309,20 +310,20 @@ /** * {@inheritDoc} */ - public void outputHeader(OutputStream stream) throws IOException { + public void outputHeader(final OutputStream stream) throws IOException { this.position = 0; - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); // The PDF identifier comment. buffer.append("%PDF-" + versionStrings[pdfVersion] + PDFObject.EOL); // A binary comment as recommended by the PDF spec (3.4.1) buffer.append("%" + (char) 0xAA + (char) 0xAB + (char) 0xAC + (char) 0xAD + PDFObject.EOL); - byte[] bytes = PDFObject.bufferToByteArray(buffer); + final byte[] bytes = PDFObject.bufferToByteArray(buffer); stream.write(bytes); this.position += bytes.length; } - public void close(OutputStream stream) throws IOException { + public void close(final OutputStream stream) throws IOException { outputTrailer(stream); } @@ -331,17 +332,17 @@ * * @param stream the OutputStream to write the trailer to */ - private void outputTrailer(OutputStream stream) throws IOException { + private void outputTrailer(final OutputStream stream) throws IOException { writeIndirectObjects(stream); for (int i = 0; i < indirectObjectsLast.size(); i++) { - PDFObject o = (PDFObject) indirectObjectsLast.get(i); + final PDFObject o = (PDFObject) indirectObjectsLast.get(i); recordLocation(o); this.position += o.output(stream); } writeIndirectObjects(stream); /* remember position of xref table */ - int xrefPosition = this.position; + final int xrefPosition = this.position; /* output the xref table and increment the character position by the table's length */ @@ -349,7 +350,7 @@ this.position += outputXref(stream); /* construct the trailer */ - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(getTrailerContent()); buffer.append("startxref" + PDFObject.EOL); buffer.append(xrefPosition + PDFObject.EOL); @@ -359,14 +360,14 @@ byte[] trailer; try { trailer = buffer.toString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { trailer = buffer.toString().getBytes(); } stream.write(trailer); } private String getTrailerContent() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("trailer" + PDFObject.EOL); buffer.append("<<" + PDFObject.EOL); buffer.append("/Size " + (this.lastIndirectObjectAssigned + 1) @@ -391,18 +392,18 @@ * @param stream the OutputStream to write the xref table to * @return the number of characters written */ - private int outputXref(OutputStream stream) throws IOException { + private int outputXref(final OutputStream stream) throws IOException { /* construct initial part of xref */ - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("xref" + PDFObject.EOL); buffer.append("0 " + (this.lastIndirectObjectAssigned + 1) + PDFObject.EOL); buffer.append("0000000000 65535 f" + PDFObject.XREF_EOL); for (int i = 1; i < this.location.size(); i++) { - String x = this.location.get(i).toString(); + final String x = this.location.get(i).toString(); /* contruct xref entry for object */ - String padding = "0000000000"; - String loc = padding.substring(x.length()) + x; + final String padding = "0000000000"; + final String loc = padding.substring(x.length()) + x; /* append to xref table */ buffer.append(loc + " 00000 n" + PDFObject.XREF_EOL); } @@ -410,7 +411,7 @@ byte[] pdfBytes; try { pdfBytes = buffer.toString().getBytes(PDFDocument.ENCODING); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { pdfBytes = buffer.toString().getBytes(); } stream.write(pdfBytes); @@ -420,7 +421,7 @@ /** * Increment the object count and return it. */ - public void registerIndirectObject(PDFObject object) { + public void registerIndirectObject(final PDFObject object) { if (object.getNumber() > -1) { return; } @@ -428,7 +429,7 @@ this.indirectObjects.add(object); } - public void registerIndirectObjectLast(PDFObject object) { + public void registerIndirectObjectLast(final PDFObject object) { if (object.getNumber() > -1) { return; } @@ -440,7 +441,7 @@ * Increment the shadingCount and return it. * @return The incremented shading count. */ - public int registerShadingResource(PDFShading shading) { + public int registerShadingResource(final PDFShading shading) { registerIndirectObject(shading); getResources().addShading(shading); return ++this.lastShadingAssigned; @@ -450,7 +451,7 @@ * Increment the patternCount and return it. * @return The incremented pattern count. */ - public int registerPatternResource(PDFPattern pattern) { + public int registerPatternResource(final PDFPattern pattern) { registerIndirectObject(pattern); getResources().addPattern(pattern); return ++this.lastPatternAssigned; @@ -460,7 +461,7 @@ * Increment the lastFontAssigned and return it. * @return The incremented font count. */ - public int registerFontResource(PDFFont font) { + public int registerFontResource(final PDFFont font) { registerIndirectObject(font); getResources().addFont(font); return ++this.lastFontAssigned; @@ -470,7 +471,8 @@ * Increment the patternCount and return it. * @return The incremented pattern count. */ - public int registerXObjectResource(PDFXObject theXObject, URL url) { + public int registerXObjectResource(final PDFXObject theXObject, + final URL url) { // Add it to the global map so that it can be reused. this.xObjectsMap.put(url, theXObject); registerIndirectObject(theXObject); @@ -489,7 +491,7 @@ /** * {@inheritDoc} */ - public void addDefaultFilter(String filterToAdd) { + public void addDefaultFilter(final String filterToAdd) { if (filterToAdd == null) { return; } @@ -503,7 +505,7 @@ * @return The tag to be prefixed to the subset font's name. */ public String getNextFontSubsetTag() { - StringBuffer tag = new StringBuffer(); + final StringBuffer tag = new StringBuffer(); for (int i = 0; i < nextFontSubsetTag.length; i ++) { tag.append(nextFontSubsetTag[i]); } @@ -541,11 +543,11 @@ * @param url The URL for whom a PDFXObject is sought. * @return The corresponding PDFXObject, or null if there is none. */ - public PDFXObject findXObject(URL url) { + public PDFXObject findXObject(final URL url) { return (PDFXObject) xObjectsMap.get(url); } - public PDFEncoding obtainPDFEncoding(Encoding encoding) { + public PDFEncoding obtainPDFEncoding(final Encoding encoding) { if (encoding == null) { return null; } @@ -558,13 +560,13 @@ return pdfEncoding; } - public org.axsl.pdfW.PDFFont getPDFFont(FontUse fontUse) { - Font font = fontUse.getFont(); + public org.axsl.pdfW.PDFFont getPDFFont(final FontUse fontUse) { + final Font font = fontUse.getFont(); /* Look for a match in the existing fonts. */ for (int i = 0; i < this.usedFonts.size(); i++) { - PDFFont pdfFont = (PDFFont) this.usedFonts.get(i); - FontUse testFontUse = pdfFont.getFsFont(); - Font testFont = testFontUse.getFont(); + final PDFFont pdfFont = (PDFFont) this.usedFonts.get(i); + final FontUse testFontUse = pdfFont.getFsFont(); + final Font testFont = testFontUse.getFont(); /* For there to be a match, the underlying fonts must be the same * and the encoding must be the same. */ if (testFont == font @@ -572,7 +574,7 @@ return pdfFont; } } - PDFFont pdfFont = PDFFont.makeFont(this, fontUse); + final PDFFont pdfFont = PDFFont.makeFont(this, fontUse); this.usedFonts.add(pdfFont); return pdfFont; } @@ -580,18 +582,18 @@ /** * {@inheritDoc} */ - public void setProducer(String producer) { + public void setProducer(final String producer) { this.getInfo().setProducer(producer); } /** * {@inheritDoc} */ - public void setCreationDate(Date creationDate) { + public void setCreationDate(final Date creationDate) { this.getInfo().setCreationDate(creationDate); } - public void addNamedDestination(PDFNamedDestination destination) { + public void addNamedDestination(final PDFNamedDestination destination) { this.getRoot().getDestinations().add(destination); } @@ -612,7 +614,7 @@ /** * {@inheritDoc} */ - public PDFColor createPDFColor(Color color) { + public PDFColor createPDFColor(final Color color) { org.foray.pdf.object.PDFColor pdfColor = null; for (int i = 0; i < this.usedColors.size(); i++) { pdfColor = (org.foray.pdf.object.PDFColor) this.usedColors.get(i); @@ -628,7 +630,7 @@ /** * {@inheritDoc} */ - public PDFPage createPDFPage(int pagewidth, int pageheight) { + public PDFPage createPDFPage(final int pagewidth, final int pageheight) { return new org.foray.pdf.object.PDFPage(this, this.getResources(), pagewidth, pageheight); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEmbeddedFileStream.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -33,7 +33,7 @@ /** * Create a PDFEmbeddedFileStream instance. */ - public PDFEmbeddedFileStream(PDFDocument doc) { + public PDFEmbeddedFileStream(final PDFDocument doc) { super(doc); } Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncoding.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -41,7 +41,7 @@ * Constructor. Creates the /Encoding object. * @param doc The parent PDF document. */ - public PDFEncoding(PDFDocument doc, Encoding encoding) { + public PDFEncoding(final PDFDocument doc, final Encoding encoding) { super(doc); this.encoding = encoding; } @@ -78,7 +78,7 @@ * need to be written into the document. */ return new String(); } - StringBuffer p = new StringBuffer(); + final StringBuffer p = new StringBuffer(); p.append(pdfID() + EOL); p.append("% " + this.encoding.getName() + EOL); p.append("<< /Type /Encoding" + EOL); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFEncryption.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -49,7 +49,7 @@ /** The constructor for the internal PDFEncryption filter * @param encryption The encryption object to use */ - public EncryptionFilter(PDFEncryption encryption) { + public EncryptionFilter(final PDFEncryption encryption) { super(); this.encryption = encryption; } @@ -73,14 +73,14 @@ * @param data The data to be encrypted * @return The encrypted data */ - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return encryption.encryptData(data, getNumber(), getGeneration()); } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } @@ -127,14 +127,14 @@ * Create a /Filter /Standard object. * @param doc The parent PDF document. */ - public PDFEncryption(PDFDocument doc) { + public PDFEncryption(final PDFDocument doc) { super(doc); try { digest = MessageDigest.getInstance("MD5"); cipher = Cipher.getInstance("RC4"); - } catch (NoSuchAlgorithmException e) { + } catch (final NoSuchAlgorithmException e) { throw new IllegalStateException(e.getMessage()); - } catch (NoSuchPaddingException e) { + } catch (final NoSuchPaddingException e) { throw new IllegalStateException(e.getMessage()); } doc.registerIndirectObjectLast(this); @@ -143,7 +143,7 @@ /** * {@inheritDoc} */ - public void setUserPassword(String value) { + public void setUserPassword(final String value) { this.userPassword = value; } @@ -157,7 +157,7 @@ /** * {@inheritDoc} */ - public void setOwnerPassword(String value) { + public void setOwnerPassword(final String value) { this.ownerPassword = value; } @@ -171,36 +171,36 @@ /** * {@inheritDoc} */ - public void setAllowPrint(boolean value) { + public void setAllowPrint(final boolean value) { this.allowPrint = value; } /** * {@inheritDoc} */ - public void setAllowCopyContent(boolean value) { + public void setAllowCopyContent(final boolean value) { this.allowCopyContent = value; } /** * {@inheritDoc} */ - public void setAllowEditContent(boolean value) { + public void setAllowEditContent(final boolean value) { this.allowEditContent = value; } /** Set whether the document will allow annotation modificcations * @param value The new permission value */ - public void setAllowEditAnnotation(boolean value) { + public void setAllowEditAnnotation(final boolean value) { this.allowEditAnnotations = value; } // Internal procedures - private byte [] prepPassword(String password) { - byte [] obuffer = new byte[32]; - byte [] pbuffer = password.getBytes(); + private byte [] prepPassword(final String password) { + final byte [] obuffer = new byte[32]; + final byte [] pbuffer = password.getBytes(); int i = 0; int j = 0; @@ -215,8 +215,8 @@ return obuffer; } - private String toHex(byte [] value) { - StringBuffer buffer = new StringBuffer(); + private String toHex(final byte [] value) { + final StringBuffer buffer = new StringBuffer(); for(int i=0; i < value.length; i++) { buffer.append(digits[(value[i] >>> 4) & 0x0F]); @@ -242,34 +242,35 @@ * @param index The index to access the file ID * @return The file ID */ - public String getFileID(int index) { + public String getFileID(final int index) { if (index == 1) { return toHex(getFileID()); } - byte [] id = new byte[16]; + final byte [] id = new byte[16]; random.nextBytes(id); return toHex(id); } - private byte [] encryptWithKey(byte [] data, byte [] key) { + private byte [] encryptWithKey(final byte [] data, final byte [] key) { try { - SecretKeySpec keyspec = new SecretKeySpec(key, "RC4"); + final SecretKeySpec keyspec = new SecretKeySpec(key, "RC4"); cipher.init(Cipher.ENCRYPT_MODE,keyspec); return cipher.doFinal(data); - } catch (IllegalBlockSizeException e) { + } catch (final IllegalBlockSizeException e) { throw new IllegalStateException(e.getMessage()); - } catch (BadPaddingException e) { + } catch (final BadPaddingException e) { throw new IllegalStateException(e.getMessage()); - } catch (InvalidKeyException e) { + } catch (final InvalidKeyException e) { throw new IllegalStateException(e.getMessage()); } } - private byte [] encryptWithHash(byte [] data, byte [] hash, int size) { + private byte [] encryptWithHash(final byte [] data, byte [] hash, + final int size) { hash = digest.digest(hash); - byte [] key = new byte[size]; + final byte [] key = new byte[size]; for(int i = 0; i < size; i++) { key[i] = hash[i]; @@ -316,7 +317,7 @@ digest.update((byte) (permissions >>> 24)); digest.update(getFileID()); - byte [] hash = digest.digest(); + final byte [] hash = digest.digest(); this.encryptionKey = new byte[5]; for(int i = 0; i < 5; i++) { @@ -324,7 +325,8 @@ } // Create the user value - byte [] uValue = encryptWithKey(prepPassword(""),this.encryptionKey); + final byte [] uValue = encryptWithKey( + prepPassword(""),this.encryptionKey); // Create the dictionary this.dictionary = this.pdfID() + EOL + "<< /Filter /Standard" + EOL @@ -344,13 +346,14 @@ * @param generation The block generation * @return The encrypted data */ - public byte [] encryptData(byte [] data, int number, int generation) { + public byte [] encryptData(final byte [] data, final int number, + final int generation) { if (this.encryptionKey == null) { throw new IllegalStateException("PDF Encryption has not been " + "initialized"); } - byte [] hash = new byte[this.encryptionKey.length+5]; + final byte [] hash = new byte[this.encryptionKey.length+5]; int i = 0; Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFExplicitDestination.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -44,8 +44,8 @@ protected float leftPosition = 0; protected float topPosition = 0; - public PDFExplicitDestination(PDFDocument doc, PDFPage page, - float xPosition, float yPosition) { + public PDFExplicitDestination(final PDFDocument doc, final PDFPage page, + final float xPosition, final float yPosition) { super(doc); this.page = page; this.leftPosition = xPosition; @@ -57,7 +57,7 @@ * describes this destination. */ protected String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("[" + this.page.pdfReference() + " /XYZ " + leftPosition + " " + topPosition + " null]" + EOL); @@ -69,8 +69,8 @@ * {@inheritDoc} */ public org.axsl.pdfW.PDFNamedDestination createPDFNamedDestination( - String name) { - org.foray.pdf.object.PDFNamedDestination destination + final String name) { + final org.foray.pdf.object.PDFNamedDestination destination = new org.foray.pdf.object.PDFNamedDestination( this.getPDFDocument(), name, this); this.getPDFDocument().addNamedDestination(destination); Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFileSpec.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -40,7 +40,7 @@ * @param doc The parent PDF document. * @param filename the filename represented by this object */ - public PDFFileSpec(PDFDocument doc, String filename) { + public PDFFileSpec(final PDFDocument doc, final String filename) { super(doc); this.filename = filename; } @@ -51,7 +51,7 @@ * @return the PDF string */ public String toPDF() { - String p = new String(pdfID() + EOL + final String p = new String(pdfID() + EOL + "<<" + EOL + "/Type /FileSpec" + EOL + "/F (" + this.filename + ")" + EOL Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java =================================================================== --- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-07-23 20:07:00 UTC (rev 7822) +++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFFont.java 2006-07-23 20:30:33 UTC (rev 7823) @@ -94,7 +94,7 @@ * @param doc The parent PDF document. * @param fsFont The FreeStandingFont which is the basis for this PDF Font. */ - public PDFFont(PDFDocument doc, FontUse fsFont) { + public PDFFont(final PDFDocument doc, final FontUse fsFont) { super(doc); this.fontCount = doc.registerFontResource(this); this.fsFont = fsFont; @@ -111,9 +111,10 @@ * @param fsFont The FreeStandingFont to be added * @return the created /Font object */ - public static PDFFont makeFont(PDFDocument pdfDoc, FontUse fsFont) { + public static PDFFont makeFont(final PDFDocument pdfDoc, + final FontUse fsFont) { if (fsFont.getFont().isPDFStandardFont()) { - PDFFont font = new PDFFont(pdfDoc, fsFont); + final PDFFont font = new PDFFont(pdfDoc, fsFont); return font; } switch (PDFFont.getFontSubtype(fsFont)) { @@ -151,7 +152,7 @@ * @return the PDF */ public String toPDF() { - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append(this.pdfID() + EOL); buffer.append("<<" + EOL); buffer.append("/Type /Font" + EOL); @@ -177,7 +178,7 @@ * as if they were not standard when they use a non-standard encoding. * We're not sure why this is necessary, but it seems to be. */ if (this.fsFont.getFont().isPDFStandardFont()) { - Encoding encoding = this.fsFont.getEncoding(); + final Encoding encoding = this.fsFont.getEncoding(); if (encoding.isPredefinedPDF()) { return true; } @@ -190,7 +191,7 @@ return false; } - protected void writeFirstChar(StringBuffer buffer) { + protected void writeFirstChar(final StringBuffer buffer) { if (isStandardFont()) { return; } @@ -200,7 +201,7 @@ buffer.append(EOL); } - protected void writeLastChar(StringBuffer buffer) { + protected void writeLastChar(final StringBuffer buffer) { if (isStandardFont()) { return; } @@ -210,18 +211,18 @@ buffer.append(EOL); } - protected void writeWidths(StringBuffer buffer) { + protected void writeWidths(final StringBuffer buffer) { if (isStandardFont()) { return; } - PDFArray widthArray = new PDFArray(this.document, + final PDFArray widthArray = new PDFArray(this.document, getFontOutput().getWidths()); buffer.append("/Widths "); buffer.append(widthArray.pdfReference()); buffer.append(EOL); } - protected void writeFontDescriptor(StringBuffer buffer) { + protected void writeFontDescriptor(final StringBuffer buffer) { if (descriptor == null) { return; } @@ -230,7 +231,7 @@ buffer.append(EOL); } - private void writeE... [truncated message content] |