From 0a4a0fdf2e28fd2f685104efcde2cde6b7b57124 Mon Sep 17 00:00:00 2001 From: Simon Pepping Date: Thu, 29 Sep 2011 08:58:12 +0000 Subject: [PATCH] Various small fixes git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1177228 13f79535-47bb-0310-9956-ffa450edef68 --- .../fop/afp/fonts/CharactersetEncoder.java | 40 +++++++++++++------ .../apache/fop/afp/ptoca/PtocaBuilder.java | 11 ++--- .../org/apache/fop/fonts/MultiByteFont.java | 4 +- .../java2d/InstalledFontCollection.java | 6 +-- .../render/ps/PSImageHandlerGraphics2D.java | 2 +- 5 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java b/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java index d82da80eb..19ad8751c 100644 --- a/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java +++ b/src/java/org/apache/fop/afp/fonts/CharactersetEncoder.java @@ -98,7 +98,7 @@ public abstract class CharactersetEncoder { * sequence it will return its EBCDIC code-point, however, the "Shift In - Shift Out" operators * are removed from the sequence of bytes. These are only used in Line Data. */ - private final static class EbcdicDoubleByteEncoder extends CharactersetEncoder { + private static final class EbcdicDoubleByteEncoder extends CharactersetEncoder { private EbcdicDoubleByteEncoder(String encoding) { super(encoding); } @@ -116,7 +116,7 @@ public abstract class CharactersetEncoder { * the primary format for most Latin character sets. This can also be used for Unicode double- * byte character sets (DBCS). */ - private final static class DefaultEncoder extends CharactersetEncoder { + private static final class DefaultEncoder extends CharactersetEncoder { private DefaultEncoder(String encoding) { super(encoding); } @@ -145,20 +145,26 @@ public abstract class CharactersetEncoder { /** * A container for encoded character bytes */ - public static class EncodedChars { + public static final class EncodedChars { - final private byte[] bytes; + private final byte[] bytes; - final private int offset; + private final int offset; - final private int length; + private final int length; private EncodedChars(byte[] bytes, int offset, int length) { - if (offset < 0) throw new IllegalArgumentException(); + if (offset < 0) { + throw new IllegalArgumentException(); + } - if (length < 0) throw new IllegalArgumentException(); + if (length < 0) { + throw new IllegalArgumentException(); + } - if (offset + length > bytes.length) throw new IllegalArgumentException(); + if (offset + length > bytes.length) { + throw new IllegalArgumentException(); + } this.bytes = bytes; @@ -175,14 +181,22 @@ public abstract class CharactersetEncoder { * write length bytes from offset to the output stream * * @param out output to write the bytes to + * @param offset the offset where to write + * @param length the length to write * @throws IOException if an I/O error occurs */ public void writeTo(OutputStream out, int offset, int length) throws IOException { - if (offset < 0) throw new IllegalArgumentException(); + if (offset < 0) { + throw new IllegalArgumentException(); + } - if (length < 0) throw new IllegalArgumentException(); + if (length < 0) { + throw new IllegalArgumentException(); + } - if (offset + length > this.length) throw new IllegalArgumentException(); + if (offset + length > this.length) { + throw new IllegalArgumentException(); + } out.write(bytes, this.offset + offset, length); } @@ -190,7 +204,7 @@ public abstract class CharactersetEncoder { /** * The number of containing bytes. * - * @return + * @return the length */ public int getLength() { return length; diff --git a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java b/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java index d1049ca73..059753338 100644 --- a/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java +++ b/src/java/org/apache/fop/afp/ptoca/PtocaBuilder.java @@ -85,10 +85,6 @@ public abstract class PtocaBuilder implements PtocaConstants { baout.writeTo(out); } - private void write(byte[] data, int offset, int length) { - baout.write(data, offset, length); - } - private void writeByte(int data) { baout.write(data); } @@ -180,14 +176,12 @@ public abstract class PtocaBuilder implements PtocaConstants { currentX = -1; } - private static final int TRANSPARENT_MAX_SIZE = 253; - /** * The Transparent Data control sequence contains a sequence of code points * that are presented without a scan for embedded control sequences. If the data is larger * than fits in one chunk, additional chunks are automatically generated. * - * @param data The text data to add. + * @param encodedChars The encoded text data to add. * @throws IOException if an I/O error occurs */ public void addTransparentData(EncodedChars encodedChars) throws IOException { @@ -206,7 +200,8 @@ public abstract class PtocaBuilder implements PtocaConstants { - private void addTransparentDataChunk(EncodedChars encodedChars, int offset, int length) throws IOException { + private void addTransparentDataChunk(EncodedChars encodedChars, int offset, int length) + throws IOException { newControlSequence(); encodedChars.writeTo(baout, offset, length); commit(chained(TRN)); diff --git a/src/java/org/apache/fop/fonts/MultiByteFont.java b/src/java/org/apache/fop/fonts/MultiByteFont.java index 397ca8a84..0d9897268 100644 --- a/src/java/org/apache/fop/fonts/MultiByteFont.java +++ b/src/java/org/apache/fop/fonts/MultiByteFont.java @@ -47,8 +47,8 @@ public class MultiByteFont extends CIDFont { setFontType(FontType.TYPE0); } - /** {@inheritdoc} */ - public int getdefaultwidth() { + /** {@inheritDoc} */ + public int getDefaultWidth() { return defaultWidth; } diff --git a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java b/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java index 7526c540d..f41dd4d92 100644 --- a/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java +++ b/src/java/org/apache/fop/render/java2d/InstalledFontCollection.java @@ -38,10 +38,10 @@ public class InstalledFontCollection implements FontCollection { private static Log log = LogFactory.getLog(InstalledFontCollection.class); - private static final Set HARDCODED_FONT_NAMES; + private static final Set HARDCODED_FONT_NAMES; static { - HARDCODED_FONT_NAMES = new java.util.HashSet(); + HARDCODED_FONT_NAMES = new java.util.HashSet(); HARDCODED_FONT_NAMES.add("any"); HARDCODED_FONT_NAMES.add("sans-serif"); HARDCODED_FONT_NAMES.add("serif"); @@ -58,7 +58,7 @@ public class InstalledFontCollection implements FontCollection { } /** Required by new instances of FontMetricsMapper */ - final private Java2DFontMetrics java2DFontMetrics; + private final Java2DFontMetrics java2DFontMetrics; /** * Main constructor diff --git a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java b/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java index 682d9286e..9bbd3e62b 100644 --- a/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java +++ b/src/java/org/apache/fop/render/ps/PSImageHandlerGraphics2D.java @@ -168,7 +168,7 @@ public class PSImageHandlerGraphics2D implements PSImageHandler { return formGen; } - private static abstract class EPSFormGenerator extends FormGenerator { + private abstract static class EPSFormGenerator extends FormGenerator { EPSFormGenerator(String formName, String title, Dimension2D dimensions) { super(formName, title, dimensions); -- 2.39.5