[FOray-commit] SF.net SVN: foray: [7828] trunk/foray/foray-ps/src/java/org/foray/ps/java2d
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-23 22:40:50
|
Revision: 7828 Author: victormote Date: 2006-07-23 15:40:26 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7828&view=rev Log Message: ----------- Implement standard use of final modifier on local variable and method parameters. Modified Paths: -------------- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoFrame.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/DemoPanel.java trunk/foray/foray-ps/src/java/org/foray/ps/java2d/demo/Main.java trunk/foray/foray-ps/src/java/org/foray/ps/readonly/ReadOnlySystemDict.java Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -29,7 +29,7 @@ */ public abstract class CMap extends Encoding { - public CMap(String name) { + public CMap(final String name) { super(name); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,12 +35,12 @@ private int lastEntryAdded = -1; - public CMap04 (String name, int expectedEntries) { + public CMap04 (final String name, final int expectedEntries) { super(name); this.entries = new CMap04Entry[expectedEntries]; } - public void addEntry(CMap04Entry entry) { + public void addEntry(final CMap04Entry entry) { lastEntryAdded++; if (lastEntryAdded >= entries.length) { // Fails silently. @@ -49,29 +49,29 @@ this.entries[lastEntryAdded] = entry; } - public void addEntry(char unicodeStart, char unicodeEnd, - char glyphStartIndex) { - CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, + public void addEntry(final char unicodeStart, final char unicodeEnd, + final char glyphStartIndex) { + final CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, glyphStartIndex); addEntry(newEntry); } - public void addEntry(char unicodeStart, char unicodeEnd, - char[] glyphIndexes) { - CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, + public void addEntry(final char unicodeStart, final char unicodeEnd, + final char[] glyphIndexes) { + final CMap04Entry newEntry = new CMap04Entry(unicodeStart, unicodeEnd, glyphIndexes); addEntry(newEntry); } - public int encodeCharacter(int c) { - CMap04Entry entry = entryForChar((char) c); + public int encodeCharacter(final int c) { + final CMap04Entry entry = entryForChar((char) c); if (entry == null) { return 0; } return entry.encodeCharacter((char) c); } - private CMap04Entry entryForChar(char c) { + private CMap04Entry entryForChar(final char c) { for (int i = 0; i < entries.length; i++) { if (entries[i].containsChar(c)) { return entries[i]; @@ -83,9 +83,9 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int glyphIndexInput) { + public int decodeCharacter(final int glyphIndexInput) { for (int i = 0; i < entries.length; i++) { - char codePoint = entries[i].decodeCharacter(glyphIndexInput); + final char codePoint = entries[i].decodeCharacter(glyphIndexInput); if (codePoint != Character.MAX_VALUE) { return codePoint; } @@ -96,7 +96,7 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { return null; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap04Entry.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -38,15 +38,15 @@ * characters. */ public char[] glyphIndexes; - public CMap04Entry(char unicodeStart, char unicodeEnd, - char glyphStartIndex) { + public CMap04Entry(final char unicodeStart, final char unicodeEnd, + final char glyphStartIndex) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphStartIndex = glyphStartIndex; } - public CMap04Entry(char unicodeStart, char unicodeEnd, - char[] glyphIndexes) { + public CMap04Entry(final char unicodeStart, final char unicodeEnd, + final char[] glyphIndexes) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphIndexes = glyphIndexes; @@ -61,11 +61,11 @@ return (char) (glyphStartIndex + unicodeEnd - unicodeStart); } - public boolean containsChar(char c) { + public boolean containsChar(final char c) { return (c >= this.unicodeStart && c <= this.unicodeEnd); } - public char encodeCharacter(char c) { + public char encodeCharacter(final char c) { if (! containsChar(c)) { return 0; } @@ -75,9 +75,9 @@ return this.glyphIndexes[c - this.unicodeStart]; } - public char decodeCharacter(int glyphIndex) { + public char decodeCharacter(final int glyphIndex) { if (this.glyphIndexes == null) { - char codePoint = (char) (glyphIndex - this.glyphStartIndex + final char codePoint = (char) (glyphIndex - this.glyphStartIndex + this.unicodeStart); if (glyphIndex >= this.glyphStartIndex && codePoint <= this.unicodeStart) { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,12 +35,12 @@ private int lastEntryAdded = -1; - public CMap12 (String name, int expectedEntries) { + public CMap12 (final String name, final int expectedEntries) { super(name); this.entries = new CMap12Entry[expectedEntries]; } - public void addEntry(CMap12Entry entry) { + public void addEntry(final CMap12Entry entry) { lastEntryAdded++; if (lastEntryAdded >= entries.length) { // Fails silently. @@ -49,22 +49,22 @@ this.entries[lastEntryAdded] = entry; } - public void addEntry(int unicodeStart, int unicodeEnd, - int glyphStartIndex) { - CMap12Entry newEntry = new CMap12Entry(unicodeStart, unicodeEnd, + public void addEntry(final int unicodeStart, final int unicodeEnd, + final int glyphStartIndex) { + final CMap12Entry newEntry = new CMap12Entry(unicodeStart, unicodeEnd, glyphStartIndex); addEntry(newEntry); } - public int encodeCharacter(int codePoint) { - CMap12Entry entry = entryForChar(codePoint); + public int encodeCharacter(final int codePoint) { + final CMap12Entry entry = entryForChar(codePoint); if (entry == null) { return 0; } return entry.encodeCharacter(codePoint); } - private CMap12Entry entryForChar(int codePoint) { + private CMap12Entry entryForChar(final int codePoint) { for (int i = 0; i < entries.length; i++) { if (entries[i].containsChar(codePoint)) { return entries[i]; @@ -76,9 +76,9 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int glyphIndexInput) { + public int decodeCharacter(final int glyphIndexInput) { for (int i = 0; i < entries.length; i++) { - int codePoint = entries[i].decodeCharacter(glyphIndexInput); + final int codePoint = entries[i].decodeCharacter(glyphIndexInput); if (codePoint != Character.MAX_VALUE) { return codePoint; } @@ -89,7 +89,7 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { return null; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/CMap12Entry.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -33,7 +33,8 @@ public int unicodeEnd; public int glyphStartIndex; - public CMap12Entry(int unicodeStart, int unicodeEnd, int glyphStartIndex) { + public CMap12Entry(final int unicodeStart, final int unicodeEnd, + final int glyphStartIndex) { this.unicodeStart = unicodeStart; this.unicodeEnd = unicodeEnd; this.glyphStartIndex = glyphStartIndex; @@ -48,7 +49,7 @@ return glyphStartIndex + unicodeEnd - unicodeStart; } - public boolean containsChar(int codePoint) { + public boolean containsChar(final int codePoint) { if (codePoint < this.unicodeStart) { return false; } @@ -58,15 +59,16 @@ return true; } - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { if (! containsChar(codePoint)) { return 0; } return codePoint - this.unicodeStart + this.glyphStartIndex; } - public int decodeCharacter(int glyphIndex) { - int codePoint = glyphIndex - this.glyphStartIndex + this.unicodeStart; + public int decodeCharacter(final int glyphIndex) { + final int codePoint = glyphIndex - this.glyphStartIndex + + this.unicodeStart; if (glyphIndex >= this.glyphStartIndex && codePoint <= this.unicodeStart) { return codePoint; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/Encoding.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -43,7 +43,7 @@ private String name; - public Encoding(String name) { + public Encoding(final String name) { this.name = name; } @@ -73,7 +73,7 @@ return false; } - public boolean canEncode(int codePoint) { + public boolean canEncode(final int codePoint) { return this.encodeCharacter(codePoint) != 0; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingParser.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -78,8 +78,8 @@ /** * Create a new EncodingParser instance. */ - public EncodingParser (Log logger, RandomReader reader, int columnNum, - int radix, String glyphLists) { + public EncodingParser (final Log logger, final RandomReader reader, + final int columnNum, final int radix, final String glyphLists) { this.logger = logger; this.reader = reader; this.columnNum = columnNum; @@ -91,7 +91,7 @@ * Parses a glyph list */ public void parseList() throws IOException { - int numberOfLines = countLines(); + final int numberOfLines = countLines(); if (numberOfLines < 1) { return; } @@ -108,7 +108,7 @@ reader.seek(0); boolean endOfFile = false; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); if (currentLine == null) { endOfFile = true; break; @@ -130,7 +130,7 @@ endOfFile = false; int arrayIndex = 0; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); this.currentLineNumber++; if (currentLine == null) { endOfFile = true; @@ -144,8 +144,8 @@ } } - private boolean lineHasContent(String line) { - char[] charArray = line.toCharArray(); + private boolean lineHasContent(final String line) { + final char[] charArray = line.toCharArray(); for (int i = 0; i < charArray.length; i++) { if (charArray[i] == '#') { // This is a comment. @@ -160,8 +160,8 @@ return false; } - private boolean lineAppliesToEncoding(String line) { - String [] tokens = tokenizeLine(line); + private boolean lineAppliesToEncoding(final String line) { + final String [] tokens = tokenizeLine(line); if (tokens.length < this.columnNum + 1) { return false; } @@ -171,14 +171,14 @@ return true; } - private void processCurrentLine(String line, int arrayIndex) { - String[] tokens = tokenizeLine(line); + private void processCurrentLine(final String line, final int arrayIndex) { + final String[] tokens = tokenizeLine(line); this.glyphNames[arrayIndex] = tokens[0]; - String numericString = tokens[this.columnNum]; + final String numericString = tokens[this.columnNum]; int index = -1; try { index = Integer.parseInt(numericString, this.radix); - } catch (NumberFormatException e) { + } catch (final NumberFormatException e) { logger.error("Invalid octal string, line " + this.currentLineNumber + ": " + numericString); } @@ -195,12 +195,12 @@ * @param line * @return The String array containing the line's fields. */ - private String[] tokenizeLine(String line) { - StringTokenizer tokenizer = new StringTokenizer(line); - String[] tokens = new String[tokenizer.countTokens()]; + private String[] tokenizeLine(final String line) { + final StringTokenizer tokenizer = new StringTokenizer(line); + final String[] tokens = new String[tokenizer.countTokens()]; int tokenIndex = 0; while (tokenizer.hasMoreTokens()) { - String token = tokenizer.nextToken(); + final String token = tokenizer.nextToken(); tokens[tokenIndex] = token; tokenIndex++; } @@ -212,14 +212,15 @@ while (anyChanges) { anyChanges = false; for (int i = 0; i < this.glyphNames.length - 1; i++) { - int compareValue = glyphNames[i].compareTo(glyphNames[i + 1]); + final int compareValue = glyphNames[i].compareTo( + glyphNames[i + 1]); if (compareValue > 0) { /* Item at [i + 1] is less than item at [i]. Switch them * and the same elements in codePointsForGlyphNames. */ - String storeString = glyphNames[i]; + final String storeString = glyphNames[i]; glyphNames[i] = glyphNames[i + 1]; glyphNames[i + 1] = storeString; - char storeChar = glyphIndexes[i]; + final char storeChar = glyphIndexes[i]; glyphIndexes[i] = glyphIndexes[i + 1]; glyphIndexes[i + 1] = storeChar; anyChanges = true; @@ -255,13 +256,14 @@ this.codePoints = new char[glyphNames.length]; this.codePointIndexes = new char[codePoints.length]; for (int i = 0; i < glyphNames.length; i++) { - String glyphName = glyphNames[i]; + final String glyphName = glyphNames[i]; for (int j = 0; j < this.glyphListsToCheck.length; j++) { glyphList = this.glyphListsToCheck[j]; - char codePoint = glyphList.mapGlyphNameToCodePoint(glyphName); + final char codePoint = glyphList.mapGlyphNameToCodePoint( + glyphName); if (codePoint != 0xFFFF) { this.codePoints[i] = codePoint; - char glyphIndex = glyphIndexes[i]; + final char glyphIndex = glyphIndexes[i]; this.codePointIndexes[i] = glyphIndex; break; } @@ -281,7 +283,7 @@ * written. * @throws IOException For errors when writing to out. */ - public void writeAsJavaStatics(OutputStream out) throws IOException { + public void writeAsJavaStatics(final OutputStream out) throws IOException { if (out == null) { return; } @@ -322,7 +324,7 @@ s = " public static final short[] glyphIndexes = {\n"; out.write(s.getBytes()); for (int i = 0; i < glyphIndexes.length; i++) { - char index = glyphIndexes[i]; + final char index = glyphIndexes[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -351,7 +353,7 @@ s = " public static final char[] codePoints = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePoints.length; i++) { - char index = codePoints[i]; + final char index = codePoints[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -377,7 +379,7 @@ s = " public static final char[] codePointIndexes = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePointIndexes.length; i++) { - char index = codePointIndexes[i]; + final char index = codePointIndexes[i]; s = " "; s = s + "0x"; s = s + StringUtil.charToHexString(index, true, 4); @@ -393,8 +395,8 @@ out.write(s.getBytes()); } - public static String padSpaces(String string, int desiredColumn, - int minimumPad) { + public static String padSpaces(String string, final int desiredColumn, + final int minimumPad) { /* The String length + 1 is the next column that will be written if * no padding is added. */ int spacesToPad = desiredColumn - (string.length() + 1); @@ -406,7 +408,7 @@ return string; } - public static String formatArrayIndex(int index) { + public static String formatArrayIndex(final int index) { return "[" + Integer.toString(index) + "]"; } @@ -433,10 +435,10 @@ * The Adobe Glyph List is always consulted, but only after any custom ones * listed here. */ - public static void main(String[] args) { - Log logger = Logging.makeDefaultLogger(); - String usage = "Usage: GlyphListParser <input-file> <column-number> " - + "<output-file> <glyph-lists>?\n"; + public static void main(final String[] args) { + final Log logger = Logging.makeDefaultLogger(); + final String usage = "Usage: GlyphListParser <input-file> " + + "<column-number> <output-file> <glyph-lists>?\n"; if (args.length > 5 || args.length < 4) { logger.error("Wrong number of arguments.\n" + usage); System.exit(1); @@ -444,7 +446,7 @@ URL url = null; try { url = URLFactory.createURL(args[0]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); System.exit(1); @@ -452,14 +454,14 @@ RandomReader input = null; try { input = new RandomReader(url); - } catch (IOException e1) { + } catch (final IOException e1) { logger.error("Unable to create Reader for: " + args[0] + "\n"); System.exit(1); } int columnNum = 0; try { columnNum = Integer.parseInt(args[1]); - } catch (NumberFormatException e5) { + } catch (final NumberFormatException e5) { logger.error("Unable to parse column number: " + args[1] + "\n"); System.exit(1); @@ -470,13 +472,13 @@ } // Get the radix, which is, in this case a base-10 number :-) - int radix = Integer.parseInt(args[2]); + final int radix = Integer.parseInt(args[2]); // Get the output stream. FileOutputStream output = null; try { output = new FileOutputStream(args[3]); - } catch (FileNotFoundException e2) { + } catch (final FileNotFoundException e2) { logger.error("Unable to create FileOutputStream for: " + args[3] + "\n"); System.exit(1); @@ -487,18 +489,18 @@ if (args.length > 4) { customGlyphLists = args[4]; } - EncodingParser parser = new EncodingParser(logger, input, columnNum, - radix, customGlyphLists); + final EncodingParser parser = new EncodingParser(logger, input, + columnNum, radix, customGlyphLists); try { parser.parseList(); - } catch (IOException e3) { + } catch (final IOException e3) { logger.error("Error parsing: " + args[0] + "\n"); logger.error(" " + e3.getMessage()); System.exit(1); } try { parser.writeAsJavaStatics(output); - } catch (IOException e4) { + } catch (final IOException e4) { logger.error("Error writing to: " + args[2] + "\n"); logger.error(" " + e4.getMessage()); System.exit(1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/EncodingVector.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -115,8 +115,8 @@ * codePoints. codePointIndexes[n] should contain the encoded index that * corresponds to the Unicode code point at codePoints[n]. */ - public EncodingVector(String name, GlyphList[] sourceGlyphLists, - char[] codePoints, char[] codePointIndexes) { + public EncodingVector(final String name, final GlyphList[] sourceGlyphLists, + final char[] codePoints, final char[] codePointIndexes) { super(name); this.sourceGlyphLists = sourceGlyphLists; this.codePoints = codePoints; @@ -128,7 +128,7 @@ * predefined encodings * @param name The name of the predefined encoding to be returned. */ - public static EncodingVector getPredefinedEncoding(String name) { + public static EncodingVector getPredefinedEncoding(final String name) { // If already instantiated, return it. EncodingVector encoding = (EncodingVector) predefinedEncodings.get( name); @@ -179,12 +179,13 @@ /** * {@inheritDoc} */ - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { if (this.codePoints == null || this.codePointIndexes == null) { return 0; } - int index = Arrays.binarySearch(this.codePoints, (char) codePoint); + final int index = Arrays.binarySearch(this.codePoints, + (char) codePoint); if (index < 0) { return 0; } @@ -194,7 +195,7 @@ /** * {@inheritDoc} */ - public int decodeCharacter(int encodedIndex) { + public int decodeCharacter(final int encodedIndex) { /* This is not expected to be used much or at all, so the * codePointIndexes array has not been copied and sorted and * referenced.*/ @@ -210,7 +211,8 @@ return INVALID_UNICODE_CHAR; } - public static void registerEncoding(String name, EncodingVector encoding) { + public static void registerEncoding(final String name, + final EncodingVector encoding) { predefinedEncodings.put(name, encoding); } @@ -225,17 +227,17 @@ * @return The glyph name array for this encoding. */ public String[] getGlyphList() { - int listSize = getLastIndex() + 1; - String[] glyphList = new String[listSize]; + final int listSize = getLastIndex() + 1; + final String[] glyphList = new String[listSize]; // Initialize all items to ".notdef". for (int i = 0; i < glyphList.length; i++) { glyphList[i] = EncodingVector.NOTDEF; } for (int i = 0; i < this.codePoints.length; i++) { - char codePoint = this.codePoints[i]; - String glyphName = GlyphList.mapCodePointToGlyphName( + final char codePoint = this.codePoints[i]; + final String glyphName = GlyphList.mapCodePointToGlyphName( this.sourceGlyphLists, codePoint); - int encodingIndex = this.codePointIndexes[i]; + final int encodingIndex = this.codePointIndexes[i]; glyphList[encodingIndex] = glyphName; } return glyphList; @@ -275,8 +277,8 @@ * @param codePointIndexes The array of encoding indexes that whose elements * correspond to elements in codePoints. */ - public static void sortCodePoints(char[] codePoints, - char[] codePointIndexes) { + public static void sortCodePoints(final char[] codePoints, + final char[] codePointIndexes) { boolean anyChanges = true; while (anyChanges) { anyChanges = false; @@ -299,23 +301,23 @@ /** * {@inheritDoc} */ - public String asPostScript(org.axsl.psR.Encoding baseEncoding) { + public String asPostScript(final org.axsl.psR.Encoding baseEncoding) { /* TODO: The baseEncoding is ignored for now. We need to consider it. */ - int maxCharsPerLine = 80; - String indent = " "; - String[] glyphNames = this.getGlyphList(); + final int maxCharsPerLine = 80; + final String indent = " "; + final String[] glyphNames = this.getGlyphList(); if (glyphNames == null) { return null; } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); buffer.append("/Differences\n"); buffer.append("[ 0 \n"); buffer.append(indent); int lineLength = indent.length(); for (int i = 0; i < glyphNames.length; i++) { - String glyphName = glyphNames[i]; + final String glyphName = glyphNames[i]; /* If line length will exceed maxCharsPerLine, add linefeed. */ - int sizeToAdd = glyphName.length() + 2; + final int sizeToAdd = glyphName.length() + 2; if (lineLength + sizeToAdd > maxCharsPerLine) { buffer.append("\n"); buffer.append(indent); @@ -336,7 +338,7 @@ return buffer.toString(); } - public String mapCodePointToGlyphName(int codePoint) { + public String mapCodePointToGlyphName(final int codePoint) { if (this.sourceGlyphLists == null) { return null; } @@ -370,10 +372,11 @@ * @return True iff otherVector encodes all items that this does, and * encodes them the same way. */ - public boolean isSubsetOf(EncodingVector otherVector) { + public boolean isSubsetOf(final EncodingVector otherVector) { for (int i = 0; i < codePoints.length; i++) { - int thisEncodedValue = this.encodeCharacter(codePoints[i]); - int otherEncodedValue = otherVector.encodeCharacter(codePoints[i]); + final int thisEncodedValue = this.encodeCharacter(codePoints[i]); + final int otherEncodedValue = otherVector.encodeCharacter( + codePoints[i]); if (thisEncodedValue != otherEncodedValue) { return false; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphList.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -89,9 +89,10 @@ /** * */ - public GlyphList(String name, String[] sortedGlyphNames, - char[][] codePointsForGlyphNames, char[] sortedCodePoints, - short[] glyphNamesForCodePoints) { + public GlyphList(final String name, final String[] sortedGlyphNames, + final char[][] codePointsForGlyphNames, + final char[] sortedCodePoints, + final short[] glyphNamesForCodePoints) { this.name = name; this.sortedGlyphNames = sortedGlyphNames; this.codePointsForGlyphNames = codePointsForGlyphNames; @@ -105,19 +106,20 @@ * @return The glyph name which corresponds to codePoint, or null if there * is none. */ - public String mapCodePointToGlyphName(int codePoint) { + public String mapCodePointToGlyphName(final int codePoint) { if (sortedCodePoints == null || glyphNamesForCodePoints == null || sortedGlyphNames == null) { return null; } - int sortedCodePointIndex = Arrays.binarySearch(sortedCodePoints, + final int sortedCodePointIndex = Arrays.binarySearch(sortedCodePoints, (char) codePoint); if (sortedCodePointIndex < 0 || sortedCodePointIndex >= glyphNamesForCodePoints.length) { return null; } - int glyphNameIndex = glyphNamesForCodePoints[sortedCodePointIndex]; + final int glyphNameIndex = + glyphNamesForCodePoints[sortedCodePointIndex]; if (glyphNameIndex < 0 || glyphNameIndex >= sortedGlyphNames.length) { return null; @@ -131,19 +133,20 @@ * @return The Unicode code point which corresponds to glyphName, or 0xFFFF * if there is none. */ - public char mapGlyphNameToCodePoint(String glyphName) { - char errorValue = 0xFFFF; + public char mapGlyphNameToCodePoint(final String glyphName) { + final char errorValue = 0xFFFF; if (sortedGlyphNames == null || codePointsForGlyphNames == null) { return errorValue; } - int sortedGlyphNameIndex = Arrays.binarySearch(sortedGlyphNames, + final int sortedGlyphNameIndex = Arrays.binarySearch(sortedGlyphNames, glyphName); if (sortedGlyphNameIndex < 0 || sortedGlyphNameIndex >= codePointsForGlyphNames.length) { return errorValue; } - char[] codePointArray = codePointsForGlyphNames[sortedGlyphNameIndex]; + final char[] codePointArray = + codePointsForGlyphNames[sortedGlyphNameIndex]; if (codePointArray == null) { return errorValue; } @@ -155,7 +158,7 @@ * predefined GlyphList, creates it and returns it. * @param name The name of the GlyphList to be returned. */ - public static GlyphList getGlyphList(String name) { + public static GlyphList getGlyphList(final String name) { // If already instantiated, return it. GlyphList list = (GlyphList) glyphListMap.get(name); if (list != null) { @@ -174,7 +177,8 @@ return list; } - public static void registerGlyphList(String name, GlyphList encoding) { + public static void registerGlyphList(final String name, + final GlyphList encoding) { glyphListMap.put(name, encoding); } @@ -192,23 +196,23 @@ * is none. * @see GlyphList#mapCodePointToGlyphName(int) */ - public static String mapCodePointToGlyphName(GlyphList[] glyphLists, - int codePoint) { + public static String mapCodePointToGlyphName(final GlyphList[] glyphLists, + final int codePoint) { if (glyphLists == null) { return null; } for (int i = 0; i < glyphLists.length; i++) { - GlyphList list = glyphLists[i]; + final GlyphList list = glyphLists[i]; if (list == null) { continue; } - String glyphName = list.mapCodePointToGlyphName(codePoint); + final String glyphName = list.mapCodePointToGlyphName(codePoint); if (glyphName == null) { continue; } /* Make sure it maps back. Otherwise it must have come from a * different list. */ - char roundTripCodePoint = mapGlyphNameToCodePoint(glyphLists, + final char roundTripCodePoint = mapGlyphNameToCodePoint(glyphLists, glyphName); if (roundTripCodePoint == codePoint) { return glyphName; @@ -227,17 +231,17 @@ * {@link Encoding#INVALID_UNICODE_CHAR} if there is none. * @see GlyphList#mapGlyphNameToCodePoint(String) */ - public static char mapGlyphNameToCodePoint(GlyphList[] glyphLists, - String glyphName) { + public static char mapGlyphNameToCodePoint(final GlyphList[] glyphLists, + final String glyphName) { if (glyphLists == null) { return Encoding.INVALID_UNICODE_CHAR; } for (int i = 0; i < glyphLists.length; i++) { - GlyphList list = glyphLists[i]; + final GlyphList list = glyphLists[i]; if (list == null) { continue; } - char c = list.mapGlyphNameToCodePoint(glyphName); + final char c = list.mapGlyphNameToCodePoint(glyphName); if (c != Encoding.INVALID_UNICODE_CHAR) { return c; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/encode/GlyphListParser.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -64,7 +64,7 @@ /** * Create a new GlyphListParser instance. */ - public GlyphListParser (Log logger, RandomReader reader) { + public GlyphListParser (final Log logger, final RandomReader reader) { this.logger = logger; this.reader = reader; } @@ -73,7 +73,7 @@ * Parses a glyph list */ public void parseList() throws IOException { - int numberOfLines = countLines(); + final int numberOfLines = countLines(); if (numberOfLines < 1) { return; } @@ -91,7 +91,7 @@ reader.seek(0); boolean endOfFile = false; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); if (currentLine == null) { endOfFile = true; break; @@ -112,7 +112,7 @@ endOfFile = false; int arrayIndex = 0; while (! endOfFile) { - String currentLine = reader.readLine(); + final String currentLine = reader.readLine(); this.currentLineNumber++; if (currentLine == null) { endOfFile = true; @@ -125,8 +125,8 @@ } } - private boolean lineHasContent(String line) { - char[] charArray = line.toCharArray(); + private boolean lineHasContent(final String line) { + final char[] charArray = line.toCharArray(); for (int i = 0; i < charArray.length; i++) { if (charArray[i] == '#') { // This is a comment. @@ -141,13 +141,13 @@ return false; } - private void processCurrentLine(String line, int arrayIndex) { - String[] tokens = line.split("[; ]"); + private void processCurrentLine(final String line, final int arrayIndex) { + final String[] tokens = line.split("[; ]"); if (tokens.length < 2) { return; } this.glyphNames[arrayIndex] = tokens[0]; - char[] charArray = new char[tokens.length - 1]; + final char[] charArray = new char[tokens.length - 1]; for (int i = 1; i < tokens.length; i++) { int parsedValue = Integer.parseInt(tokens[i], 16); if (parsedValue < 0) { @@ -170,14 +170,15 @@ while (anyChanges) { anyChanges = false; for (int i = 0; i < this.glyphNames.length - 1; i++) { - int compareValue = glyphNames[i].compareTo(glyphNames[i + 1]); + final int compareValue = glyphNames[i].compareTo( + glyphNames[i + 1]); if (compareValue > 0) { /* Item at [i + 1] is less than item at [i]. Switch them * and the same elements in codePointsForGlyphNames. */ - String storeString = glyphNames[i]; + final String storeString = glyphNames[i]; glyphNames[i] = glyphNames[i + 1]; glyphNames[i + 1] = storeString; - char[] storeCharArray = codePointsForGlyphNames[i]; + final char[] storeCharArray = codePointsForGlyphNames[i]; codePointsForGlyphNames[i] = codePointsForGlyphNames[i + 1]; codePointsForGlyphNames[i + 1] = storeCharArray; anyChanges = true; @@ -209,10 +210,10 @@ if (codePoints[i] > codePoints[i + 1]) { /* Switch the two items and the same elements in * glyphNameIndex. */ - char storeChar = codePoints[i]; + final char storeChar = codePoints[i]; codePoints[i] = codePoints[i + 1]; codePoints[i + 1] = storeChar; - short storeShort = glyphNameIndex[i]; + final short storeShort = glyphNameIndex[i]; glyphNameIndex[i] = glyphNameIndex[i + 1]; glyphNameIndex[i + 1] = storeShort; anyChanges = true; @@ -229,7 +230,7 @@ * written. * @throws IOException For errors when writing to out. */ - public void writeAsJavaStatics(OutputStream out) throws IOException { + public void writeAsJavaStatics(final OutputStream out) throws IOException { if (out == null) { return; } @@ -264,10 +265,10 @@ s = " public static final char[][] charForGlyph = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePointsForGlyphNames.length; i++) { - char[] charArray = codePointsForGlyphNames[i]; + final char[] charArray = codePointsForGlyphNames[i]; s = " { "; for (int j = 0; j < charArray.length; j++) { - char theChar = charArray[j]; + final char theChar = charArray[j]; s = s + "0x"; s = s + Integer.toHexString(theChar); if (j < charArray.length - 1) { @@ -291,7 +292,7 @@ s = " public static final char[] charList = {\n"; out.write(s.getBytes()); for (int i = 0; i < codePoints.length; i++) { - char theChar = codePoints[i]; + final char theChar = codePoints[i]; s = " 0x"; s = s + Integer.toHexString(theChar); if (i < codePoints.length - 1) { @@ -309,7 +310,7 @@ s = " public static final short[] glyphNameIndex = {\n"; out.write(s.getBytes()); for (int i = 0; i < glyphNameIndex.length; i++) { - short theShort = glyphNameIndex[i]; + final short theShort = glyphNameIndex[i]; s = " "; s = s + String.valueOf(theShort); if (i < glyphNameIndex.length - 1) { @@ -329,9 +330,10 @@ * Element 1 is the URL of the file to which the java source code should be * written. */ - public static void main(String[] args) { - Log logger = Logging.makeDefaultLogger(); - String usage = "Usage: GlyphListParser <input-file> <output-file>\n"; + public static void main(final String[] args) { + final Log logger = Logging.makeDefaultLogger(); + final String usage = "Usage: GlyphListParser <input-file> " + + "<output-file>\n"; if (args.length != 2) { logger.error("Wrong number of arguments.\n" + usage); System.exit(1); @@ -339,7 +341,7 @@ URL url = null; try { url = URLFactory.createURL(args[0]); - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { logger.error("Unable to create URL for: " + args[0] + "\n"); logger.error(" " + e.getMessage()); System.exit(1); @@ -347,29 +349,29 @@ RandomReader input = null; try { input = new RandomReader(url); - } catch (IOException e1) { + } catch (final IOException e1) { logger.error("Unable to create Reader for: " + args[0] + "\n"); System.exit(1); } FileOutputStream output = null; try { output = new FileOutputStream(args[1]); - } catch (FileNotFoundException e2) { + } catch (final FileNotFoundException e2) { logger.error("Unable to create FileOutputStream for: " + args[1] + "\n"); System.exit(1); } - GlyphListParser parser = new GlyphListParser(logger, input); + final GlyphListParser parser = new GlyphListParser(logger, input); try { parser.parseList(); - } catch (IOException e3) { + } catch (final IOException e3) { logger.error("Error parsing: " + args[0] + "\n"); logger.error(" " + e3.getMessage()); System.exit(1); } try { parser.writeAsJavaStatics(output); - } catch (IOException e4) { + } catch (final IOException e4) { logger.error("Error writing to: " + args[1] + "\n"); logger.error(" " + e4.getMessage()); System.exit(1); Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCII85Filter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -41,9 +41,9 @@ return null; } - public byte[] encode(byte[] data) throws PSFilterException { + public byte[] encode(final byte[] data) throws PSFilterException { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); + final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); int i; @@ -55,12 +55,12 @@ * Note: must have the L at the end, otherwise you get into weird * signed value problems cause we're using a full 32 bits. */ - long val = ((data[i] << 24) + final long val = ((data[i] << 24) & 0xff000000L) + ((data[i + 1] << 16) & 0xff0000L) + ((data[i + 2] << 8) & 0xff00L) + (data[i + 3] & 0xffL); - byte[] conv = convertWord(val); + final byte[] conv = convertWord(val); buffer.write(conv, 0, conv.length); @@ -71,8 +71,8 @@ // then convert like normal (except not applying the special zero rule) // and write out the first n+1 bytes from the result if (i < data.length) { - int n = data.length - i; - byte[] lastdata = new byte[4]; + final int n = data.length - i; + final byte[] lastdata = new byte[4]; for (int j = 0; j < 4; j++) { if (j < n) { lastdata[j] = data[i++]; @@ -81,7 +81,7 @@ } } - long val = ((lastdata[0] << 24) & 0xff000000L) + final long val = ((lastdata[0] << 24) & 0xff000000L) + ((lastdata[1] << 16) & 0xff0000L) + ((lastdata[2] << 8) & 0xff00L) + (lastdata[3] & 0xffL); @@ -98,7 +98,7 @@ } // finally write the two character end of data marker buffer.write(ASCII85_EOD, 0, ASCII85_EOD.length); - byte[] result = buffer.toByteArray(); + final byte[] result = buffer.toByteArray(); return result; } @@ -117,20 +117,20 @@ word = -word; } if (word == 0) { - byte[] result = { (byte)ASCII85_ZERO }; + final byte[] result = { (byte)ASCII85_ZERO }; return result; } - byte c5 = (byte)((word % base85_4) + ASCII85_START); + final byte c5 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c4 = (byte)((word % base85_4) + ASCII85_START); + final byte c4 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c3 = (byte)((word % base85_4) + ASCII85_START); + final byte c3 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c2 = (byte)((word % base85_4) + ASCII85_START); + final byte c2 = (byte)((word % base85_4) + ASCII85_START); word = word / base85_4; - byte c1 = (byte)((word % base85_4) + ASCII85_START); + final byte c1 = (byte)((word % base85_4) + ASCII85_START); - byte[] ret = { c1 , c2, c3, c4, c5 }; + final byte[] ret = { c1 , c2, c3, c4, c5 }; for (int i = 0; i < ret.length; i++) { if (ret[i] < 33 || ret[i] > 117) { throw new PSFilterException("ASCII85 Filter: Illegal char " @@ -143,7 +143,7 @@ /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/ASCIIHexFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -65,20 +65,21 @@ return null; } - public byte[] encode(byte[] data) { - byte[] tentative = ASCIIHexFilter.encodeArray(data, 0, data.length, -1); - byte[] returnArray = new byte[tentative.length + 1]; + public byte[] encode(final byte[] data) { + final byte[] tentative = ASCIIHexFilter.encodeArray(data, 0, + data.length, -1); + final byte[] returnArray = new byte[tentative.length + 1]; System.arraycopy(tentative, 0, returnArray, 0, tentative.length); returnArray[returnArray.length - 1] = END_OF_DATA; return returnArray; } - public byte[] decode(byte[] input) throws PSFilterException { + public byte[] decode(final byte[] input) throws PSFilterException { if (eodLocation > -1) { return null; } // Save the leftover byte - byte savedLeftoverByte = leftoverByte; + final byte savedLeftoverByte = leftoverByte; int dataBytes = 0; if (leftoverByte > -1) { dataBytes++; @@ -134,8 +135,8 @@ * Whitespace characters may be added to the output, so it may be somewhat * larger. */ - public static byte[] encodeArray(byte[] input, int start, int size, - int lineBreak) { + public static byte[] encodeArray(final byte[] input, final int start, + final int size, final int lineBreak) { if (input == null || input.length < 1) { return null; } @@ -145,10 +146,10 @@ if (start + size > input.length) { return null; } - StringBuffer buffer = new StringBuffer(); + final StringBuffer buffer = new StringBuffer(); int lastLineBreak = 0; for (int i = start; i < start + size; i++) { - int val = (input[i] & 0xFF); + final int val = (input[i] & 0xFF); if (val < 16) { buffer.append("0"); } @@ -164,7 +165,7 @@ buffer.append('\n'); try { return buffer.toString().getBytes("US-ASCII"); - } catch (UnsupportedEncodingException ue) { + } catch (final UnsupportedEncodingException ue) { return buffer.toString().getBytes(); } } @@ -188,15 +189,16 @@ * @throws PSFilterException If the input array contains invalid ASCIIHex * characters. */ - public static byte[] decodeArray(byte leftoverByte, byte[] input, - int inputLength, int outputLength) throws PSFilterException { + public static byte[] decodeArray(final byte leftoverByte, + final byte[] input, final int inputLength, final int outputLength) + throws PSFilterException { if (outputLength < 1) { return null; } if (inputLength < 1) { return null; } - byte[] output = new byte[outputLength]; + final byte[] output = new byte[outputLength]; int outputIndex = 0; byte byte1 = 0x00; byte byte2 = 0x00; @@ -242,7 +244,8 @@ return output; } - private static int countDataBytes(byte inputByte) throws PSFilterException { + private static int countDataBytes(final byte inputByte) + throws PSFilterException { switch(inputByte) { case(0x00): // null case(0x20): // space Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/CCITTFaxFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -44,18 +44,18 @@ return this.m_decodeParms; } - public void setDecodeParms(String decodeParms) { + public void setDecodeParms(final String decodeParms) { this.m_decodeParms = decodeParms; } - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return data; } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/DCTFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -41,14 +41,14 @@ return null; } - public byte[] encode(byte[] data) { + public byte[] encode(final byte[] data) { return data; } /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/EncryptFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -127,7 +127,7 @@ * @param randomBytes The quantity of random bytes that should occur at the * beginning of the sequence to be processed. */ - public EncryptFilter(int encryptionKey, byte randomBytes) { + public EncryptFilter(final int encryptionKey, final byte randomBytes) { this.encryptionKey = encryptionKey; this.randomBytes = randomBytes; this.randomBytesToDiscard = this.randomBytes; @@ -144,7 +144,7 @@ /** * Not yet implemented. */ - public byte[] encode(byte[] input) { + public byte[] encode(final byte[] input) { return input; } @@ -180,8 +180,8 @@ return input; } - private byte decrypt(byte cipherText) { - byte temp = (byte) (encryptionKey >> 8); + private byte decrypt(final byte cipherText) { + final byte temp = (byte) (encryptionKey >> 8); byte plainText = (byte) (cipherText ^ temp); // The trick here is to get cipherText treated as unsigned int unsignedCipherText = cipherText; @@ -205,7 +205,7 @@ return plainText; } - private void resolveFormat(byte[] input) { + private void resolveFormat(final byte[] input) { byte inputIndex = 0; while (first4BytesIndex < 4 && inputIndex < input.length) { first4Bytes[first4BytesIndex] = input[inputIndex]; Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/FlateFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -58,7 +58,7 @@ public String getDecodeParms() { if (_predictor > PREDICTION_NONE) { - StringBuffer sb = new StringBuffer(); + final StringBuffer sb = new StringBuffer(); sb.append("<< /Predictor "); sb.append(_predictor); if (_colors > 0) { @@ -83,16 +83,17 @@ * because these attributes are not supported. So the DecodeParms * should be retrieved after calling this method. */ - public byte[] encode(byte[] data) throws PSFilterException { - ByteArrayOutputStream outArrayStream = new ByteArrayOutputStream(); + public byte[] encode(final byte[] data) throws PSFilterException { + final ByteArrayOutputStream outArrayStream = + new ByteArrayOutputStream(); _predictor = PREDICTION_NONE; try { - DeflaterOutputStream compressedStream = + final DeflaterOutputStream compressedStream = new DeflaterOutputStream(outArrayStream); compressedStream.write(data, 0, data.length); compressedStream.flush(); compressedStream.close(); - } catch (IOException e) { + } catch (final IOException e) { throw new PSFilterException(e.getMessage()); } return outArrayStream.toByteArray(); @@ -101,11 +102,11 @@ /** * Unimplemented. */ - public byte[] decode(byte[] input) { + public byte[] decode(final byte[] input) { return input; } - public void setPredictor(int predictor) throws PSFilterException { + public void setPredictor(final int predictor) throws PSFilterException { _predictor = predictor; } @@ -115,7 +116,7 @@ } - public void setColors(int colors) throws PSFilterException { + public void setColors(final int colors) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _colors = colors; } else { @@ -129,7 +130,7 @@ } - public void setBitsPerComponent(int bits) throws PSFilterException { + public void setBitsPerComponent(final int bits) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _bitsPerComponent = bits; } else { @@ -143,7 +144,7 @@ } - public void setColumns(int columns) throws PSFilterException { + public void setColumns(final int columns) throws PSFilterException { if (_predictor != PREDICTION_NONE) { _columns = columns; } else { Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilter.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -56,7 +56,7 @@ * should be set to true and the filter options should be set to * those which the raw data was encoded with. */ - public void setApplied(boolean b) { + public void setApplied(final boolean b) { _applied = b; } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/filter/PSFilterException.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -35,7 +35,7 @@ super(); } - public PSFilterException(String message) { + public PSFilterException(final String message) { super(message); } Modified: trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java =================================================================== --- trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2006-07-23 21:55:19 UTC (rev 7827) +++ trunk/foray/foray-ps/src/java/org/foray/ps/java2d/Java2DSystemDict.java 2006-07-23 22:40:26 UTC (rev 7828) @@ -37,12 +37,13 @@ ... [truncated message content] |